Skip to content

Commit

Permalink
Updated testSpirit from develop
Browse files Browse the repository at this point in the history
  • Loading branch information
dellaert committed Aug 7, 2019
1 parent 6a3c7d9 commit 942a4d8
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions wrap/tests/testSpirit.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* ----------------------------------------------------------------------------
* GTSAM Copyright 2010, Georgia Tech Research Corporation,
* 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)
Expand Down Expand Up @@ -68,7 +68,7 @@ TEST( spirit, sequence ) {
// parser for interface files

// const string reference reference
Rule constStringRef_p =
Rule constStringRef_p =
str_p("const") >> "string" >> '&';

// class reference
Expand Down Expand Up @@ -102,9 +102,19 @@ TEST( spirit, constMethod_p ) {
EXPECT(parse("double norm() const;", constMethod_p, space_p).full);
}


/* ************************************************************************* */
/* See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56665
GCC compiler issues with -O2 and -fno-strict-aliasing results in undefined
behaviour when spirit uses assign_a with a literal.
GCC versions 4.7.2 -> 5.4 inclusive */

TEST( spirit, return_value_p ) {
bool isEigen = true;
static const bool T = true;
static const bool F = false;

bool isEigen = T;

string actual_return_type;
string actual_function_name;

Expand All @@ -119,9 +129,9 @@ TEST( spirit, return_value_p ) {
Rule funcName_p = lexeme_d[lower_p >> *(alnum_p | '_')];

Rule returnType_p =
(basisType_p[assign_a(actual_return_type)][assign_a(isEigen, true)]) |
(className_p[assign_a(actual_return_type)][assign_a(isEigen,false)]) |
(eigenType_p[assign_a(actual_return_type)][assign_a(isEigen, true)]);
(basisType_p[assign_a(actual_return_type)][assign_a(isEigen, T)]) |
(className_p[assign_a(actual_return_type)][assign_a(isEigen, F)]) |
(eigenType_p[assign_a(actual_return_type)][assign_a(isEigen, T)]);

Rule testFunc_p = returnType_p >> funcName_p[assign_a(actual_function_name)] >> str_p("();");

Expand Down

0 comments on commit 942a4d8

Please sign in to comment.