test/test-automation/SDL_test.c
changeset 5680 e61bdd43a2c3
parent 5679 10a5199c4169
child 5681 7abfcc71aa7d
equal deleted inserted replaced
5679:10a5199c4169 5680:e61bdd43a2c3
    46 int
    46 int
    47 _TestCaseQuit()
    47 _TestCaseQuit()
    48 {
    48 {
    49 	//! \todo make the test fail, if it does not contain any asserts
    49 	//! \todo make the test fail, if it does not contain any asserts
    50 	printf("Asserts: passed %d, failed %d\n", _testAssertsPassed, _testAssertsFailed);
    50 	printf("Asserts: passed %d, failed %d\n", _testAssertsPassed, _testAssertsFailed);
       
    51 
    51 	if(_testAssertsFailed == 0 && _testAssertsPassed == 0) {
    52 	if(_testAssertsFailed == 0 && _testAssertsPassed == 0) {
    52 		_testReturnValue = 2;
    53 		_testReturnValue = 2;
    53 	}
    54 	}
    54 
    55 
    55 	return _testReturnValue;
    56 	return _testReturnValue;
    56 }
    57 }
    57 
    58 
       
    59 
       
    60 /*!
       
    61  *  Assert function. Tests if the expected value equals the actual value, then
       
    62  *  the test assert succeeds, otherwise it fails and warns about it.
       
    63  *
       
    64  * \param expected Value user expects to have
       
    65  * \param actual The actual value of tested variable
       
    66  * \param message Message that will be printed if assert fails
       
    67  */
    58 void
    68 void
    59 AssertEquals(Uint32 expected, Uint32 actual, char* message, ...)
    69 AssertEquals(Uint32 expected, Uint32 actual, char* message, ...)
    60 {
    70 {
    61    va_list args;
    71    va_list args;
    62    char buf[256];
    72    char buf[256];
    71    } else {
    81    } else {
    72       _testAssertsPassed++;
    82       _testAssertsPassed++;
    73    }
    83    }
    74 }
    84 }
    75 
    85 
       
    86 /*!
       
    87  *  Assert function. Tests if the given condition is true. True in
       
    88  *  this case means non-zero value. If the condition is true, the
       
    89  *  assert passes, otherwise it fails.
       
    90  *
       
    91  * \param condition Condition which will be evaluated
       
    92  * \param message Message that will be printed if assert fails
       
    93  */
    76 void
    94 void
    77 AssertTrue(int condition, char *message, ...)
    95 AssertTrue(int condition, char *message, ...)
    78 {
    96 {
    79    va_list args;
    97    va_list args;
    80    char buf[256];
    98    char buf[256];