src/test/SDL_test_harness.c
changeset 6760 04dcce3081e6
parent 6757 9935f71c8c81
child 6763 9cbd31a3450b
     1.1 --- a/src/test/SDL_test_harness.c	Sun Dec 16 14:46:16 2012 -0500
     1.2 +++ b/src/test/SDL_test_harness.c	Sun Dec 16 21:59:29 2012 -0800
     1.3 @@ -342,6 +342,7 @@
     1.4  	float runEndSeconds;
     1.5  	float suiteEndSeconds;
     1.6  	float testEndSeconds;
     1.7 +	float runtime;
     1.8  	int testResult = 0;
     1.9  	int runResult = 0;
    1.10  	Uint32 totalTestFailedCount = 0;
    1.11 @@ -450,14 +451,16 @@
    1.12  
    1.13  			// Take time - test end
    1.14  			testEndSeconds = GetClock();
    1.15 +			runtime = testEndSeconds - testStartSeconds;
    1.16 +			if (runtime < 0.0f) runtime = 0.0f;
    1.17  
    1.18  			if (testIterations > 1) {
    1.19          			// Log test runtime
    1.20 -	        		SDLTest_Log("Runtime of %i iterations: %.1f sec", testIterations, testEndSeconds - testStartSeconds);
    1.21 -	        		SDLTest_Log("Test runtime: %.5f sec", (testEndSeconds - testStartSeconds) / (float)testIterations);
    1.22 +	        		SDLTest_Log("Runtime of %i iterations: %.1f sec", testIterations, runtime);
    1.23 +	        		SDLTest_Log("Test runtime: %.5f sec", runtime / (float)testIterations);
    1.24                          } else {
    1.25          			// Log test runtime
    1.26 -	        		SDLTest_Log("Test runtime: %.1f sec", testEndSeconds - testStartSeconds);
    1.27 +	        		SDLTest_Log("Test runtime: %.1f sec", runtime);
    1.28                          }
    1.29  
    1.30  			// Log final test result
    1.31 @@ -476,9 +479,11 @@
    1.32  
    1.33  		// Take time - suite end
    1.34  		suiteEndSeconds = GetClock();
    1.35 +		runtime = suiteEndSeconds - suiteStartSeconds;
    1.36 +		if (runtime < 0.0f) runtime = 0.0f;
    1.37  
    1.38  		// Log suite runtime
    1.39 -		SDLTest_Log("Suite runtime: %.1f sec", suiteEndSeconds - suiteStartSeconds);
    1.40 +		SDLTest_Log("Suite runtime: %.1f sec", runtime);
    1.41  
    1.42  		// Log summary and final Suite result
    1.43  		countSum = testPassedCount + testFailedCount + testSkippedCount;
    1.44 @@ -496,9 +501,11 @@
    1.45  
    1.46  	// Take time - run end
    1.47  	runEndSeconds = GetClock();
    1.48 +	runtime = runEndSeconds - runStartSeconds;
    1.49 +	if (runtime < 0.0f) runtime = 0.0f;
    1.50  
    1.51  	// Log total runtime
    1.52 -	SDLTest_Log("Total runtime: %.1f sec", runEndSeconds - runStartSeconds);
    1.53 +	SDLTest_Log("Total runtime: %.1f sec", runtime);
    1.54  
    1.55  	// Log summary and final run result
    1.56  	countSum = totalTestPassedCount + totalTestFailedCount + totalTestSkippedCount;