| 
									
										
										
										
											2009-08-22 06:23:24 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | #include "TestResult.h"
 | 
					
						
							|  |  |  | #include "Failure.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include <stdio.h>
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | TestResult::TestResult () | 
					
						
							|  |  |  | 	: failureCount (0) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void TestResult::testsStarted ()  | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void TestResult::addFailure (const Failure& failure)  | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	fprintf (stdout, "%s%s%s%s%ld%s%s\n", | 
					
						
							|  |  |  | 		"Failure: \"", | 
					
						
							|  |  |  | 		failure.message.asCharString (), | 
					
						
							|  |  |  | 		"\" " , | 
					
						
							|  |  |  | 		"line ", | 
					
						
							|  |  |  | 		failure.lineNumber, | 
					
						
							|  |  |  | 		" in ", | 
					
						
							|  |  |  | 		failure.fileName.asCharString ()); | 
					
						
							|  |  |  | 		 | 
					
						
							|  |  |  | 	failureCount++; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void TestResult::testsEnded ()  | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	if (failureCount > 0) | 
					
						
							| 
									
										
										
										
											2010-01-07 02:59:14 +08:00
										 |  |  | 		fprintf (stdout, "There were %d failures\n", failureCount); | 
					
						
							| 
									
										
										
										
											2009-08-22 06:23:24 +08:00
										 |  |  | 	else | 
					
						
							|  |  |  | 		fprintf (stdout, "There were no test failures\n"); | 
					
						
							|  |  |  | } |