sourcehook/test/testbail2.cpp
branchsourcemm-1.6.0
changeset 347 e82968c21606
child 361 f34718303c8f
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/sourcehook/test/testbail2.cpp	Tue Sep 18 20:03:47 2007 +0000
     1.3 @@ -0,0 +1,36 @@
     1.4 +// TESTBAIL
     1.5 +//  Different compilation unit
     1.6 +
     1.7 +#include "sourcehook.h"
     1.8 +#include "sourcehook_test.h"
     1.9 +#include "testbail.h"
    1.10 +
    1.11 +
    1.12 +int EatYams_Handler2(int a)
    1.13 +{
    1.14 +	ADD_STATE(State_EatYams_Handler2_Called(a));
    1.15 +	RETURN_META_VALUE_NEWPARAMS(MRES_OVERRIDE, 6, &IGaben::EatYams, (0xBEEF));
    1.16 +}
    1.17 +
    1.18 +int EatYams_Handler3(int a)
    1.19 +{
    1.20 +	ADD_STATE(State_EatYams_Handler3_Called(a));
    1.21 +	RETURN_META_VALUE(MRES_IGNORED, 0);
    1.22 +}
    1.23 +
    1.24 +namespace N_TestBail
    1.25 +{
    1.26 +	bool TestBail2(std::string &error)
    1.27 +	{
    1.28 +		g_PLID = 2;
    1.29 +
    1.30 +		SH_ADD_HOOK_STATICFUNC(IGaben, EatYams, g_Gabgab, EatYams_Handler2, false);
    1.31 +		SH_ADD_HOOK_STATICFUNC(IGaben, EatYams, g_Gabgab, EatYams_Handler3, false);
    1.32 +
    1.33 +		int ret = g_Gabgab->EatYams(0xDEAD);
    1.34 +
    1.35 +		CHECK_COND(ret == 6, "Part 2.1");
    1.36 +
    1.37 +		return true;
    1.38 +	}
    1.39 +}