提交 e2d5e1c6 编写于 作者: M Mark VanderVoord

Fixed printability of largest negative value (Thanks SigmaPic!)

上级 a53bb4d1
...@@ -125,12 +125,18 @@ void UnityPrintNumber(const _U_SINT number_to_print) ...@@ -125,12 +125,18 @@ void UnityPrintNumber(const _U_SINT number_to_print)
{ {
_U_SINT divisor = 1; _U_SINT divisor = 1;
_U_SINT next_divisor; _U_SINT next_divisor;
_U_SINT number = number_to_print;
if (number < 0) _U_UINT number;
if (number_to_print < 0)
{ {
UNITY_OUTPUT_CHAR('-'); UNITY_OUTPUT_CHAR('-');
number = -number; number = -number_to_print;
}
else
{
number = number_to_print;
} }
// figure out initial divisor // figure out initial divisor
......
...@@ -218,7 +218,7 @@ void testNotEqualInt16s(void) ...@@ -218,7 +218,7 @@ void testNotEqualInt16s(void)
void testNotEqualInt32s(void) void testNotEqualInt32s(void)
{ {
EXPECT_ABORT_BEGIN EXPECT_ABORT_BEGIN
TEST_ASSERT_EQUAL_INT32(-2147483647, -2147483646); TEST_ASSERT_EQUAL_INT32(-2147483647, -2147483648); //use largest 32 bit negative to test printability
VERIFY_FAILS_END VERIFY_FAILS_END
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册