Test case fails if it doesn't contain any asserts.
authorMarkus Kauppila
Sat, 04 Jun 2011 17:58:46 +0300
changeset 567910a5199c4169
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
     1.1 --- a/test/test-automation/SDL_test.c	Sat Jun 04 17:50:23 2011 +0300
     1.2 +++ b/test/test-automation/SDL_test.c	Sat Jun 04 17:58:46 2011 +0300
     1.3 @@ -47,7 +47,11 @@
     1.4  _TestCaseQuit()
     1.5  {
     1.6  	//! \todo make the test fail, if it does not contain any asserts
     1.7 -	printf("Asserts: passed %d, failed %d\n", _testAssertsPassed, _testAssertsFailed);fflush(stdout);
     1.8 +	printf("Asserts: passed %d, failed %d\n", _testAssertsPassed, _testAssertsFailed);
     1.9 +	if(_testAssertsFailed == 0 && _testAssertsPassed == 0) {
    1.10 +		_testReturnValue = 2;
    1.11 +	}
    1.12 +
    1.13  	return _testReturnValue;
    1.14  }
    1.15  
    1.16 @@ -61,7 +65,7 @@
    1.17        va_start( args, message );
    1.18        SDL_vsnprintf( buf, sizeof(buf), message, args );
    1.19        va_end( args );
    1.20 -      printf("Assert Equals failed: expected %d, got %d; %s\n", expected, actual, buf); fflush(stdout);
    1.21 +      printf("Assert Equals failed: expected %d, got %d; %s\n", expected, actual, buf);
    1.22        _testReturnValue = 1;
    1.23        _testAssertsFailed++;
    1.24     } else {
     2.1 --- a/test/test-automation/runner.c	Sat Jun 04 17:50:23 2011 +0300
     2.2 +++ b/test/test-automation/runner.c	Sat Jun 04 17:58:46 2011 +0300
     2.3 @@ -52,7 +52,7 @@
     2.4  #if defined(linux) || defined( __linux)
     2.5  	char *libName = "tests/libtest.so";
     2.6  #else
     2.7 -	char *libName = "tests/libtestrect.dylib";
     2.8 +	char *libName = "tests/libtest.dylib";
     2.9  #endif
    2.10  	return libName;
    2.11  }
    2.12 @@ -287,7 +287,11 @@
    2.13  
    2.14  			if(retVal) {
    2.15  				failureCount++;
    2.16 -				printf("%s (in %s): FAILED\n", testname, testSuiteName);
    2.17 +				if(retVal == 2) {
    2.18 +					printf("%s (in %s): FAILED -> No asserts\n", testname, testSuiteName);
    2.19 +				} else {
    2.20 +					printf("%s (in %s): FAILED\n", testname, testSuiteName);
    2.21 +				}
    2.22  			} else {
    2.23  				passCount++;
    2.24  				printf("%s (in %s): ok\n", testname, testSuiteName);