test/testautomation_main.c
changeset 6869 baac6ec78a95
parent 6866 e74a4b282450
child 6872 2f4c95464651
     1.1 --- a/test/testautomation_main.c	Tue Feb 12 12:29:08 2013 -0800
     1.2 +++ b/test/testautomation_main.c	Tue Feb 12 14:53:47 2013 -0800
     1.3 @@ -18,11 +18,12 @@
     1.4   */
     1.5  static int main_testInitQuit (void *arg)
     1.6  {
     1.7 +    int enabled_subsystems;
     1.8      int initialized_subsystems = SDL_INIT_JOYSTICK | SDL_INIT_HAPTIC;
     1.9  
    1.10      SDLTest_AssertCheck( SDL_Init(initialized_subsystems) == 0, "SDL_Init multiple systems." );
    1.11  
    1.12 -    int enabled_subsystems = SDL_WasInit(initialized_subsystems);
    1.13 +    enabled_subsystems = SDL_WasInit(initialized_subsystems);
    1.14      SDLTest_AssertCheck( enabled_subsystems == initialized_subsystems, "SDL_WasInit(SDL_INIT_EVERYTHING) contains all systems (%i)", enabled_subsystems );
    1.15  
    1.16      SDL_Quit();
    1.17 @@ -45,12 +46,13 @@
    1.18      int subsystems[] = { SDL_INIT_JOYSTICK, SDL_INIT_HAPTIC, SDL_INIT_GAMECONTROLLER };
    1.19  
    1.20      for (i = 0; i < SDL_arraysize(subsystems); ++i) {
    1.21 +        int initialized_system;
    1.22          int subsystem = subsystems[i];
    1.23  
    1.24          SDLTest_AssertCheck( (SDL_WasInit(subsystem) & subsystem) == 0, "SDL_WasInit(%x) before init should be false", subsystem );
    1.25          SDLTest_AssertCheck( SDL_InitSubSystem(subsystem) == 0, "SDL_InitSubSystem(%x)", subsystem );
    1.26  
    1.27 -        int initialized_system = SDL_WasInit(subsystem);
    1.28 +        initialized_system = SDL_WasInit(subsystem);
    1.29          SDLTest_AssertCheck( (initialized_system & subsystem) != 0, "SDL_WasInit(%x) should be true (%x)", subsystem, initialized_system );
    1.30  
    1.31          SDL_QuitSubSystem(subsystem);
    1.32 @@ -64,12 +66,14 @@
    1.33  const int joy_and_controller = SDL_INIT_JOYSTICK | SDL_INIT_GAMECONTROLLER;
    1.34  static int main_testImpliedJoystickInit (void *arg)
    1.35  {
    1.36 +    int initialized_system;
    1.37 +
    1.38      // First initialize the controller
    1.39      SDLTest_AssertCheck( (SDL_WasInit(joy_and_controller) & joy_and_controller) == 0, "SDL_WasInit() before init should be false for joystick & controller" );
    1.40      SDLTest_AssertCheck( SDL_InitSubSystem(SDL_INIT_GAMECONTROLLER) == 0, "SDL_InitSubSystem(SDL_INIT_GAMECONTROLLER)" );
    1.41  
    1.42      // Then make sure this implicitly initialized the joystick subsystem
    1.43 -    int initialized_system = SDL_WasInit(joy_and_controller);
    1.44 +    initialized_system = SDL_WasInit(joy_and_controller);
    1.45      SDLTest_AssertCheck( (initialized_system & joy_and_controller) == joy_and_controller, "SDL_WasInit() should be true for joystick & controller (%x)", initialized_system );
    1.46  
    1.47      // Then quit the controller, and make sure that imlicity also quits the
    1.48 @@ -81,13 +85,15 @@
    1.49  
    1.50  static int main_testImpliedJoystickQuit (void *arg)
    1.51  {
    1.52 +    int initialized_system;
    1.53 +
    1.54      // First initialize the controller and the joystick (explicitly)
    1.55      SDLTest_AssertCheck( (SDL_WasInit(joy_and_controller) & joy_and_controller) == 0, "SDL_WasInit() before init should be false for joystick & controller" );
    1.56      SDLTest_AssertCheck( SDL_InitSubSystem(SDL_INIT_JOYSTICK) == 0, "SDL_InitSubSystem(SDL_INIT_JOYSTICK)" );
    1.57      SDLTest_AssertCheck( SDL_InitSubSystem(SDL_INIT_GAMECONTROLLER) == 0, "SDL_InitSubSystem(SDL_INIT_GAMECONTROLLER)" );
    1.58  
    1.59      // Then make sure they're both initialized properly
    1.60 -    int initialized_system = SDL_WasInit(joy_and_controller);
    1.61 +    initialized_system = SDL_WasInit(joy_and_controller);
    1.62      SDLTest_AssertCheck( (initialized_system & joy_and_controller) == joy_and_controller, "SDL_WasInit() should be true for joystick & controller (%x)", initialized_system );
    1.63  
    1.64      // Then quit the controller, and make sure that it does NOT quit the