test/testplatform.c
changeset 3663 bc50cd16bb07
parent 3579 3427271a2d75
child 3684 cc564f08884f
     1.1 --- a/test/testplatform.c	Wed Jan 13 09:44:17 2010 +0000
     1.2 +++ b/test/testplatform.c	Wed Jan 13 09:48:42 2010 +0000
     1.3 @@ -4,6 +4,7 @@
     1.4  #include "SDL.h"
     1.5  #include "SDL_endian.h"
     1.6  #include "SDL_cpuinfo.h"
     1.7 +#include "SDL_assert.h"
     1.8  
     1.9  /*
    1.10   * Watcom C flags these as Warning 201: "Unreachable code" if you just
    1.11 @@ -149,6 +150,26 @@
    1.12  }
    1.13  
    1.14  int
    1.15 +TestAssertions(SDL_bool verbose)
    1.16 +{
    1.17 +    SDL_assert(1);
    1.18 +    SDL_assert_release(1);
    1.19 +    SDL_assert_paranoid(1);
    1.20 +    SDL_assert(0 || 1);
    1.21 +    SDL_assert_release(0 || 1);
    1.22 +    SDL_assert_paranoid(0 || 1);
    1.23 +
    1.24 +#if 0   /* enable this to test assertion failures. */
    1.25 +    SDL_assert_release(1 == 2);
    1.26 +    SDL_assert_release(5 < 4);
    1.27 +    SDL_assert_release(0 && "This is a test");
    1.28 +#endif
    1.29 +    SDL_assert_release(0 && "This is a test");
    1.30 +
    1.31 +    return (0);
    1.32 +}
    1.33 +
    1.34 +int
    1.35  main(int argc, char *argv[])
    1.36  {
    1.37      SDL_bool verbose = SDL_TRUE;
    1.38 @@ -164,5 +185,7 @@
    1.39      status += TestTypes(verbose);
    1.40      status += TestEndian(verbose);
    1.41      status += TestCPUInfo(verbose);
    1.42 +    status += TestAssertions(verbose);
    1.43 +
    1.44      return status;
    1.45  }