src/test/SDL_test_assert.c
changeset 6772 5229a117ef97
parent 6762 c680e085a5f2
child 6885 700f1b25f77f
     1.1 --- a/src/test/SDL_test_assert.c	Sat Dec 22 20:43:51 2012 -0800
     1.2 +++ b/src/test/SDL_test_assert.c	Mon Dec 24 14:43:57 2012 -0800
     1.3 @@ -44,7 +44,7 @@
     1.4  /*
     1.5   *  Assert that logs and break execution flow on failures (i.e. for harness errors).
     1.6   */
     1.7 -void SDLTest_Assert(int assertCondition, char *assertDescription, ...)
     1.8 +void SDLTest_Assert(int assertCondition, const char *assertDescription, ...)
     1.9  {
    1.10          va_list list;
    1.11  	char logMessage[SDLTEST_MAX_LOGMESSAGE_LENGTH];
    1.12 @@ -62,11 +62,10 @@
    1.13  /*
    1.14   * Assert that logs but does not break execution flow on failures (i.e. for test cases).
    1.15   */
    1.16 -int SDLTest_AssertCheck(int assertCondition, char *assertDescription, ...)
    1.17 +int SDLTest_AssertCheck(int assertCondition, const char *assertDescription, ...)
    1.18  {
    1.19      va_list list;
    1.20  	char logMessage[SDLTEST_MAX_LOGMESSAGE_LENGTH];
    1.21 -	char *logFormat = (char *)SDLTest_AssertCheckFormat;
    1.22                  
    1.23  	// Print assert description into a buffer
    1.24  	SDL_memset(logMessage, 0, SDLTEST_MAX_LOGMESSAGE_LENGTH);
    1.25 @@ -78,12 +77,12 @@
    1.26  	if (assertCondition == ASSERT_FAIL)
    1.27  	{
    1.28  		SDLTest_AssertsFailed++;
    1.29 -		SDLTest_LogError(logFormat, logMessage, "Failed");
    1.30 +		SDLTest_LogError(SDLTest_AssertCheckFormat, logMessage, "Failed");
    1.31  	} 
    1.32  	else 
    1.33  	{
    1.34  		SDLTest_AssertsPassed++;
    1.35 -		SDLTest_Log(logFormat, logMessage, "Passed");
    1.36 +		SDLTest_Log(SDLTest_AssertCheckFormat, logMessage, "Passed");
    1.37  	}
    1.38  
    1.39  	return assertCondition;
    1.40 @@ -92,11 +91,10 @@
    1.41  /*
    1.42   * Explicitly passing Assert that logs (i.e. for test cases).
    1.43   */
    1.44 -void SDLTest_AssertPass(char *assertDescription, ...)
    1.45 +void SDLTest_AssertPass(const char *assertDescription, ...)
    1.46  {
    1.47      va_list list;
    1.48  	char logMessage[SDLTEST_MAX_LOGMESSAGE_LENGTH];
    1.49 -	char *logFormat = (char *)SDLTest_AssertCheckFormat;
    1.50                  
    1.51  	// Print assert description into a buffer
    1.52  	SDL_memset(logMessage, 0, SDLTEST_MAX_LOGMESSAGE_LENGTH);
    1.53 @@ -104,9 +102,9 @@
    1.54  	SDL_vsnprintf(logMessage, SDLTEST_MAX_LOGMESSAGE_LENGTH - 1, assertDescription, list);
    1.55  	va_end(list);
    1.56                              
    1.57 -    // Log pass message                            
    1.58 +        // Log pass message                            
    1.59  	SDLTest_AssertsPassed++;
    1.60 -	SDLTest_Log(logFormat, logMessage, "Pass");
    1.61 +	SDLTest_Log(SDLTest_AssertCheckFormat, logMessage, "Pass");
    1.62  }
    1.63  
    1.64  /*
    1.65 @@ -124,15 +122,14 @@
    1.66   */
    1.67  void SDLTest_LogAssertSummary()
    1.68  {
    1.69 -	char *logFormat = (char *)SDLTest_AssertSummaryFormat;
    1.70  	Uint32 totalAsserts = SDLTest_AssertsPassed + SDLTest_AssertsFailed;
    1.71  	if (SDLTest_AssertsFailed == 0)
    1.72  	{
    1.73 -		SDLTest_Log(logFormat, totalAsserts, SDLTest_AssertsPassed, SDLTest_AssertsFailed);
    1.74 +		SDLTest_Log(SDLTest_AssertSummaryFormat, totalAsserts, SDLTest_AssertsPassed, SDLTest_AssertsFailed);
    1.75  	} 
    1.76  	else 
    1.77  	{
    1.78 -		SDLTest_LogError(logFormat, totalAsserts, SDLTest_AssertsPassed, SDLTest_AssertsFailed);
    1.79 +		SDLTest_LogError(SDLTest_AssertSummaryFormat, totalAsserts, SDLTest_AssertsPassed, SDLTest_AssertsFailed);
    1.80  	}
    1.81  }
    1.82