comparison 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
comparison
equal deleted inserted replaced
3662:6a0b3048f271 3663:bc50cd16bb07
2 #include <stdio.h> 2 #include <stdio.h>
3 3
4 #include "SDL.h" 4 #include "SDL.h"
5 #include "SDL_endian.h" 5 #include "SDL_endian.h"
6 #include "SDL_cpuinfo.h" 6 #include "SDL_cpuinfo.h"
7 #include "SDL_assert.h"
7 8
8 /* 9 /*
9 * Watcom C flags these as Warning 201: "Unreachable code" if you just 10 * Watcom C flags these as Warning 201: "Unreachable code" if you just
10 * compare them directly, so we push it through a function to keep the 11 * compare them directly, so we push it through a function to keep the
11 * compiler quiet. --ryan. 12 * compiler quiet. --ryan.
147 } 148 }
148 return (0); 149 return (0);
149 } 150 }
150 151
151 int 152 int
153 TestAssertions(SDL_bool verbose)
154 {
155 SDL_assert(1);
156 SDL_assert_release(1);
157 SDL_assert_paranoid(1);
158 SDL_assert(0 || 1);
159 SDL_assert_release(0 || 1);
160 SDL_assert_paranoid(0 || 1);
161
162 #if 0 /* enable this to test assertion failures. */
163 SDL_assert_release(1 == 2);
164 SDL_assert_release(5 < 4);
165 SDL_assert_release(0 && "This is a test");
166 #endif
167 SDL_assert_release(0 && "This is a test");
168
169 return (0);
170 }
171
172 int
152 main(int argc, char *argv[]) 173 main(int argc, char *argv[])
153 { 174 {
154 SDL_bool verbose = SDL_TRUE; 175 SDL_bool verbose = SDL_TRUE;
155 int status = 0; 176 int status = 0;
156 177
162 } 183 }
163 184
164 status += TestTypes(verbose); 185 status += TestTypes(verbose);
165 status += TestEndian(verbose); 186 status += TestEndian(verbose);
166 status += TestCPUInfo(verbose); 187 status += TestCPUInfo(verbose);
188 status += TestAssertions(verbose);
189
167 return status; 190 return status;
168 } 191 }