/* ---------------------------------------------------------------------------- * 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 testClass.cpp * @brief Unit test for Class class * @author Frank Dellaert * @date Nov 12, 2014 **/ #include #include #include using namespace std; using namespace wrap; /* ************************************************************************* */ // Constructor TEST( Class, Constructor ) { Class cls; } /* ************************************************************************* */ // test method overloading TEST( Class, OverloadingMethod ) { Class cls; const string name = "method1"; EXPECT(!cls.exists(name)); bool verbose = true, is_const = true; ArgumentList args; const ReturnValue retVal; const Template tmplate; cls.addMethod(verbose, is_const, name, args, retVal, tmplate); EXPECT_LONGS_EQUAL(1, cls.nrMethods()); EXPECT(cls.exists(name)); EXPECT_LONGS_EQUAL(1, cls.method(name).nrOverloads()); // add an overload w different argument list args.push_back(Argument(Qualified("Vector", Qualified::EIGEN), "v")); cls.addMethod(verbose, is_const, name, args, retVal, tmplate); EXPECT_LONGS_EQUAL(1, cls.nrMethods()); EXPECT_LONGS_EQUAL(2, cls.method(name).nrOverloads()); // add with non-trivial template list, will create two different functions boost::optional