@@ -197,41 +197,48 @@ void UnityPrintLen(const char* string, const UNITY_UINT32 length)
197197/*-----------------------------------------------*/
198198void UnityPrintIntNumberByStyle (const UNITY_INT number , const UNITY_DISPLAY_STYLE_T style )
199199{
200- if (( style & UNITY_DISPLAY_RANGE_INT ) == UNITY_DISPLAY_RANGE_INT )
200+ if (style == UNITY_DISPLAY_STYLE_CHAR )
201201 {
202- if (style == UNITY_DISPLAY_STYLE_CHAR )
202+ /* printable characters plus CR & LF are printed */
203+ UNITY_OUTPUT_CHAR ('\'' );
204+ if ((number <= 126 ) && (number >= 32 ))
203205 {
204- /* printable characters plus CR & LF are printed */
205- UNITY_OUTPUT_CHAR ('\'' );
206- if ((number <= 126 ) && (number >= 32 ))
207- {
208- UNITY_OUTPUT_CHAR ((int )number );
209- }
210- /* write escaped carriage returns */
211- else if (number == 13 )
212- {
213- UNITY_OUTPUT_CHAR ('\\' );
214- UNITY_OUTPUT_CHAR ('r' );
215- }
216- /* write escaped line feeds */
217- else if (number == 10 )
218- {
219- UNITY_OUTPUT_CHAR ('\\' );
220- UNITY_OUTPUT_CHAR ('n' );
221- }
222- /* unprintable characters are shown as codes */
223- else
224- {
225- UNITY_OUTPUT_CHAR ('\\' );
226- UNITY_OUTPUT_CHAR ('x' );
227- UnityPrintNumberHex ((UNITY_UINT )number , 2 );
228- }
229- UNITY_OUTPUT_CHAR ('\'' );
206+ UNITY_OUTPUT_CHAR ((int )number );
207+ }
208+ /* write escaped carriage returns */
209+ else if (number == 13 )
210+ {
211+ UNITY_OUTPUT_CHAR ('\\' );
212+ UNITY_OUTPUT_CHAR ('r' );
230213 }
214+ /* write escaped line feeds */
215+ else if (number == 10 )
216+ {
217+ UNITY_OUTPUT_CHAR ('\\' );
218+ UNITY_OUTPUT_CHAR ('n' );
219+ }
220+ /* unprintable characters are shown as codes */
231221 else
232222 {
233- UnityPrintNumber (number );
223+ UNITY_OUTPUT_CHAR ('\\' );
224+ UNITY_OUTPUT_CHAR ('x' );
225+ UnityPrintNumberHex ((UNITY_UINT )number , 2 );
234226 }
227+ UNITY_OUTPUT_CHAR ('\'' );
228+ }
229+ else if ((style & UNITY_DISPLAY_RANGE_INT ) == UNITY_DISPLAY_RANGE_INT )
230+ {
231+ UnityPrintNumber (number );
232+ }
233+ else if ((style & UNITY_DISPLAY_RANGE_UINT ) == UNITY_DISPLAY_RANGE_UINT )
234+ {
235+ UnityPrintNumberUnsigned ((UNITY_UINT )number );
236+ }
237+ else
238+ {
239+ UNITY_OUTPUT_CHAR ('0' );
240+ UNITY_OUTPUT_CHAR ('x' );
241+ UnityPrintNumberHex ((UNITY_UINT )number , (char )((style & 0xF ) * 2 ));
235242 }
236243}
237244
@@ -359,25 +366,25 @@ void UnityPrintFloat(const UNITY_DOUBLE input_number)
359366
360367 UNITY_DOUBLE number = input_number ;
361368
362- /* print minus sign (does not handle negative zero) */
363- if (number < 0.0f )
364- {
365- UNITY_OUTPUT_CHAR ('-' );
366- number = - number ;
367- }
368-
369369 /* handle zero, NaN, and +/- infinity */
370370 if (number == 0.0f )
371371 {
372372 UnityPrint ("0" );
373373 }
374374 else if (UNITY_IS_NAN (number ))
375375 {
376- UnityPrint ("nan" );
376+ UnityPrint (UnityStrNaN );
377377 }
378378 else if (UNITY_IS_INF (number ))
379379 {
380- UnityPrint ("inf" );
380+ if (number < 0.0f )
381+ {
382+ UnityPrint (UnityStrNegInf );
383+ }
384+ else
385+ {
386+ UnityPrint (UnityStrInf );
387+ }
381388 }
382389 else
383390 {
@@ -388,6 +395,11 @@ void UnityPrintFloat(const UNITY_DOUBLE input_number)
388395 int digits ;
389396 char buf [16 ] = {0 };
390397
398+ if (number < 0.0f )
399+ {
400+ UNITY_OUTPUT_CHAR ('-' );
401+ number = - number ;
402+ }
391403 /*
392404 * Scale up or down by powers of 10. To minimize rounding error,
393405 * start with a factor/divisor of 10^10, which is the largest
@@ -868,6 +880,8 @@ void UnityAssertEqualIntArray(UNITY_INTERNAL_PTR expected,
868880 const UNITY_DISPLAY_STYLE_T style ,
869881 const UNITY_FLAGS_T flags )
870882{
883+ UNITY_INT expect_val = 0 ;
884+ UNITY_INT actual_val = 0 ;
871885 UNITY_UINT32 elements = num_elements ;
872886 unsigned int length = style & 0xF ;
873887 unsigned int increment = 0 ;
@@ -895,9 +909,6 @@ void UnityAssertEqualIntArray(UNITY_INTERNAL_PTR expected,
895909
896910 while ((elements > 0 ) && (elements -- ))
897911 {
898- UNITY_INT expect_val ;
899- UNITY_INT actual_val ;
900-
901912 switch (length )
902913 {
903914 case 1 :
0 commit comments