37 #ifndef FCL_SHAPE_REPRESENTATION_UTIL_H
38 #define FCL_SHAPE_REPRESENTATION_UTIL_H
42 #include <gtest/gtest.h>
58 #define INSTANTIATE_AND_SAVE_STRING(code) \
59 const std::string code_string(#code); \
60 const auto shape = code;
73 template <
typename Shape>
75 const Shape& shape,
const std::string& code_string) {
77 ::testing::AssertionResult failure = ::testing::AssertionFailure();
79 const std::regex whitespace_re(
"[\\s\\n]+");
80 const std::string expected =
81 std::regex_replace(code_string, whitespace_re,
" ");
86 const std::string tested =
87 std::regex_replace(shape.representation(20), whitespace_re,
" ");
88 if (tested != expected) {
91 <<
"Representation string mismatch with sufficient precision:"
92 <<
"\n expected: " << expected
93 <<
"\n tested: " << tested;
97 const std::string tested =
98 std::regex_replace(shape.representation(1), whitespace_re,
" ");
99 if (tested == expected) {
102 <<
"Representation string still matches with insufficient precision:"
103 <<
"\n expected: " << expected
104 <<
"\n tested: " << tested;
108 return ::testing::AssertionSuccess();
116 #endif // FCL_SHAPE_REPRESENTATION_UTIL_H