| 
									
										
										
										
											2014-11-13 04:54:43 +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 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |  * -------------------------------------------------------------------------- */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /**
 | 
					
						
							|  |  |  |  * @file testMethod.cpp | 
					
						
							|  |  |  |  * @brief Unit test for Method class | 
					
						
							|  |  |  |  * @author Frank Dellaert | 
					
						
							|  |  |  |  * @date Nov 12, 2014 | 
					
						
							|  |  |  |  **/ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include <wrap/Method.h>
 | 
					
						
							|  |  |  | #include <CppUnitLite/TestHarness.h>
 | 
					
						
							|  |  |  | #include <iostream>
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | using namespace std; | 
					
						
							|  |  |  | using namespace wrap; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-12-01 03:46:19 +08:00
										 |  |  | //******************************************************************************
 | 
					
						
							| 
									
										
										
										
											2014-11-13 05:06:53 +08:00
										 |  |  | // Constructor
 | 
					
						
							| 
									
										
										
										
											2014-11-13 04:54:43 +08:00
										 |  |  | TEST( Method, Constructor ) { | 
					
						
							|  |  |  |   Method method; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-12-01 03:46:19 +08:00
										 |  |  | //******************************************************************************
 | 
					
						
							| 
									
										
										
										
											2014-11-13 05:06:53 +08:00
										 |  |  | // addOverload
 | 
					
						
							|  |  |  | TEST( Method, addOverload ) { | 
					
						
							| 
									
										
										
										
											2014-11-14 23:43:53 +08:00
										 |  |  |   Method method; | 
					
						
							| 
									
										
										
										
											2014-11-13 05:06:53 +08:00
										 |  |  |   ArgumentList args; | 
					
						
							| 
									
										
										
										
											2014-11-23 05:13:21 +08:00
										 |  |  |   bool is_const = true; | 
					
						
							|  |  |  |   const ReturnValue retVal1(ReturnType("return_type1")); | 
					
						
							|  |  |  |   method.addOverload("myName", args, retVal1, is_const); | 
					
						
							|  |  |  |   const ReturnValue retVal2(ReturnType("return_type2")); | 
					
						
							|  |  |  |   method.addOverload("myName", args, retVal2, is_const); | 
					
						
							|  |  |  |   EXPECT_LONGS_EQUAL(2, method.nrOverloads()); | 
					
						
							| 
									
										
										
										
											2014-11-13 05:06:53 +08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-12-01 03:46:19 +08:00
										 |  |  | ////******************************************************************************
 | 
					
						
							|  |  |  | //TEST( Method, grammar ) {
 | 
					
						
							|  |  |  | //
 | 
					
						
							|  |  |  | //  using classic::space_p;
 | 
					
						
							|  |  |  | //
 | 
					
						
							|  |  |  | //  // Create type grammar that will place result in actual
 | 
					
						
							|  |  |  | //  Method actual;
 | 
					
						
							|  |  |  | //  method_grammar method_g(actual);
 | 
					
						
							|  |  |  | //
 | 
					
						
							|  |  |  | //  // a class type with namespaces
 | 
					
						
							|  |  |  | //  EXPECT(parse("double x() const;", method_g, space_p).full);
 | 
					
						
							|  |  |  | //}
 | 
					
						
							| 
									
										
										
										
											2014-12-01 03:12:03 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | //******************************************************************************
 | 
					
						
							| 
									
										
										
										
											2014-11-13 05:06:53 +08:00
										 |  |  | int main() { | 
					
						
							|  |  |  |   TestResult tr; | 
					
						
							|  |  |  |   return TestRegistry::runAllTests(tr); | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2014-12-01 03:46:19 +08:00
										 |  |  | //******************************************************************************
 |