提交 83148364 编写于 作者: R Ross Ryles

Fix For Issue #10 - TEST_ASSERT_EQUAL_FLOAT doesn't fail if actual value is a NaN.

上级 731e0f6b
......@@ -578,7 +578,8 @@ void UnityAssertFloatsWithin(const _UF delta,
pos_delta = 0.0f - pos_delta;
}
if (pos_delta < diff)
// NOTE: This comparrison is deliberately this way round so that NaNs fail.
if ( ! (pos_delta >= diff) )
{
UnityTestResultsFailBegin(lineNumber);
#ifdef UNITY_FLOAT_VERBOSE
......
......@@ -2226,6 +2226,17 @@ void testFloatsNotEqualNegative2(void)
#endif
}
void testFloatsNotEqualActualNaN(void)
{
#ifdef UNITY_EXCLUDE_FLOAT
TEST_IGNORE();
#else
EXPECT_ABORT_BEGIN
TEST_ASSERT_EQUAL_FLOAT(85.963f, 0.0f / 0.0f);
VERIFY_FAILS_END
#endif
}
void testEqualFloatArrays(void)
{
#ifdef UNITY_EXCLUDE_FLOAT
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册