In certain test-cases it's necessary to test for an exact float-point value. ASSERT_EQUAL is not suitable for this because it assumes arguments to be integers. ASSERT_FLT_NEAR is not suitable either, because it will accept not equal values.
The workaround I currently use is ASSERT_TRUE(function_under_test() == 1.0f), which works as expected, but is not as readable as ASSERT_EQUAL(function_under_test(), 1.0f).
In certain test-cases it's necessary to test for an exact float-point value.
ASSERT_EQUALis not suitable for this because it assumes arguments to be integers.ASSERT_FLT_NEARis not suitable either, because it will accept not equal values.The workaround I currently use is
ASSERT_TRUE(function_under_test() == 1.0f), which works as expected, but is not as readable asASSERT_EQUAL(function_under_test(), 1.0f).