sourcehook/test/test1.cpp
changeset 49 ec95d7681407
parent 48 a52dba4f8ed9
child 58 71016f952503
     1.1 --- a/sourcehook/test/test1.cpp	Sun May 01 12:36:48 2005 +0000
     1.2 +++ b/sourcehook/test/test1.cpp	Sun May 01 14:30:52 2005 +0000
     1.3 @@ -12,90 +12,17 @@
     1.4  	// Basic tests
     1.5  	// Hooking and callclass
     1.6  
     1.7 -	struct State_F1_Called : State
     1.8 -	{
     1.9 -	};
    1.10 -
    1.11 -	struct State_F1_PreHandler_Called : State
    1.12 -	{
    1.13 -	};
    1.14 -
    1.15 -	struct State_F1_PostHandler_Called : State
    1.16 -	{
    1.17 -	};
    1.18 -
    1.19 -	struct State_F1_HookAdded : State
    1.20 -	{
    1.21 -		bool m_Successfully;
    1.22 -		State_F1_HookAdded(bool successfully) : m_Successfully(successfully)
    1.23 -		{
    1.24 -		}
    1.25 -
    1.26 -		bool IsEqual(State *other)
    1.27 -		{
    1.28 -			State_F1_HookAdded *other2 = dynamic_cast<State_F1_HookAdded*>(other);
    1.29 -			if (!other2)
    1.30 -				return false;
    1.31 -			return other2->m_Successfully == m_Successfully;
    1.32 -		}
    1.33 -	};
    1.34 -
    1.35 -	struct State_F1_HookRemoved : State
    1.36 -	{
    1.37 -	};
    1.38 -
    1.39 -	struct State_F1_CallClassGenerated : State
    1.40 -	{
    1.41 -	};
    1.42 -
    1.43 -	struct State_F1_CallClassReleased : State
    1.44 -	{
    1.45 -	};
    1.46 -
    1.47 -	struct State_F299_Called : State
    1.48 -	{
    1.49 -		std::string param;
    1.50 -		State_F299_Called(const char *p) : param(p)
    1.51 -		{
    1.52 -		}
    1.53 -		bool IsEqual(State *other)
    1.54 -		{
    1.55 -			State_F299_Called *other2 = dynamic_cast<State_F299_Called*>(other);
    1.56 -			if (!other2)
    1.57 -				return false;
    1.58 -			return other2->param == param;
    1.59 -		}
    1.60 -	};
    1.61 -
    1.62 -	struct State_F299_PreHandlerCalled : State_F299_Called
    1.63 -	{
    1.64 -		State_F299_PreHandlerCalled(const char *p) : State_F299_Called(p)
    1.65 -		{
    1.66 -		}
    1.67 -	};
    1.68 -
    1.69 -	struct State_F299_PostHandlerCalled : State_F299_Called
    1.70 -	{
    1.71 -		State_F299_PostHandlerCalled(const char *p) : State_F299_Called(p)
    1.72 -		{
    1.73 -		}
    1.74 -	};
    1.75 -
    1.76 -	struct State_F299Ret : State
    1.77 -	{
    1.78 -		bool m_Ret;
    1.79 -		State_F299Ret(bool ret) : m_Ret(ret)
    1.80 -		{
    1.81 -		}
    1.82 -
    1.83 -		bool IsEqual(State *other)
    1.84 -		{
    1.85 -			State_F299Ret *other2 = dynamic_cast<State_F299Ret*>(other);
    1.86 -			if (!other2)
    1.87 -				return false;
    1.88 -			return other2->m_Ret == m_Ret;
    1.89 -		}
    1.90 -	};
    1.91 +	MAKE_STATE(State_F1_Called);
    1.92 +	MAKE_STATE(State_F1_PreHandler_Called);
    1.93 +	MAKE_STATE(State_F1_PostHandler_Called);
    1.94 +	MAKE_STATE_1(State_F1_HookAdded, bool);
    1.95 +	MAKE_STATE(State_F1_HookRemoved);
    1.96 +	MAKE_STATE(State_F1_CallClassGenerated);
    1.97 +	MAKE_STATE(State_F1_CallClassReleased);
    1.98 +	MAKE_STATE_1(State_F299_Called, std::string);
    1.99 +	MAKE_STATE_1(State_F299_PreHandlerCalled, std::string);
   1.100 +	MAKE_STATE_1(State_F299_PostHandlerCalled, std::string);
   1.101 +	MAKE_STATE_1(State_F299Ret, bool);
   1.102  
   1.103  	class Test
   1.104  	{