Test case fails if it doesn't contain any asserts.
authorMarkus Kauppila <markus.kauppila@gmail.com>
Sat, 04 Jun 2011 17:58:46 +0300
changeset 5679 10a5199c4169
parent 5678 50401a6c3c95
child 5680 e61bdd43a2c3
Test case fails if it doesn't contain any asserts.
test/test-automation/SDL_test.c
test/test-automation/runner.c
--- a/test/test-automation/SDL_test.c	Sat Jun 04 17:50:23 2011 +0300
+++ b/test/test-automation/SDL_test.c	Sat Jun 04 17:58:46 2011 +0300
@@ -47,7 +47,11 @@
 _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;
 }
 
@@ -61,7 +65,7 @@
       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 {
--- a/test/test-automation/runner.c	Sat Jun 04 17:50:23 2011 +0300
+++ b/test/test-automation/runner.c	Sat Jun 04 17:58:46 2011 +0300
@@ -52,7 +52,7 @@
 #if defined(linux) || defined( __linux)
 	char *libName = "tests/libtest.so";
 #else
-	char *libName = "tests/libtestrect.dylib";
+	char *libName = "tests/libtest.dylib";
 #endif
 	return libName;
 }
@@ -287,7 +287,11 @@
 
 			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);