From 1819321f75c86561f0da41c491a405bc7ce41ba4 Mon Sep 17 00:00:00 2001
From: Markus Kauppila <markus.kauppila@gmail.com>
Date: Sat, 4 Jun 2011 17:58:46 +0300
Subject: [PATCH] Test case fails if it doesn't contain any asserts.

---
 test/test-automation/SDL_test.c | 8 ++++++--
 test/test-automation/runner.c   | 8 ++++++--
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/test/test-automation/SDL_test.c b/test/test-automation/SDL_test.c
index 6a0ada89..b410da4f 100644
--- a/test/test-automation/SDL_test.c
+++ b/test/test-automation/SDL_test.c
@@ -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;
 }
 
@@ -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 {
diff --git a/test/test-automation/runner.c b/test/test-automation/runner.c
index 545f4609..8d8aa062 100644
--- a/test/test-automation/runner.c
+++ b/test/test-automation/runner.c
@@ -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;
 }
@@ -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);
-- 
2.18.1