# HG changeset patch # User Edgar Simo # Date 1249498616 0 # Node ID f47658c8f87aae854092a706a599283859a4bc9b # Parent 4a58821c9c986af393699d713aec54f0dc176a2d Better error handling. diff -r 4a58821c9c98 -r f47658c8f87a test/automated/SDL_at.c --- a/test/automated/SDL_at.c Wed Aug 05 18:45:55 2009 +0000 +++ b/test/automated/SDL_at.c Wed Aug 05 18:56:56 2009 +0000 @@ -31,6 +31,14 @@ static int at_quiet = 0; /**< Quietness. */ +/* + * Prototypes. + */ +static void SDL_ATcleanup (void); +static void SDL_ATendWith( int success ); +static void SDL_ATassertFailed( const char *msg ); + + /** * @brief Cleans up the automated testsuite state. */ @@ -193,16 +201,29 @@ /** + * @brief Display failed assert message. + */ +static void SDL_ATassertFailed( const char *msg ) +{ + /* Print. */ + SDL_ATprintErr( "Assert Failed!\n" ); + SDL_ATprintErr( " %s\n", msg ); + SDL_ATprintErr( " Test Case '%s'\n", at_test_msg ); + SDL_ATprintErr( " Test Suite '%s'\n", at_suite_msg ); + /* End. */ + SDL_ATendWith(0); +} + + +/** * @brief Testcase test. */ int SDL_ATassert( const char *msg, int condition ) { /* Condition failed. */ if (!condition) { - /* Print. */ - SDL_ATprintErr( "%s [%s] : %s\n", at_suite_msg, at_test_msg, msg ); - /* End. */ - SDL_ATendWith(0); + /* Failed message. */ + SDL_ATassertFailed(msg); } return !condition; } @@ -222,10 +243,8 @@ va_start( args, msg ); vsnprintf( buf, sizeof(buf), msg, args ); va_end( args ); - /* Print. */ - SDL_ATprintErr( "%s [%s] : %s\n", at_suite_msg, at_test_msg, buf ); - /* End. */ - SDL_ATendWith(0); + /* Failed message. */ + SDL_ATassertFailed( buf ); } return !condition; }