1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/sourcehook/test/testbail.cpp Fri May 27 21:39:30 2005 +0000
1.3 @@ -0,0 +1,37 @@
1.4 +// TESTBAIL
1.5 +// Test for a bug Bail has found
1.6 +
1.7 +#include "testbail.h"
1.8 +
1.9 +void *___testbail_gabgab;
1.10 +
1.11 +bool TestBail(std::string &error)
1.12 +{
1.13 + SourceHook::CSourceHookImpl g_SHImpl;
1.14 + g_SHPtr = &g_SHImpl;
1.15 + g_PLID = 1;
1.16 +
1.17 + g_Gabgab = new IGaben;
1.18 + ___testbail_gabgab = (void*)g_Gabgab;
1.19 +
1.20 + g_Gabgab->EatYams();
1.21 +
1.22 + SH_ADD_HOOK_STATICFUNC(IGaben, EatYams, g_Gabgab, EatYams0_Handler, false);
1.23 +
1.24 + g_Gabgab->EatYams();
1.25 +
1.26 + ___TestBail2();
1.27 +
1.28 + g_Gabgab->EatYams();
1.29 +
1.30 + SH_REMOVE_HOOK_STATICFUNC(IGaben, EatYams, g_Gabgab, EatYams0_Handler, false);
1.31 +
1.32 + g_Gabgab->EatYams();
1.33 +
1.34 + delete g_Gabgab;
1.35 +
1.36 + // If it didn't crash, it's ok
1.37 +
1.38 + return true;
1.39 +}
1.40 +