1
0
mirror of https://github.com/ThrowTheSwitch/Unity.git synced 2026-01-23 08:25:58 +01:00

Merge pull request #154 from jsalling/bugfix/AssertNumbersWithin-overflow

Bugfix for UnityAssertNumbersWithin()
This commit is contained in:
Mark VanderVoord
2016-01-07 20:45:35 -05:00
3 changed files with 41 additions and 21 deletions

View File

@@ -27,6 +27,9 @@ static const _UD d_zero = 0.0;
Unity.CurrentTestFailed = (Unity.CurrentTestFailed == 1) ? 0 : 1; \
if (Unity.CurrentTestFailed == 1) { \
SetToOneMeanWeAlreadyCheckedThisGuy = 1; \
UnityPrintNumberUnsigned(Unity.CurrentTestLineNumber); \
UNITY_OUTPUT_CHAR(':'); \
UnityPrint(Unity.CurrentTestName); \
UnityPrint("[[[[ Previous Test Should Have Failed But Did Not ]]]]"); \
UNITY_OUTPUT_CHAR('\n'); \
}
@@ -1192,6 +1195,12 @@ void testINT32sNotWithinDelta(void)
VERIFY_FAILS_END
}
void testINT32sNotWithinDeltaAndDifferenceOverflows(void)
{
EXPECT_ABORT_BEGIN
TEST_ASSERT_INT32_WITHIN(1, -1, 0x7FFFFFFF);
VERIFY_FAILS_END
}
void testINT32sNotWithinDeltaAndCustomMessage(void)
{
EXPECT_ABORT_BEGIN
@@ -2496,6 +2505,17 @@ void testINT64sNotWithinDelta(void)
#endif
}
void testINT64sNotWithinDeltaAndDifferenceOverflows(void)
{
#ifndef UNITY_SUPPORT_64
TEST_IGNORE();
#else
EXPECT_ABORT_BEGIN
TEST_ASSERT_INT64_WITHIN(1, 0x8000000000000000, 0x7FFFFFFFFFFFFFFF);
VERIFY_FAILS_END
#endif
}
void testEqualHEX64Arrays(void)
{
#ifndef UNITY_SUPPORT_64