Update test harness to handle test return codes; fix comment format in harness; update Main test suite to handle globally disabled features
This commit is contained in:
parent
f86b25c56e
commit
2ff60371f5
3 changed files with 102 additions and 57 deletions
|
@ -11,13 +11,16 @@
|
|||
|
||||
|
||||
/*!
|
||||
* \brief Tests SDL_Init() and SDL_Quit()
|
||||
* \brief Tests SDL_Init() and SDL_Quit() of Joystick and Haptic subsystems
|
||||
* \sa
|
||||
* http://wiki.libsdl.org/moin.cgi/SDL_Init
|
||||
* http://wiki.libsdl.org/moin.cgi/SDL_Quit
|
||||
*/
|
||||
static int main_testInitQuit (void *arg)
|
||||
static int main_testInitQuitJoystickHaptic (void *arg)
|
||||
{
|
||||
#if defined SDL_JOYSTICK_DISABLED || defined SDL_HAPTIC_DISABLED
|
||||
return TEST_SKIPPED;
|
||||
#else
|
||||
int enabled_subsystems;
|
||||
int initialized_subsystems = SDL_INIT_JOYSTICK | SDL_INIT_HAPTIC;
|
||||
|
||||
|
@ -32,6 +35,7 @@ static int main_testInitQuit (void *arg)
|
|||
SDLTest_AssertCheck( enabled_subsystems == 0, "SDL_Quit should shut down everything (%i)", enabled_subsystems );
|
||||
|
||||
return TEST_COMPLETED;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -42,6 +46,9 @@ static int main_testInitQuit (void *arg)
|
|||
*/
|
||||
static int main_testInitQuitSubSystem (void *arg)
|
||||
{
|
||||
#if defined SDL_JOYSTICK_DISABLED || defined SDL_HAPTIC_DISABLED || defined SDL_GAMECONTROLLER_DISABLED
|
||||
return TEST_SKIPPED;
|
||||
#else
|
||||
int i;
|
||||
int subsystems[] = { SDL_INIT_JOYSTICK, SDL_INIT_HAPTIC, SDL_INIT_GAMECONTROLLER };
|
||||
|
||||
|
@ -61,11 +68,15 @@ static int main_testInitQuitSubSystem (void *arg)
|
|||
}
|
||||
|
||||
return TEST_COMPLETED;
|
||||
#endif
|
||||
}
|
||||
|
||||
const int joy_and_controller = SDL_INIT_JOYSTICK | SDL_INIT_GAMECONTROLLER;
|
||||
static int main_testImpliedJoystickInit (void *arg)
|
||||
{
|
||||
#if defined SDL_JOYSTICK_DISABLED || defined SDL_GAMECONTROLLER_DISABLED
|
||||
return TEST_SKIPPED;
|
||||
#else
|
||||
int initialized_system;
|
||||
|
||||
// First initialize the controller
|
||||
|
@ -82,11 +93,15 @@ static int main_testImpliedJoystickInit (void *arg)
|
|||
initialized_system = SDL_WasInit(joy_and_controller);
|
||||
SDLTest_AssertCheck( (initialized_system & joy_and_controller) == 0, "SDL_WasInit() should be false for joystick & controller (%x)", initialized_system );
|
||||
|
||||
return TEST_COMPLETED;
|
||||
return TEST_COMPLETED;
|
||||
#endif
|
||||
}
|
||||
|
||||
static int main_testImpliedJoystickQuit (void *arg)
|
||||
{
|
||||
#if defined SDL_JOYSTICK_DISABLED || defined SDL_GAMECONTROLLER_DISABLED
|
||||
return TEST_SKIPPED;
|
||||
#else
|
||||
int initialized_system;
|
||||
|
||||
// First initialize the controller and the joystick (explicitly)
|
||||
|
@ -106,11 +121,12 @@ static int main_testImpliedJoystickQuit (void *arg)
|
|||
|
||||
SDL_QuitSubSystem(SDL_INIT_JOYSTICK);
|
||||
|
||||
return TEST_COMPLETED;
|
||||
return TEST_COMPLETED;
|
||||
#endif
|
||||
}
|
||||
|
||||
static const SDLTest_TestCaseReference mainTest1 =
|
||||
{ (SDLTest_TestCaseFp)main_testInitQuit, "main_testInitQuit", "Tests SDL_Init/Quit", TEST_ENABLED};
|
||||
{ (SDLTest_TestCaseFp)main_testInitQuitJoystickHaptic, "main_testInitQuitJoystickHaptic", "Tests SDL_Init/Quit of Joystick and Haptic subsystem", TEST_ENABLED};
|
||||
|
||||
static const SDLTest_TestCaseReference mainTest2 =
|
||||
{ (SDLTest_TestCaseFp)main_testInitQuitSubSystem, "main_testInitQuitSubSystem", "Tests SDL_InitSubSystem/QuitSubSystem", TEST_ENABLED};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue