From d62033a856f4e78ce0625ff9dd43539d30e39a2a Mon Sep 17 00:00:00 2001 From: Gerry Chen Date: Sun, 30 Jan 2022 17:38:42 -0500 Subject: [PATCH] fix namespace collision with symbol_shorthand::X in unit test --- tests/testNonlinearFactor.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/tests/testNonlinearFactor.cpp b/tests/testNonlinearFactor.cpp index 27b61cf894..bdc2d576d0 100644 --- a/tests/testNonlinearFactor.cpp +++ b/tests/testNonlinearFactor.cpp @@ -382,8 +382,9 @@ class TestFactor4 : public NoiseModelFactor4 { "This type wrong"); public: + static constexpr auto X_ = symbol_shorthand::X; // collision with X<1> typedef NoiseModelFactor4 Base; - TestFactor4() : Base(noiseModel::Diagonal::Sigmas((Vector(1) << 2.0).finished()), X(1), X(2), X(3), X(4)) {} + TestFactor4() : Base(noiseModel::Diagonal::Sigmas((Vector(1) << 2.0).finished()), X_(1), X_(2), X_(3), X_(4)) {} Vector evaluateError(const double& x1, const double& x2, const double& x3, const double& x4, @@ -446,8 +447,9 @@ TEST(NonlinearFactor, NoiseModelFactor4) { /* ************************************************************************* */ class TestFactor5 : public NoiseModelFactor5 { public: + static constexpr auto X_ = symbol_shorthand::X; // collision with X<1> typedef NoiseModelFactor5 Base; - TestFactor5() : Base(noiseModel::Diagonal::Sigmas((Vector(1) << 2.0).finished()), X(1), X(2), X(3), X(4), X(5)) {} + TestFactor5() : Base(noiseModel::Diagonal::Sigmas((Vector(1) << 2.0).finished()), X_(1), X_(2), X_(3), X_(4), X_(5)) {} Vector evaluateError(const X1& x1, const X2& x2, const X3& x3, const X4& x4, const X5& x5, @@ -495,8 +497,9 @@ TEST(NonlinearFactor, NoiseModelFactor5) { /* ************************************************************************* */ class TestFactor6 : public NoiseModelFactor6 { public: + static constexpr auto X_ = symbol_shorthand::X; // collision with X<1> typedef NoiseModelFactor6 Base; - TestFactor6() : Base(noiseModel::Diagonal::Sigmas((Vector(1) << 2.0).finished()), X(1), X(2), X(3), X(4), X(5), X(6)) {} + TestFactor6() : Base(noiseModel::Diagonal::Sigmas((Vector(1) << 2.0).finished()), X_(1), X_(2), X_(3), X_(4), X_(5), X_(6)) {} Vector evaluateError(const X1& x1, const X2& x2, const X3& x3, const X4& x4, const X5& x5, const X6& x6, @@ -551,8 +554,9 @@ TEST(NonlinearFactor, NoiseModelFactor6) { /* ************************************************************************* */ class TestFactorN : public NoiseModelFactorN { public: + static constexpr auto X_ = symbol_shorthand::X; // collision with X<1> typedef NoiseModelFactorN Base; - TestFactorN() : Base(noiseModel::Diagonal::Sigmas((Vector(1) << 2.0).finished()), X(1), X(2), X(3), X(4)) {} + TestFactorN() : Base(noiseModel::Diagonal::Sigmas((Vector(1) << 2.0).finished()), X_(1), X_(2), X_(3), X_(4)) {} Vector evaluateError(const double& x1, const double& x2, const double& x3, const double& x4,