提交 8ca3062a 编写于 作者: J jsalling

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
上级 04adb2d2
......@@ -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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册