mirror of
https://github.com/ThrowTheSwitch/Unity.git
synced 2026-01-29 11:14:27 +01:00
If two floats happen to be equal, return right away
Covers the cases where infinity == infinity
This commit is contained in:
@@ -683,6 +683,8 @@ void UnityAssertFloatsWithin(const _UF delta,
|
|||||||
|
|
||||||
UNITY_SKIP_EXECUTION;
|
UNITY_SKIP_EXECUTION;
|
||||||
|
|
||||||
|
if (expected == actual) return;
|
||||||
|
|
||||||
if (diff < 0.0f)
|
if (diff < 0.0f)
|
||||||
{
|
{
|
||||||
diff = 0.0f - diff;
|
diff = 0.0f - diff;
|
||||||
@@ -844,6 +846,8 @@ void UnityAssertDoublesWithin(const _UD delta,
|
|||||||
|
|
||||||
UNITY_SKIP_EXECUTION;
|
UNITY_SKIP_EXECUTION;
|
||||||
|
|
||||||
|
if (expected == actual) return;
|
||||||
|
|
||||||
if (diff < 0.0)
|
if (diff < 0.0)
|
||||||
{
|
{
|
||||||
diff = 0.0 - diff;
|
diff = 0.0 - diff;
|
||||||
|
|||||||
@@ -2838,9 +2838,7 @@ void testFloatsNotEqualBothInf(void)
|
|||||||
#ifdef UNITY_EXCLUDE_FLOAT
|
#ifdef UNITY_EXCLUDE_FLOAT
|
||||||
TEST_IGNORE();
|
TEST_IGNORE();
|
||||||
#else
|
#else
|
||||||
EXPECT_ABORT_BEGIN
|
|
||||||
TEST_ASSERT_EQUAL_FLOAT(1.0f / f_zero, 1.0f / f_zero);
|
TEST_ASSERT_EQUAL_FLOAT(1.0f / f_zero, 1.0f / f_zero);
|
||||||
VERIFY_FAILS_END
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3370,9 +3368,7 @@ void testDoublesNotEqualBothInf(void)
|
|||||||
#ifdef UNITY_EXCLUDE_DOUBLE
|
#ifdef UNITY_EXCLUDE_DOUBLE
|
||||||
TEST_IGNORE();
|
TEST_IGNORE();
|
||||||
#else
|
#else
|
||||||
EXPECT_ABORT_BEGIN
|
|
||||||
TEST_ASSERT_EQUAL_DOUBLE(1.0 / d_zero, 1.0 / d_zero);
|
TEST_ASSERT_EQUAL_DOUBLE(1.0 / d_zero, 1.0 / d_zero);
|
||||||
VERIFY_FAILS_END
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user