Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Test case fails if it doesn't contain any asserts.
Browse files Browse the repository at this point in the history
  • Loading branch information
mkauppila committed Jun 4, 2011
1 parent 23d5100 commit cf279ce
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
8 changes: 6 additions & 2 deletions test/test-automation/SDL_test.c
Expand Up @@ -47,7 +47,11 @@ int
_TestCaseQuit()
{
//! \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;
}

Expand All @@ -61,7 +65,7 @@ AssertEquals(Uint32 expected, Uint32 actual, char* message, ...)
va_start( args, message );
SDL_vsnprintf( buf, sizeof(buf), message, 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;
_testAssertsFailed++;
} else {
Expand Down
8 changes: 6 additions & 2 deletions test/test-automation/runner.c
Expand Up @@ -52,7 +52,7 @@ ScanForTestSuites() {
#if defined(linux) || defined( __linux)
char *libName = "tests/libtest.so";
#else
char *libName = "tests/libtestrect.dylib";
char *libName = "tests/libtest.dylib";
#endif
return libName;
}
Expand Down Expand Up @@ -287,7 +287,11 @@ main(int argc, char *argv[])

if(retVal) {
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 {
passCount++;
printf("%s (in %s): ok\n", testname, testSuiteName);
Expand Down

0 comments on commit cf279ce

Please sign in to comment.