sourcehook/test/main.cpp
changeset 111 aec58c99dafc
parent 100 022428df37c9
child 133 ffe46578a1ae
     1.1 --- a/sourcehook/test/main.cpp	Tue Sep 13 22:16:29 2005 +0000
     1.2 +++ b/sourcehook/test/main.cpp	Fri Sep 23 20:14:10 2005 +0000
     1.3 @@ -1,14 +1,15 @@
     1.4  // Hello BAIL!
     1.5  //   hello pm how are you
     1.6 +//    I'm fine, what about you?
     1.7  // This is a test file
     1.8  
     1.9  #include <stdio.h>
    1.10  #include <iostream>
    1.11  #include <string>
    1.12 -#include <list>
    1.13  #include <stdlib.h>
    1.14  #include <time.h>
    1.15  #include "sh_tinyhash.h"
    1.16 +#include "sh_list.h"
    1.17  #include "sourcehook_impl.h"
    1.18  
    1.19  using namespace std;
    1.20 @@ -21,7 +22,7 @@
    1.21  	TestProto m_Func;
    1.22  	std::string m_Name;
    1.23  
    1.24 -	static std::list<Test *> ms_Tests;
    1.25 +	static SourceHook::List<Test *> ms_Tests;
    1.26  public:
    1.27  	Test(TestProto func, const char *name) : m_Func(func), m_Name(name)
    1.28  	{
    1.29 @@ -46,7 +47,7 @@
    1.30  	static void DoTests()
    1.31  	{
    1.32  		int passed=0, failed=0;
    1.33 -		for (std::list<Test*>::iterator iter = ms_Tests.begin(); iter != ms_Tests.end(); ++iter)
    1.34 +		for (SourceHook::List<Test*>::iterator iter = ms_Tests.begin(); iter != ms_Tests.end(); ++iter)
    1.35  		{
    1.36  			if ((**iter)())
    1.37  				++passed;
    1.38 @@ -58,40 +59,22 @@
    1.39  	}
    1.40  };
    1.41  
    1.42 -std::list<Test *> Test::ms_Tests;
    1.43 +SourceHook::List<Test *> Test::ms_Tests;
    1.44  
    1.45  #define DO_TEST(x) \
    1.46  	bool Test##x(std::string &error); \
    1.47  	Test g_Test##x(Test##x, #x);
    1.48  
    1.49 +DO_TEST(List);
    1.50  DO_TEST(Basic);
    1.51  DO_TEST(VafmtAndOverload);
    1.52  DO_TEST(ThisPtrOffs);
    1.53  DO_TEST(PlugSys);
    1.54  DO_TEST(Bail);
    1.55  
    1.56 -template <>
    1.57 -int SourceHook::HashFunction<int>(const int & k)
    1.58 -{
    1.59 -	return k;
    1.60 -}
    1.61 -
    1.62 -template <>
    1.63 -int SourceHook::Compare<int>(const int & v1, const int & v2)
    1.64 -{
    1.65 -	if (v1 == v2)
    1.66 -		return 0;
    1.67 -	if (v1 < v2)
    1.68 -		return -1;
    1.69 -	if (v1 > v2)
    1.70 -		return 1;
    1.71 -	return 0;
    1.72 -}
    1.73 -
    1.74  int main(int argc, char *argv[])
    1.75  {
    1.76  	std::string error;
    1.77 -	int passed=0, failed=0;
    1.78  
    1.79  	g_Verbose = argc > 1 && strcmp(argv[1], "-v") == 0;
    1.80