| 
									
										
										
										
											2010-10-14 12:54:38 +08:00
										 |  |  | /* ----------------------------------------------------------------------------
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |  * GTSAM Copyright 2010, Georgia Tech Research Corporation,  | 
					
						
							|  |  |  |  * Atlanta, Georgia 30332-0415 | 
					
						
							|  |  |  |  * All Rights Reserved | 
					
						
							|  |  |  |  * Authors: Frank Dellaert, et al. (see THANKS for the full author list) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |  * See LICENSE for the license information | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |  * -------------------------------------------------------------------------- */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											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)  | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2010-07-17 03:30:38 +08:00
										 |  |  | 	if (failure.lineNumber < 0) // allow for no line number
 | 
					
						
							| 
									
										
										
										
											2010-11-20 04:36:13 +08:00
										 |  |  | 		fprintf (stdout, "%s%s%s%s\n", | 
					
						
							| 
									
										
										
										
											2010-07-17 03:30:38 +08:00
										 |  |  | 				"Failure: \"", | 
					
						
							|  |  |  | 				failure.message.asCharString (), | 
					
						
							|  |  |  | 				"\" in ", | 
					
						
							|  |  |  | 				failure.fileName.asCharString ()); | 
					
						
							|  |  |  | 	else | 
					
						
							| 
									
										
										
										
											2011-05-24 02:05:10 +08:00
										 |  |  | 		fprintf (stdout, "%s%s%ld%s%s%s\n", | 
					
						
							|  |  |  | 				failure.fileName.asCharString(),  // Format matches Eclipse error flagging
 | 
					
						
							|  |  |  | 				":", | 
					
						
							| 
									
										
										
										
											2010-07-17 03:30:38 +08:00
										 |  |  | 				failure.lineNumber, | 
					
						
							| 
									
										
										
										
											2011-05-24 02:05:10 +08:00
										 |  |  | 				": Failure: \"", | 
					
						
							|  |  |  | 				failure.message.asCharString(), | 
					
						
							|  |  |  | 				"\" "); | 
					
						
							| 
									
										
										
										
											2010-07-17 03:30:38 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-08-22 06:23:24 +08:00
										 |  |  | 	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"); | 
					
						
							|  |  |  | } |