diff test/testplatform.c @ 3663:bc50cd16bb07

Moved the assertion tests to testplatform
author Sam Lantinga <slouken@libsdl.org>
date Wed, 13 Jan 2010 09:48:42 +0000
parents 3427271a2d75
children cc564f08884f
line wrap: on
line diff
--- a/test/testplatform.c	Wed Jan 13 09:44:17 2010 +0000
+++ b/test/testplatform.c	Wed Jan 13 09:48:42 2010 +0000
@@ -4,6 +4,7 @@
 #include "SDL.h"
 #include "SDL_endian.h"
 #include "SDL_cpuinfo.h"
+#include "SDL_assert.h"
 
 /*
  * Watcom C flags these as Warning 201: "Unreachable code" if you just
@@ -149,6 +150,26 @@
 }
 
 int
+TestAssertions(SDL_bool verbose)
+{
+    SDL_assert(1);
+    SDL_assert_release(1);
+    SDL_assert_paranoid(1);
+    SDL_assert(0 || 1);
+    SDL_assert_release(0 || 1);
+    SDL_assert_paranoid(0 || 1);
+
+#if 0   /* enable this to test assertion failures. */
+    SDL_assert_release(1 == 2);
+    SDL_assert_release(5 < 4);
+    SDL_assert_release(0 && "This is a test");
+#endif
+    SDL_assert_release(0 && "This is a test");
+
+    return (0);
+}
+
+int
 main(int argc, char *argv[])
 {
     SDL_bool verbose = SDL_TRUE;
@@ -164,5 +185,7 @@
     status += TestTypes(verbose);
     status += TestEndian(verbose);
     status += TestCPUInfo(verbose);
+    status += TestAssertions(verbose);
+
     return status;
 }