Adding tests for overflow when calling UnityAssertNumbersWithin()

32 or 64 bit test will fail if compiled with -m32 or -m64, repectively
  on clang or gcc
 Fixes to the failures will follow
This commit is contained in:
jsalling
2015-12-16 00:04:17 -06:00
parent 04adb2d2c9
commit 8ca3062ad4

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