changeset 3663:bc50cd16bb07

Moved the assertion tests to testplatform
author Sam Lantinga <slouken@libsdl.org>
date Wed, 13 Jan 2010 09:48:42 +0000
parents 6a0b3048f271
children 8bdc37b1a52a
files src/SDL.c test/testplatform.c
diffstat 2 files changed, 23 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/src/SDL.c	Wed Jan 13 09:44:17 2010 +0000
+++ b/src/SDL.c	Wed Jan 13 09:48:42 2010 +0000
@@ -181,20 +181,6 @@
         SDL_InstallParachute();
     }
 
-    /* brief sanity checks for the sanity checks.  :)  */
-    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
-
     return (0);
 }
 
--- 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;
 }