Mercurial > sdl-ios-xcode
comparison test/automated/SDL_at.c @ 3725:6eca2af6a86b gsoc2009_unit_tests
Added SDL_ATvassert for printf style printing.
Check to see if testcase is closed before finishing testsuite.
author | Edgar Simo <bobbens@gmail.com> |
---|---|
date | Sat, 11 Jul 2009 18:54:03 +0000 |
parents | d8772964e402 |
children | 51900b161948 |
comparison
equal
deleted
inserted
replaced
3724:48e2b67bb2de | 3725:6eca2af6a86b |
---|---|
62 | 62 |
63 /* Make sure initialized. */ | 63 /* Make sure initialized. */ |
64 if (at_suite_msg == NULL) { | 64 if (at_suite_msg == NULL) { |
65 SDL_ATprint("Ended testcase without initializing.\n"); | 65 SDL_ATprint("Ended testcase without initializing.\n"); |
66 return 1; | 66 return 1; |
67 } | |
68 | |
69 /* Finished without closing testcase. */ | |
70 if (at_test_msg) { | |
71 SDL_ATprint( "AT suite '%s' finished without closing testcase '%s'\n", | |
72 ac_suite_msg, ac_test_msg ); | |
67 } | 73 } |
68 | 74 |
69 /* Display message if verbose on failed. */ | 75 /* Display message if verbose on failed. */ |
70 failed = at_failure; | 76 failed = at_failure; |
71 if (verbose) { | 77 if (verbose) { |
132 */ | 138 */ |
133 int SDL_ATassert( const char *msg, int condition ) | 139 int SDL_ATassert( const char *msg, int condition ) |
134 { | 140 { |
135 /* Condition failed. */ | 141 /* Condition failed. */ |
136 if (!condition) { | 142 if (!condition) { |
143 /* Print. */ | |
137 SDL_ATprint( "%s [%s] : %s\n", at_suite_msg, at_test_msg, msg ); | 144 SDL_ATprint( "%s [%s] : %s\n", at_suite_msg, at_test_msg, msg ); |
145 /* End. */ | |
146 SDL_ATendWith(0); | |
147 } | |
148 return !condition; | |
149 } | |
150 | |
151 | |
152 /** | |
153 * @brief Testcase test. | |
154 */ | |
155 int SDL_ATvassert( int condition, const char *msg, ... ) | |
156 { | |
157 va_list args; | |
158 char buf[256]; | |
159 | |
160 /* Condition failed. */ | |
161 if (!condition) { | |
162 /* Get message. */ | |
163 va_start( args, msg ); | |
164 vsnprintf( buf, sizeof(buf), msg, args ); | |
165 va_end( args ); | |
166 /* Print. */ | |
167 SDL_ATprint( "%s [%s] : %s\n", at_suite_msg, at_test_msg, buf ); | |
168 /* End. */ | |
138 SDL_ATendWith(0); | 169 SDL_ATendWith(0); |
139 } | 170 } |
140 return !condition; | 171 return !condition; |
141 } | 172 } |
142 | 173 |