mirror of
https://github.com/ThrowTheSwitch/Unity.git
synced 2025-06-18 04:07:36 +08:00
Fixed printability of largest negative value (Thanks SigmaPic!)
This commit is contained in:
12
src/unity.c
12
src/unity.c
@ -125,12 +125,18 @@ void UnityPrintNumber(const _U_SINT number_to_print)
|
||||
{
|
||||
_U_SINT divisor = 1;
|
||||
_U_SINT next_divisor;
|
||||
_U_SINT number = number_to_print;
|
||||
|
||||
if (number < 0)
|
||||
_U_UINT number;
|
||||
|
||||
if (number_to_print < 0)
|
||||
{
|
||||
UNITY_OUTPUT_CHAR('-');
|
||||
number = -number;
|
||||
number = -number_to_print;
|
||||
}
|
||||
else
|
||||
{
|
||||
number = number_to_print;
|
||||
|
||||
}
|
||||
|
||||
// figure out initial divisor
|
||||
|
@ -218,7 +218,7 @@ void testNotEqualInt16s(void)
|
||||
void testNotEqualInt32s(void)
|
||||
{
|
||||
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
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user