Commit 1819321f authored by Markus Kauppila's avatar Markus Kauppila

Test case fails if it doesn't contain any asserts.

parent 1b21c654
...@@ -47,7 +47,11 @@ int ...@@ -47,7 +47,11 @@ int
_TestCaseQuit() _TestCaseQuit()
{ {
//! \todo make the test fail, if it does not contain any asserts //! \todo make the test fail, if it does not contain any asserts
printf("Asserts: passed %d, failed %d\n", _testAssertsPassed, _testAssertsFailed);fflush(stdout); printf("Asserts: passed %d, failed %d\n", _testAssertsPassed, _testAssertsFailed);
if(_testAssertsFailed == 0 && _testAssertsPassed == 0) {
_testReturnValue = 2;
}
return _testReturnValue; return _testReturnValue;
} }
...@@ -61,7 +65,7 @@ AssertEquals(Uint32 expected, Uint32 actual, char* message, ...) ...@@ -61,7 +65,7 @@ AssertEquals(Uint32 expected, Uint32 actual, char* message, ...)
va_start( args, message ); va_start( args, message );
SDL_vsnprintf( buf, sizeof(buf), message, args ); SDL_vsnprintf( buf, sizeof(buf), message, args );
va_end( args ); va_end( args );
printf("Assert Equals failed: expected %d, got %d; %s\n", expected, actual, buf); fflush(stdout); printf("Assert Equals failed: expected %d, got %d; %s\n", expected, actual, buf);
_testReturnValue = 1; _testReturnValue = 1;
_testAssertsFailed++; _testAssertsFailed++;
} else { } else {
......
...@@ -52,7 +52,7 @@ ScanForTestSuites() { ...@@ -52,7 +52,7 @@ ScanForTestSuites() {
#if defined(linux) || defined( __linux) #if defined(linux) || defined( __linux)
char *libName = "tests/libtest.so"; char *libName = "tests/libtest.so";
#else #else
char *libName = "tests/libtestrect.dylib"; char *libName = "tests/libtest.dylib";
#endif #endif
return libName; return libName;
} }
...@@ -287,7 +287,11 @@ main(int argc, char *argv[]) ...@@ -287,7 +287,11 @@ main(int argc, char *argv[])
if(retVal) { if(retVal) {
failureCount++; failureCount++;
printf("%s (in %s): FAILED\n", testname, testSuiteName); if(retVal == 2) {
printf("%s (in %s): FAILED -> No asserts\n", testname, testSuiteName);
} else {
printf("%s (in %s): FAILED\n", testname, testSuiteName);
}
} else { } else {
passCount++; passCount++;
printf("%s (in %s): ok\n", testname, testSuiteName); printf("%s (in %s): ok\n", testname, testSuiteName);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment