Clear now up to caller

release/4.3a0
dellaert 2014-11-30 16:09:13 +01:00
parent b50f42a606
commit f1c91d5d4b
1 changed files with 15 additions and 2 deletions

View File

@ -23,7 +23,7 @@ using namespace std;
using namespace wrap; using namespace wrap;
//****************************************************************************** //******************************************************************************
TEST( spirit, grammar ) { TEST( Type, grammar ) {
using classic::space_p; using classic::space_p;
@ -31,37 +31,50 @@ TEST( spirit, grammar ) {
Qualified actual; Qualified actual;
type_grammar type_g(actual); type_grammar type_g(actual);
// a class type with namespaces // a class type with 2 namespaces
EXPECT(parse("gtsam::internal::Point2", type_g, space_p).full); EXPECT(parse("gtsam::internal::Point2", type_g, space_p).full);
EXPECT(actual.name=="Point2"); EXPECT(actual.name=="Point2");
EXPECT_LONGS_EQUAL(2, actual.namespaces.size()); EXPECT_LONGS_EQUAL(2, actual.namespaces.size());
EXPECT(actual.namespaces[0]=="gtsam"); EXPECT(actual.namespaces[0]=="gtsam");
EXPECT(actual.namespaces[1]=="internal"); EXPECT(actual.namespaces[1]=="internal");
EXPECT(actual.category==Qualified::CLASS); EXPECT(actual.category==Qualified::CLASS);
actual.clear();
// a class type with 1 namespace
EXPECT(parse("gtsam::Point2", type_g, space_p).full);
EXPECT(actual.name=="Point2");
EXPECT_LONGS_EQUAL(1, actual.namespaces.size());
EXPECT(actual.namespaces[0]=="gtsam");
EXPECT(actual.category==Qualified::CLASS);
actual.clear();
// a class type with no namespaces // a class type with no namespaces
EXPECT(parse("Point2", type_g, space_p).full); EXPECT(parse("Point2", type_g, space_p).full);
EXPECT(actual.name=="Point2"); EXPECT(actual.name=="Point2");
EXPECT(actual.namespaces.empty()); EXPECT(actual.namespaces.empty());
EXPECT(actual.category==Qualified::CLASS); EXPECT(actual.category==Qualified::CLASS);
actual.clear();
// an Eigen type // an Eigen type
EXPECT(parse("Vector", type_g, space_p).full); EXPECT(parse("Vector", type_g, space_p).full);
EXPECT(actual.name=="Vector"); EXPECT(actual.name=="Vector");
EXPECT(actual.namespaces.empty()); EXPECT(actual.namespaces.empty());
EXPECT(actual.category==Qualified::EIGEN); EXPECT(actual.category==Qualified::EIGEN);
actual.clear();
// a basic type // a basic type
EXPECT(parse("double", type_g, space_p).full); EXPECT(parse("double", type_g, space_p).full);
EXPECT(actual.name=="double"); EXPECT(actual.name=="double");
EXPECT(actual.namespaces.empty()); EXPECT(actual.namespaces.empty());
EXPECT(actual.category==Qualified::BASIS); EXPECT(actual.category==Qualified::BASIS);
actual.clear();
// void // void
EXPECT(parse("void", type_g, space_p).full); EXPECT(parse("void", type_g, space_p).full);
EXPECT(actual.name=="void"); EXPECT(actual.name=="void");
EXPECT(actual.namespaces.empty()); EXPECT(actual.namespaces.empty());
EXPECT(actual.category==Qualified::VOID); EXPECT(actual.category==Qualified::VOID);
actual.clear();
} }
//****************************************************************************** //******************************************************************************