AP_Math: remove macros from unit tests

Avoid warnings like:

[2130/2168] Compiling libraries/AP_Math/tests/test_math.cpp
../../libraries/AP_Math/tests/test_math.cpp: In member function ‘virtual void MathTest_IsZero_Test::TestBody()’:
../../libraries/AP_Math/tests/test_math.cpp:73:196: warning: converting ‘false’ to pointer type for argument 1 of ‘char
testing::internal::IsNullLiteralHelper(testing::internal::Secret*)’ [-Wconversion-null]
../../libraries/AP_Math/tests/test_math.cpp:74:199: warning: converting ‘false’ to pointer type for argument 1 of ‘char
testing::internal::IsNullLiteralHelper(testing::internal::Secret*)’ [-Wconversion-null]

Use EXPECT_TRUE() and EXPECT_FALSE() from gtest instead.
This commit is contained in:
Lucas De Marchi 2016-05-02 15:40:53 -03:00
parent 41661f815f
commit 348b07609c
1 changed files with 9 additions and 19 deletions

View File

@ -65,29 +65,19 @@ TEST(VectorTest, Rotations)
TEST(MathTest, IsZero)
{
#define TEST_IS_ZERO(_result, _test) { \
bool bZero = is_zero(_test); \
EXPECT_EQ(_result, bZero) << "is_zero(): floating point is_zero comparator failure"; \
}
TEST_IS_ZERO(false, 0.1);
TEST_IS_ZERO(false, 0.0001);
TEST_IS_ZERO(true, 0.f);
TEST_IS_ZERO(true, FLT_MIN);
TEST_IS_ZERO(true, -FLT_MIN);
EXPECT_FALSE(is_zero(0.1));
EXPECT_FALSE(is_zero(0.0001));
EXPECT_TRUE(is_zero(0.f));
EXPECT_TRUE(is_zero(FLT_MIN));
EXPECT_TRUE(is_zero(-FLT_MIN));
}
TEST(MathTest, IsEqual)
{
#define TEST_IS_EQUAL(_result, _test1, _test2) { \
bool bEqual = is_equal(_test1, _test2); \
EXPECT_EQ(_result, bEqual) << "is_equal(): floating point is_equal comparator failure"; \
}
TEST_IS_EQUAL(false, 0.1, 0.10001);
TEST_IS_EQUAL(false, 0.1, -0.1001);
TEST_IS_EQUAL(true, 0.f, 0.0f);
TEST_IS_EQUAL(false, 1.f, 1.f + FLT_EPSILON);
EXPECT_FALSE(is_equal(0.1, 0.10001));
EXPECT_FALSE(is_equal(0.1, -0.1001));
EXPECT_TRUE(is_equal(0.f, 0.0f));
EXPECT_FALSE(is_equal(1.f, 1.f + FLT_EPSILON));
}
TEST(MathTest, Square)