comparison test/automated/testsdl.c @ 3753:5b48a529fd8a gsoc2009_unit_tests

More debugging information when test fails.
author Edgar Simo <bobbens@gmail.com>
date Thu, 06 Aug 2009 08:39:42 +0000
parents cb75359d29bb
children 427f059bc814
comparison
equal deleted inserted replaced
3752:f47658c8f87a 3753:5b48a529fd8a
5 * 5 *
6 * Released under Public Domain. 6 * Released under Public Domain.
7 */ 7 */
8 8
9 9
10 #include "SDL.h"
10 #include "SDL_at.h" 11 #include "SDL_at.h"
11 12
12 #include "platform/platform.h" 13 #include "platform/platform.h"
13 #include "rwops/rwops.h" 14 #include "rwops/rwops.h"
14 #include "surface/surface.h" 15 #include "surface/surface.h"
126 /** 127 /**
127 * @brief Main entry point. 128 * @brief Main entry point.
128 */ 129 */
129 int main( int argc, char *argv[] ) 130 int main( int argc, char *argv[] )
130 { 131 {
132 int failed;
133 int rev;
134 SDL_version ver;
135
136 /* Get options. */
131 parse_options( argc, argv ); 137 parse_options( argc, argv );
138
139 /* Defaults. */
140 failed = 0;
141
142 /* Print some text if verbose. */
143 SDL_GetVersion( &ver );
144 rev = SDL_GetRevision();
145 SDL_ATprintVerbose( 1, "Running tests with SDL %d.%d.%d revision %d\n",
146 ver.major, ver.minor, ver.patch, rev );
132 147
133 /* Automatic tests. */ 148 /* Automatic tests. */
134 if (run_platform) 149 if (run_platform)
135 test_platform(); 150 failed += test_platform();
136 if (run_rwops) 151 if (run_rwops)
137 test_rwops(); 152 failed += test_rwops();
138 if (run_surface) 153 if (run_surface)
139 test_surface(); 154 failed += test_surface();
140 if (run_render) 155 if (run_render)
141 test_render(); 156 failed += test_render();
142 157
143 /* Manual tests. */ 158 /* Manual tests. */
144 if (run_manual) { 159 if (run_manual) {
145 } 160 }
146 161
147 return 0; 162 /* Display more information if failed. */
163 if (failed > 0) {
164 SDL_ATprintErr( "Tests run with SDL %d.%d.%d revision %d\n",
165 ver.major, ver.minor, ver.patch, rev );
166 SDL_ATprintErr( "System is running %s and is %s endian\n",
167 platform_getPlatform(),
168 #ifdef SDL_LIL_ENDIAN
169 "little"
170 #else
171 "big"
172 #endif
173 );
174 }
175
176 return failed;
148 } 177 }
149 178