test/automated/testsdl.c
branchgsoc2009_unit_tests
changeset 3753 5b48a529fd8a
parent 3750 cb75359d29bb
child 3756 427f059bc814
     1.1 --- a/test/automated/testsdl.c	Wed Aug 05 18:56:56 2009 +0000
     1.2 +++ b/test/automated/testsdl.c	Thu Aug 06 08:39:42 2009 +0000
     1.3 @@ -7,6 +7,7 @@
     1.4   */
     1.5  
     1.6  
     1.7 +#include "SDL.h"
     1.8  #include "SDL_at.h"
     1.9  
    1.10  #include "platform/platform.h"
    1.11 @@ -128,22 +129,50 @@
    1.12   */
    1.13  int main( int argc, char *argv[] )
    1.14  {
    1.15 +   int failed;
    1.16 +   int rev;
    1.17 +   SDL_version ver;
    1.18 +
    1.19 +   /* Get options. */
    1.20     parse_options( argc, argv );
    1.21  
    1.22 +   /* Defaults. */
    1.23 +   failed = 0;
    1.24 +
    1.25 +   /* Print some text if verbose. */
    1.26 +   SDL_GetVersion( &ver );
    1.27 +   rev = SDL_GetRevision();
    1.28 +   SDL_ATprintVerbose( 1, "Running tests with SDL %d.%d.%d revision %d\n",
    1.29 +         ver.major, ver.minor, ver.patch, rev );
    1.30 +
    1.31     /* Automatic tests. */
    1.32     if (run_platform)
    1.33 -      test_platform();
    1.34 +      failed += test_platform();
    1.35     if (run_rwops)
    1.36 -      test_rwops();
    1.37 +      failed += test_rwops();
    1.38     if (run_surface)
    1.39 -      test_surface();
    1.40 +      failed += test_surface();
    1.41     if (run_render)
    1.42 -      test_render();
    1.43 +      failed += test_render();
    1.44  
    1.45     /* Manual tests. */
    1.46     if (run_manual) {
    1.47     }
    1.48  
    1.49 -   return 0;
    1.50 +   /* Display more information if failed. */
    1.51 +   if (failed > 0) {
    1.52 +      SDL_ATprintErr( "Tests run with SDL %d.%d.%d revision %d\n",
    1.53 +            ver.major, ver.minor, ver.patch, rev );
    1.54 +      SDL_ATprintErr( "System is running %s and is %s endian\n",
    1.55 +            platform_getPlatform(),
    1.56 +#ifdef SDL_LIL_ENDIAN
    1.57 +            "little"
    1.58 +#else
    1.59 +            "big"
    1.60 +#endif
    1.61 +            );
    1.62 +   }
    1.63 +
    1.64 +   return failed;
    1.65  }
    1.66