| 
									
										
										
										
											2010-10-14 12:54:38 +08:00
										 |  |  | /* ----------------------------------------------------------------------------
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-02-11 22:39:48 +08:00
										 |  |  |  * GTSAM Copyright 2010, Georgia Tech Research Corporation, | 
					
						
							| 
									
										
										
										
											2010-10-14 12:54:38 +08:00
										 |  |  |  * 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
										 |  |  | 
 | 
					
						
							|  |  |  | ///////////////////////////////////////////////////////////////////////////////
 | 
					
						
							|  |  |  | //
 | 
					
						
							|  |  |  | // FAILURE.H
 | 
					
						
							|  |  |  | //
 | 
					
						
							|  |  |  | // Failure is a class which holds information pertaining to a specific
 | 
					
						
							|  |  |  | // test failure.  The stream insertion operator is overloaded to allow easy
 | 
					
						
							|  |  |  | // display.
 | 
					
						
							|  |  |  | //
 | 
					
						
							|  |  |  | ///////////////////////////////////////////////////////////////////////////////
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-07-18 23:43:55 +08:00
										 |  |  | #pragma once
 | 
					
						
							| 
									
										
										
										
											2009-08-22 06:23:24 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-07-18 23:43:54 +08:00
										 |  |  | #include <string>
 | 
					
						
							| 
									
										
										
										
											2009-08-22 06:23:24 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | class Failure | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | public: | 
					
						
							| 
									
										
										
										
											2012-10-02 22:40:07 +08:00
										 |  |  |   Failure (const std::string&  theTestName, | 
					
						
							|  |  |  |             const std::string&  theFileName, | 
					
						
							|  |  |  |                 long           theLineNumber, | 
					
						
							|  |  |  |                 const std::string&  theCondition) | 
					
						
							|  |  |  |   : message (theCondition), | 
					
						
							|  |  |  |     testName (theTestName), | 
					
						
							|  |  |  |     fileName (theFileName), | 
					
						
							|  |  |  |     lineNumber (theLineNumber) | 
					
						
							|  |  |  |   { | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2012-07-18 23:43:55 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-10-02 22:40:07 +08:00
										 |  |  |   Failure (const std::string&  theTestName, | 
					
						
							|  |  |  |             const std::string&  theFileName, | 
					
						
							|  |  |  |                 const std::string&  theCondition) | 
					
						
							|  |  |  |   : message (theCondition), | 
					
						
							|  |  |  |     testName (theTestName), | 
					
						
							|  |  |  |     fileName (theFileName), | 
					
						
							|  |  |  |     lineNumber (-1) | 
					
						
							|  |  |  |   { | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2012-07-18 23:43:55 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-10-02 22:40:07 +08:00
										 |  |  |   Failure (const std::string&  theTestName, | 
					
						
							|  |  |  |              const std::string&  theFileName, | 
					
						
							|  |  |  |             long          theLineNumber, | 
					
						
							|  |  |  |             const std::string&  expected, | 
					
						
							|  |  |  |             const std::string&  actual) | 
					
						
							|  |  |  |   : message("expected " + expected + " but was: " + actual), | 
					
						
							|  |  |  |     testName (theTestName), | 
					
						
							|  |  |  |     fileName (theFileName), | 
					
						
							|  |  |  |     lineNumber (theLineNumber) | 
					
						
							|  |  |  |   { | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2010-07-17 03:30:38 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-10-02 22:40:07 +08:00
										 |  |  |   std::string    message; | 
					
						
							|  |  |  |   std::string    testName; | 
					
						
							|  |  |  |   std::string    fileName; | 
					
						
							|  |  |  |   long        lineNumber; | 
					
						
							| 
									
										
										
										
											2009-08-22 06:23:24 +08:00
										 |  |  | }; |