sourcehook/test/testbail.cpp
author Pavol Marko <pavolmarko@gmail.com>
Fri May 27 21:39:30 2005 +0000 (2005-05-27)
changeset 75 8d8efeb2ecc8
child 121 158b860440c0
permissions -rw-r--r--
Added TestBail
     1 // TESTBAIL
     2 // Test for a bug Bail has found
     3 
     4 #include "testbail.h"
     5 
     6 void *___testbail_gabgab;
     7 
     8 bool TestBail(std::string &error)
     9 {
    10 	SourceHook::CSourceHookImpl g_SHImpl;
    11 	g_SHPtr = &g_SHImpl;
    12 	g_PLID = 1;
    13 
    14 	g_Gabgab = new IGaben;
    15 	___testbail_gabgab = (void*)g_Gabgab;
    16 
    17 	g_Gabgab->EatYams();
    18 
    19 	SH_ADD_HOOK_STATICFUNC(IGaben, EatYams, g_Gabgab, EatYams0_Handler, false);
    20 
    21 	g_Gabgab->EatYams();
    22 
    23 	___TestBail2();
    24 	
    25 	g_Gabgab->EatYams();
    26 
    27 	SH_REMOVE_HOOK_STATICFUNC(IGaben, EatYams, g_Gabgab, EatYams0_Handler, false);
    28 
    29 	g_Gabgab->EatYams();
    30 
    31 	delete g_Gabgab;
    32 
    33 	// If it didn't crash, it's ok
    34 
    35 	return true;
    36 }
    37