2 // hello pm how are you
3 // I'm fine, what about you?
4 // not bad, just looking for mem leaks
5 // mem leaks in my code!? never! I have to preserve binary compatibility :(
13 #include "sh_tinyhash.h"
15 #include "sourcehook_impl.h"
16 #include "sourcehook.h"
24 typedef bool (*TestProto)(std::string&);
28 static SourceHook::List<Test *> ms_Tests;
30 Test(TestProto func, const char *name) : m_Func(func), m_Name(name)
32 ms_Tests.push_back(this);
40 cout << "Test" << m_Name << " FAILED: " << error << endl;
45 cout << "Test" << m_Name << " passed" << endl;
52 int passed=0, failed=0;
53 for (SourceHook::List<Test*>::iterator iter = ms_Tests.begin(); iter != ms_Tests.end(); ++iter)
60 cout << endl << "----" << endl << "Passed: " << passed << endl << "Failed: " << failed << endl;
61 cout << "Total: " << passed + failed << endl;
65 SourceHook::List<Test *> Test::ms_Tests;
68 bool Test##x(std::string &error); \
69 Test g_Test##x(Test##x, #x);
73 DO_TEST(VafmtAndOverload);
82 int main(int argc, char *argv[])
86 g_Verbose = argc > 1 && strcmp(argv[1], "-v") == 0;
90 cout << "Press enter to continue" << endl;
96 SourceHook::ISourceHook *Test_Factory()
98 return new SourceHook::CSourceHookImpl();
101 void Test_Delete(SourceHook::ISourceHook *shptr)
103 delete static_cast<SourceHook::CSourceHookImpl *>(shptr);
106 void Test_CompleteShutdown(SourceHook::ISourceHook *shptr)
108 static_cast<SourceHook::CSourceHookImpl *>(shptr)->CompleteShutdown();
111 bool Test_IsPluginInUse(SourceHook::ISourceHook *shptr, SourceHook::Plugin plug)
113 return static_cast<SourceHook::CSourceHookImpl *>(shptr)->IsPluginInUse(plug);
116 void Test_UnloadPlugin(SourceHook::ISourceHook *shptr, SourceHook::Plugin plug)
118 static_cast<SourceHook::CSourceHookImpl *>(shptr)->UnloadPlugin(plug);
121 void Test_PausePlugin(SourceHook::ISourceHook *shptr, SourceHook::Plugin plug)
123 static_cast<SourceHook::CSourceHookImpl *>(shptr)->PausePlugin(plug);
126 void Test_UnpausePlugin(SourceHook::ISourceHook *shptr, SourceHook::Plugin plug)
128 static_cast<SourceHook::CSourceHookImpl *>(shptr)->UnpausePlugin(plug);