Fixed printability of largest negative value (Thanks SigmaPic!)

This commit is contained in:
Mark VanderVoord
2014-09-01 16:44:18 -04:00
parent a53bb4d177
commit e2d5e1c632
2 changed files with 10 additions and 4 deletions

View File

@ -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

View File

@ -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
}