Moved the assertion tests to testplatform
authorSam Lantinga <slouken@libsdl.org>
Wed, 13 Jan 2010 09:48:42 +0000
changeset 3663bc50cd16bb07
parent 3662 6a0b3048f271
child 3664 8bdc37b1a52a
Moved the assertion tests to testplatform
src/SDL.c
test/testplatform.c
     1.1 --- a/src/SDL.c	Wed Jan 13 09:44:17 2010 +0000
     1.2 +++ b/src/SDL.c	Wed Jan 13 09:48:42 2010 +0000
     1.3 @@ -181,20 +181,6 @@
     1.4          SDL_InstallParachute();
     1.5      }
     1.6  
     1.7 -    /* brief sanity checks for the sanity checks.  :)  */
     1.8 -    SDL_assert(1);
     1.9 -    SDL_assert_release(1);
    1.10 -    SDL_assert_paranoid(1);
    1.11 -    SDL_assert(0 || 1);
    1.12 -    SDL_assert_release(0 || 1);
    1.13 -    SDL_assert_paranoid(0 || 1);
    1.14 -
    1.15 -#if 0   /* enable this to test assertion failures. */
    1.16 -    SDL_assert_release(1 == 2);
    1.17 -    SDL_assert_release(5 < 4);
    1.18 -    SDL_assert_release(0 && "This is a test");
    1.19 -#endif
    1.20 -
    1.21      return (0);
    1.22  }
    1.23  
     2.1 --- a/test/testplatform.c	Wed Jan 13 09:44:17 2010 +0000
     2.2 +++ b/test/testplatform.c	Wed Jan 13 09:48:42 2010 +0000
     2.3 @@ -4,6 +4,7 @@
     2.4  #include "SDL.h"
     2.5  #include "SDL_endian.h"
     2.6  #include "SDL_cpuinfo.h"
     2.7 +#include "SDL_assert.h"
     2.8  
     2.9  /*
    2.10   * Watcom C flags these as Warning 201: "Unreachable code" if you just
    2.11 @@ -149,6 +150,26 @@
    2.12  }
    2.13  
    2.14  int
    2.15 +TestAssertions(SDL_bool verbose)
    2.16 +{
    2.17 +    SDL_assert(1);
    2.18 +    SDL_assert_release(1);
    2.19 +    SDL_assert_paranoid(1);
    2.20 +    SDL_assert(0 || 1);
    2.21 +    SDL_assert_release(0 || 1);
    2.22 +    SDL_assert_paranoid(0 || 1);
    2.23 +
    2.24 +#if 0   /* enable this to test assertion failures. */
    2.25 +    SDL_assert_release(1 == 2);
    2.26 +    SDL_assert_release(5 < 4);
    2.27 +    SDL_assert_release(0 && "This is a test");
    2.28 +#endif
    2.29 +    SDL_assert_release(0 && "This is a test");
    2.30 +
    2.31 +    return (0);
    2.32 +}
    2.33 +
    2.34 +int
    2.35  main(int argc, char *argv[])
    2.36  {
    2.37      SDL_bool verbose = SDL_TRUE;
    2.38 @@ -164,5 +185,7 @@
    2.39      status += TestTypes(verbose);
    2.40      status += TestEndian(verbose);
    2.41      status += TestCPUInfo(verbose);
    2.42 +    status += TestAssertions(verbose);
    2.43 +
    2.44      return status;
    2.45  }