From 43f3d611b2aefd3334f956a41af9872161f15758 Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Tue, 21 Aug 2018 19:40:45 +1000 Subject: [PATCH] AP_Math: pragma away the float-equal test for the maths tests There are legitimate reasons for doing direct equivalence in these files --- libraries/AP_Math/tests/test_math.cpp | 8 ++++++++ libraries/AP_Math/tests/test_matrix3.cpp | 7 +++++++ 2 files changed, 15 insertions(+) diff --git a/libraries/AP_Math/tests/test_math.cpp b/libraries/AP_Math/tests/test_math.cpp index 32f01c3d94..89c9f21a5b 100644 --- a/libraries/AP_Math/tests/test_math.cpp +++ b/libraries/AP_Math/tests/test_math.cpp @@ -1,3 +1,9 @@ + +// given we are in the Math library, you're epected to know what +// you're doing when directly comparing floats: +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wfloat-equal" + #include #include @@ -290,3 +296,5 @@ TEST(MathWrapTest, Angle2PI) } AP_GTEST_MAIN() + +#pragma GCC diagnostic pop diff --git a/libraries/AP_Math/tests/test_matrix3.cpp b/libraries/AP_Math/tests/test_matrix3.cpp index c64b8b3d7f..3372134f60 100644 --- a/libraries/AP_Math/tests/test_matrix3.cpp +++ b/libraries/AP_Math/tests/test_matrix3.cpp @@ -17,6 +17,11 @@ #include "math_test.h" +// given we are in the Math library, you're epected to know what +// you're doing when directly comparing floats: +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wfloat-equal" + #define AP_EXPECT_IDENTITY_MATRIX(m_) {\ EXPECT_NEAR(1.0f, m_.a.x, 1.0e-6); \ EXPECT_NEAR(0.0f, m_.a.y, 1.0e-6); \ @@ -105,3 +110,5 @@ INSTANTIATE_TEST_CASE_P(NonInvertibleMatrices, ::testing::ValuesIn(non_invertible)); AP_GTEST_MAIN() + +#pragma GCC diagnostic pop