提交 93db16b6 编写于 作者: M Mark VanderVoord

- add the rest of the WITHIN integer options (why were those missing? laziness?)

- rename the custom FLOAT_TRAIT type because the old name was poor
上级 a568862a
......@@ -621,7 +621,7 @@ void UnityAssertFloatsWithin(const _UF delta,
void UnityAssertFloatSpecial(const _UF actual,
const char* msg,
const UNITY_LINE_TYPE lineNumber,
const UNITY_FLOAT_STYLE_T style)
const UNITY_FLOAT_TRAIT_T style)
{
UNITY_SKIP_EXECUTION;
......@@ -781,7 +781,7 @@ void UnityAssertDoublesWithin(const _UD delta,
void UnityAssertDoubleSpecial(const _UD actual,
const char* msg,
const UNITY_LINE_TYPE lineNumber,
const UNITY_FLOAT_STYLE_T style)
const UNITY_FLOAT_TRAIT_T style)
{
UNITY_SKIP_EXECUTION;
......
......@@ -135,7 +135,15 @@
//Integer Ranges (of all sizes)
#define TEST_ASSERT_INT_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_INT_WITHIN(delta, expected, actual, __LINE__, NULL)
#define TEST_ASSERT_INT8_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_INT8_WITHIN(delta, expected, actual, __LINE__, NULL)
#define TEST_ASSERT_INT16_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_INT16_WITHIN(delta, expected, actual, __LINE__, NULL)
#define TEST_ASSERT_INT32_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_INT32_WITHIN(delta, expected, actual, __LINE__, NULL)
#define TEST_ASSERT_INT64_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_INT64_WITHIN(delta, expected, actual, __LINE__, NULL)
#define TEST_ASSERT_UINT_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_UINT_WITHIN(delta, expected, actual, __LINE__, NULL)
#define TEST_ASSERT_UINT8_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_UINT8_WITHIN(delta, expected, actual, __LINE__, NULL)
#define TEST_ASSERT_UINT16_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_UINT16_WITHIN(delta, expected, actual, __LINE__, NULL)
#define TEST_ASSERT_UINT32_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_UINT32_WITHIN(delta, expected, actual, __LINE__, NULL)
#define TEST_ASSERT_UINT64_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_UINT64_WITHIN(delta, expected, actual, __LINE__, NULL)
#define TEST_ASSERT_HEX_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_HEX32_WITHIN(delta, expected, actual, __LINE__, NULL)
#define TEST_ASSERT_HEX8_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_HEX8_WITHIN(delta, expected, actual, __LINE__, NULL)
#define TEST_ASSERT_HEX16_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_HEX16_WITHIN(delta, expected, actual, __LINE__, NULL)
......@@ -231,7 +239,15 @@
//Integer Ranges (of all sizes)
#define TEST_ASSERT_INT_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_INT_WITHIN(delta, expected, actual, __LINE__, message)
#define TEST_ASSERT_INT8_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_INT8_WITHIN(delta, expected, actual, __LINE__, message)
#define TEST_ASSERT_INT16_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_INT16_WITHIN(delta, expected, actual, __LINE__, message)
#define TEST_ASSERT_INT32_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_INT32_WITHIN(delta, expected, actual, __LINE__, message)
#define TEST_ASSERT_INT64_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_INT64_WITHIN(delta, expected, actual, __LINE__, message)
#define TEST_ASSERT_UINT_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_UINT_WITHIN(delta, expected, actual, __LINE__, message)
#define TEST_ASSERT_UINT8_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_UINT8_WITHIN(delta, expected, actual, __LINE__, message)
#define TEST_ASSERT_UINT16_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_UINT16_WITHIN(delta, expected, actual, __LINE__, message)
#define TEST_ASSERT_UINT32_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_UINT32_WITHIN(delta, expected, actual, __LINE__, message)
#define TEST_ASSERT_UINT64_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_UINT64_WITHIN(delta, expected, actual, __LINE__, message)
#define TEST_ASSERT_HEX_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_HEX32_WITHIN(delta, expected, actual, __LINE__, message)
#define TEST_ASSERT_HEX8_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_HEX8_WITHIN(delta, expected, actual, __LINE__, message)
#define TEST_ASSERT_HEX16_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_HEX16_WITHIN(delta, expected, actual, __LINE__, message)
......
......@@ -330,7 +330,7 @@ typedef enum
} UNITY_DISPLAY_STYLE_T;
#ifndef UNITY_EXCLUDE_FLOAT
typedef enum _UNITY_FLOAT_STYLE_T
typedef enum _UNITY_FLOAT_TRAIT_T
{
UNITY_FLOAT_IS_NOT_INF = 0,
UNITY_FLOAT_IS_INF,
......@@ -340,7 +340,7 @@ typedef enum _UNITY_FLOAT_STYLE_T
UNITY_FLOAT_IS_NAN,
UNITY_FLOAT_IS_NOT_DET,
UNITY_FLOAT_IS_DET,
} UNITY_FLOAT_STYLE_T;
} UNITY_FLOAT_TRAIT_T;
#endif
struct _Unity
......@@ -454,7 +454,7 @@ void UnityAssertEqualFloatArray(UNITY_PTR_ATTRIBUTE const _UF* expected,
void UnityAssertFloatSpecial(const _UF actual,
const char* msg,
const UNITY_LINE_TYPE lineNumber,
const UNITY_FLOAT_STYLE_T style);
const UNITY_FLOAT_TRAIT_T style);
#endif
#ifndef UNITY_EXCLUDE_DOUBLE
......@@ -473,7 +473,7 @@ void UnityAssertEqualDoubleArray(UNITY_PTR_ATTRIBUTE const _UD* expected,
void UnityAssertDoubleSpecial(const _UD actual,
const char* msg,
const UNITY_LINE_TYPE lineNumber,
const UNITY_FLOAT_STYLE_T style);
const UNITY_FLOAT_TRAIT_T style);
#endif
//-------------------------------------------------------
......@@ -513,7 +513,13 @@ extern const char* UnityStrErr64;
#define UNITY_TEST_ASSERT_BITS(mask, expected, actual, line, message) UnityAssertBits((_U_SINT)(mask), (_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line)
#define UNITY_TEST_ASSERT_INT_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(delta), (_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT)
#define UNITY_TEST_ASSERT_INT8_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(_US8 )(delta), (_U_SINT)(_US8 )(expected), (_U_SINT)(_US8 )(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT8)
#define UNITY_TEST_ASSERT_INT16_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(_US16)(delta), (_U_SINT)(_US16)(expected), (_U_SINT)(_US16)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT16)
#define UNITY_TEST_ASSERT_INT32_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(_US32)(delta), (_U_SINT)(_US32)(expected), (_U_SINT)(_US32)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT32)
#define UNITY_TEST_ASSERT_UINT_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(delta), (_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT)
#define UNITY_TEST_ASSERT_UINT8_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(_U_UINT)(_UU8 )(delta), (_U_SINT)(_U_UINT)(_UU8 )(expected), (_U_SINT)(_U_UINT)(_UU8 )(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT8)
#define UNITY_TEST_ASSERT_UINT16_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(_U_UINT)(_UU16)(delta), (_U_SINT)(_U_UINT)(_UU16)(expected), (_U_SINT)(_U_UINT)(_UU16)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT16)
#define UNITY_TEST_ASSERT_UINT32_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(_U_UINT)(_UU32)(delta), (_U_SINT)(_U_UINT)(_UU32)(expected), (_U_SINT)(_U_UINT)(_UU32)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT32)
#define UNITY_TEST_ASSERT_HEX8_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(_U_UINT)(_UU8 )(delta), (_U_SINT)(_U_UINT)(_UU8 )(expected), (_U_SINT)(_U_UINT)(_UU8 )(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX8)
#define UNITY_TEST_ASSERT_HEX16_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(_U_UINT)(_UU16)(delta), (_U_SINT)(_U_UINT)(_UU16)(expected), (_U_SINT)(_U_UINT)(_UU16)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX16)
#define UNITY_TEST_ASSERT_HEX32_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(_U_UINT)(_UU32)(delta), (_U_SINT)(_U_UINT)(_UU32)(expected), (_U_SINT)(_U_UINT)(_UU32)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX32)
......@@ -544,6 +550,8 @@ extern const char* UnityStrErr64;
#define UNITY_TEST_ASSERT_EQUAL_INT64_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((UNITY_PTR_ATTRIBUTE const _U_SINT*)(expected), (UNITY_PTR_ATTRIBUTE const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT64)
#define UNITY_TEST_ASSERT_EQUAL_UINT64_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((UNITY_PTR_ATTRIBUTE const _U_SINT*)(expected), (UNITY_PTR_ATTRIBUTE const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT64)
#define UNITY_TEST_ASSERT_EQUAL_HEX64_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((UNITY_PTR_ATTRIBUTE const _U_SINT*)(expected), (UNITY_PTR_ATTRIBUTE const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX64)
#define UNITY_TEST_ASSERT_INT64_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(delta), (_U_SINT)(expected), (_U_SINT)(actual), NULL, (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT64)
#define UNITY_TEST_ASSERT_UINT64_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(delta), (_U_SINT)(expected), (_U_SINT)(actual), NULL, (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT64)
#define UNITY_TEST_ASSERT_HEX64_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(delta), (_U_SINT)(expected), (_U_SINT)(actual), NULL, (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX64)
#else
#define UNITY_TEST_ASSERT_EQUAL_INT64(expected, actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, UnityStrErr64)
......@@ -552,6 +560,8 @@ extern const char* UnityStrErr64;
#define UNITY_TEST_ASSERT_EQUAL_INT64_ARRAY(expected, actual, num_elements, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, UnityStrErr64)
#define UNITY_TEST_ASSERT_EQUAL_UINT64_ARRAY(expected, actual, num_elements, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, UnityStrErr64)
#define UNITY_TEST_ASSERT_EQUAL_HEX64_ARRAY(expected, actual, num_elements, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, UnityStrErr64)
#define UNITY_TEST_ASSERT_INT64_WITHIN(delta, expected, actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, UnityStrErr64)
#define UNITY_TEST_ASSERT_UINT64_WITHIN(delta, expected, actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, UnityStrErr64)
#define UNITY_TEST_ASSERT_HEX64_WITHIN(delta, expected, actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, UnityStrErr64)
#endif
......
......@@ -1036,6 +1036,224 @@ void testHEX8sNotWithinDeltaAndCustomMessage(void)
VERIFY_FAILS_END
}
//-----------------
void testUINT32sWithinDelta(void)
{
TEST_ASSERT_UINT32_WITHIN(1, 5000, 5001);
TEST_ASSERT_UINT32_WITHIN(5, 5000, 4996);
TEST_ASSERT_UINT32_WITHIN(5, 5000, 5005);
}
void testUINT32sWithinDeltaAndCustomMessage(void)
{
TEST_ASSERT_UINT32_WITHIN_MESSAGE(1, 5000, 5001, "Custom Message.");
TEST_ASSERT_UINT32_WITHIN_MESSAGE(5, 5000, 4996, "Custom Message.");
TEST_ASSERT_UINT32_WITHIN_MESSAGE(5, 5000, 5005, "Custom Message.");
}
void testUINT32sNotWithinDelta(void)
{
EXPECT_ABORT_BEGIN
TEST_ASSERT_UINT32_WITHIN(1, 2147483647u, 2147483649u);
VERIFY_FAILS_END
}
void testUINT32sNotWithinDeltaAndCustomMessage(void)
{
EXPECT_ABORT_BEGIN
TEST_ASSERT_UINT32_WITHIN_MESSAGE(1, 2147483647u, 2147483649u, "Custom Message.");
VERIFY_FAILS_END
}
void testUINT32sNotWithinDeltaEvenThoughASignedIntWouldPass(void)
{
EXPECT_ABORT_BEGIN
TEST_ASSERT_UINT32_WITHIN(5, 1, -1);
VERIFY_FAILS_END
}
void testUINT32sNotWithinDeltaEvenThoughASignedIntWouldPassAndCustomMessage(void)
{
EXPECT_ABORT_BEGIN
TEST_ASSERT_UINT32_WITHIN_MESSAGE(5, 1, -1, "Custom Message.");
VERIFY_FAILS_END
}
void testUINT16sWithinDelta(void)
{
TEST_ASSERT_UINT16_WITHIN(1, 5000, 5001);
TEST_ASSERT_UINT16_WITHIN(5, 5000, 4996);
TEST_ASSERT_UINT16_WITHIN(5, 5000, 5005);
}
void testUINT16sWithinDeltaAndCustomMessage(void)
{
TEST_ASSERT_UINT16_WITHIN_MESSAGE(1, 5000, 5001, "Custom Message.");
TEST_ASSERT_UINT16_WITHIN_MESSAGE(5, 5000, 4996, "Custom Message.");
TEST_ASSERT_UINT16_WITHIN_MESSAGE(5, 5000, 5005, "Custom Message.");
}
void testUINT16sWithinDeltaWhenThereAreDifferenceOutsideOf16Bits(void)
{
TEST_ASSERT_UINT16_WITHIN(5, 0x54321, 0x44321);
}
void testUINT16sWithinDeltaWhenThereAreDifferenceOutsideOf16BitsAndCustomMessage(void)
{
TEST_ASSERT_UINT16_WITHIN_MESSAGE(5, 0x54321, 0x44321, "Custom Message.");
}
void testUINT16sNotWithinDelta(void)
{
EXPECT_ABORT_BEGIN
TEST_ASSERT_UINT16_WITHIN(2, 65535, 0);
VERIFY_FAILS_END
}
void testUINT16sNotWithinDeltaAndCustomMessage(void)
{
EXPECT_ABORT_BEGIN
TEST_ASSERT_UINT16_WITHIN_MESSAGE(2, 65535, 0, "Custom Message.");
VERIFY_FAILS_END
}
void testUINT8sWithinDelta(void)
{
TEST_ASSERT_UINT8_WITHIN(1, 254, 255);
TEST_ASSERT_UINT8_WITHIN(5, 251, 255);
TEST_ASSERT_UINT8_WITHIN(5, 1, 4);
}
void testUINT8sWithinDeltaAndCustomMessage(void)
{
TEST_ASSERT_UINT8_WITHIN_MESSAGE(1, 254, 255, "Custom Message.");
TEST_ASSERT_UINT8_WITHIN_MESSAGE(5, 251, 255, "Custom Message.");
TEST_ASSERT_UINT8_WITHIN_MESSAGE(5, 1, 4, "Custom Message.");
}
void testUINT8sWithinDeltaWhenThereAreDifferenceOutsideOf8Bits(void)
{
TEST_ASSERT_UINT8_WITHIN(5, 0x123, 0xF23);
}
void testUINT8sWithinDeltaWhenThereAreDifferenceOutsideOf8BitsAndCustomMessage(void)
{
TEST_ASSERT_UINT8_WITHIN_MESSAGE(5, 0x123, 0xF23, "Custom Message.");
}
void testUINT8sNotWithinDelta(void)
{
EXPECT_ABORT_BEGIN
TEST_ASSERT_UINT8_WITHIN(2, 255, 0);
VERIFY_FAILS_END
}
void testUINT8sNotWithinDeltaAndCustomMessage(void)
{
EXPECT_ABORT_BEGIN
TEST_ASSERT_UINT8_WITHIN_MESSAGE(2, 255, 0, "Custom Message.");
VERIFY_FAILS_END
}
void testINT32sWithinDelta(void)
{
TEST_ASSERT_INT32_WITHIN(1, 5000, 5001);
TEST_ASSERT_INT32_WITHIN(5, 1, -2);
TEST_ASSERT_INT32_WITHIN(5, -2, 1);
}
void testINT32sWithinDeltaAndCustomMessage(void)
{
TEST_ASSERT_INT32_WITHIN_MESSAGE(1, 5000, 5001, "Custom Message.");
}
void testINT32sNotWithinDelta(void)
{
EXPECT_ABORT_BEGIN
TEST_ASSERT_INT32_WITHIN(1, -3, 1);
VERIFY_FAILS_END
}
void testINT32sNotWithinDeltaAndCustomMessage(void)
{
EXPECT_ABORT_BEGIN
TEST_ASSERT_INT32_WITHIN_MESSAGE(1, -2, 1, "Custom Message.");
VERIFY_FAILS_END
}
void testINT16sWithinDelta(void)
{
TEST_ASSERT_INT16_WITHIN(1, 5000, 5001);
TEST_ASSERT_INT16_WITHIN(5, 2, -2);
TEST_ASSERT_INT16_WITHIN(5, -2, 2);
}
void testINT16sWithinDeltaAndCustomMessage(void)
{
TEST_ASSERT_INT16_WITHIN_MESSAGE(1, 5000, 5001, "Custom Message.");
}
void testINT16sWithinDeltaWhenThereAreDifferenceOutsideOf16Bits(void)
{
TEST_ASSERT_INT16_WITHIN(5, 0x54321, 0x44321);
}
void testINT16sWithinDeltaWhenThereAreDifferenceOutsideOf16BitsAndCustomMessage(void)
{
TEST_ASSERT_INT16_WITHIN_MESSAGE(5, 0x54321, 0x44321, "Custom Message.");
}
void testINT16sNotWithinDelta(void)
{
EXPECT_ABORT_BEGIN
TEST_ASSERT_INT16_WITHIN(2, 4, -2);
VERIFY_FAILS_END
}
void testINT16sNotWithinDeltaAndCustomMessage(void)
{
EXPECT_ABORT_BEGIN
TEST_ASSERT_INT16_WITHIN_MESSAGE(2, 3, 0, "Custom Message.");
VERIFY_FAILS_END
}
void testINT8sWithinDelta(void)
{
TEST_ASSERT_INT8_WITHIN(1, 127, 126);
TEST_ASSERT_INT8_WITHIN(5, -2, 2);
TEST_ASSERT_INT8_WITHIN(5, 2, -2);
}
void testINT8sWithinDeltaAndCustomMessage(void)
{
TEST_ASSERT_INT8_WITHIN_MESSAGE(5, 1, 4, "Custom Message.");
}
void testINT8sWithinDeltaWhenThereAreDifferenceOutsideOf8Bits(void)
{
TEST_ASSERT_INT8_WITHIN(5, 0x123, 0xF23);
}
void testINT8sWithinDeltaWhenThereAreDifferenceOutsideOf8BitsAndCustomMessage(void)
{
TEST_ASSERT_INT8_WITHIN_MESSAGE(5, 0x123, 0xF23, "Custom Message.");
}
void testINT8sNotWithinDelta(void)
{
EXPECT_ABORT_BEGIN
TEST_ASSERT_INT8_WITHIN(2, -3, 0);
VERIFY_FAILS_END
}
void testINT8sNotWithinDeltaAndCustomMessage(void)
{
EXPECT_ABORT_BEGIN
TEST_ASSERT_INT8_WITHIN_MESSAGE(2, -4, 0, "Custom Message.");
VERIFY_FAILS_END
}
void testEqualStrings(void)
{
const char *testString = "foo";
......@@ -1577,8 +1795,6 @@ void testNotEqualUINT16Arrays3(void)
VERIFY_FAILS_END
}
void testEqualUINT32Arrays(void)
{
_UU32 p0[] = {1, 8, 987, 65132u};
......@@ -2056,6 +2272,61 @@ void testHEX64sNotWithinDeltaEvenThoughASignedIntWouldPass(void)
#endif
}
void testUINT64sWithinDelta(void)
{
#ifndef UNITY_SUPPORT_64
TEST_IGNORE();
#else
TEST_ASSERT_UINT64_WITHIN(1, 0x7FFFFFFFFFFFFFFF,0x7FFFFFFFFFFFFFFE);
TEST_ASSERT_UINT64_WITHIN(5, 5000, 4996);
TEST_ASSERT_UINT64_WITHIN(5, 5000, 5005);
#endif
}
void testUINT64sNotWithinDelta(void)
{
#ifndef UNITY_SUPPORT_64
TEST_IGNORE();
#else
EXPECT_ABORT_BEGIN
TEST_ASSERT_UINT64_WITHIN(1, 0x7FFFFFFFFFFFFFFF, 0x7FFFFFFFFFFFFFFC);
VERIFY_FAILS_END
#endif
}
void testUINT64sNotWithinDeltaEvenThoughASignedIntWouldPass(void)
{
#ifndef UNITY_SUPPORT_64
TEST_IGNORE();
#else
EXPECT_ABORT_BEGIN
TEST_ASSERT_UINT64_WITHIN(5, 1, -1);
VERIFY_FAILS_END
#endif
}
void testINT64sWithinDelta(void)
{
#ifndef UNITY_SUPPORT_64
TEST_IGNORE();
#else
TEST_ASSERT_INT64_WITHIN(1, 0x7FFFFFFFFFFFFFFF,0x7FFFFFFFFFFFFFFE);
TEST_ASSERT_INT64_WITHIN(5, 5000, 4996);
TEST_ASSERT_INT64_WITHIN(5, 5000, 5005);
#endif
}
void testINT64sNotWithinDelta(void)
{
#ifndef UNITY_SUPPORT_64
TEST_IGNORE();
#else
EXPECT_ABORT_BEGIN
TEST_ASSERT_INT64_WITHIN(1, 0x7FFFFFFFFFFFFFFF, 0x7FFFFFFFFFFFFFFC);
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.
先完成此消息的编辑!
想要评论请 注册