1
0
mirror of https://github.com/ThrowTheSwitch/Unity.git synced 2026-01-26 09:51:36 +01:00

UnityAssertFloatsWithin now fails any test where either a NaN or Infinite value is passed as expected or actual.

This commit is contained in:
Ross Ryles
2012-10-30 15:24:10 +00:00
parent ae18c560bd
commit 899f2f2fab
2 changed files with 46 additions and 2 deletions

View File

@@ -2281,6 +2281,50 @@ void testFloatsNotEqualNaNInf(void)
#endif
}
void testFloatsNotEqualActualInf(void)
{
#ifdef UNITY_EXCLUDE_FLOAT
TEST_IGNORE();
#else
EXPECT_ABORT_BEGIN
TEST_ASSERT_EQUAL_FLOAT(321.642f, 1.0f / 0.0f);
VERIFY_FAILS_END
#endif
}
void testFloatsNotEqualExpectedInf(void)
{
#ifdef UNITY_EXCLUDE_FLOAT
TEST_IGNORE();
#else
EXPECT_ABORT_BEGIN
TEST_ASSERT_EQUAL_FLOAT(1.0f / 0.0f, 321.642f);
VERIFY_FAILS_END
#endif
}
void testFloatsNotEqualBothInf(void)
{
#ifdef UNITY_EXCLUDE_FLOAT
TEST_IGNORE();
#else
EXPECT_ABORT_BEGIN
TEST_ASSERT_EQUAL_FLOAT(1.0f / 0.0f, 1.0f / 0.0f);
VERIFY_FAILS_END
#endif
}
void testFloatsNotEqualPlusMinusInf(void)
{
#ifdef UNITY_EXCLUDE_FLOAT
TEST_IGNORE();
#else
EXPECT_ABORT_BEGIN
TEST_ASSERT_EQUAL_FLOAT(1.0f / 0.0f, -1.0f / 0.0f);
VERIFY_FAILS_END
#endif
}
void testEqualFloatArrays(void)
{
#ifdef UNITY_EXCLUDE_FLOAT