Create repository
[fwd.git] / unity / src / unity.c
1 /* =========================================================================\r
2     Unity Project - A Test Framework for C\r
3     Copyright (c) 2007-14 Mike Karlesky, Mark VanderVoord, Greg Williams\r
4     [Released under MIT License. Please refer to license.txt for details]\r
5 ============================================================================ */\r
6 \r
7 #include "unity.h"\r
8 \r
9 #define UNITY_FAIL_AND_BAIL   { Unity.CurrentTestFailed  = 1; longjmp(Unity.AbortFrame, 1); }\r
10 #define UNITY_IGNORE_AND_BAIL { Unity.CurrentTestIgnored = 1; longjmp(Unity.AbortFrame, 1); }\r
11 /// return prematurely if we are already in failure or ignore state\r
12 #define UNITY_SKIP_EXECUTION  { if ((Unity.CurrentTestFailed != 0) || (Unity.CurrentTestIgnored != 0)) {return;} }\r
13 #define UNITY_PRINT_EOL       { UNITY_OUTPUT_CHAR('\n'); }\r
14 \r
15 struct _Unity Unity;\r
16 \r
17 const char UnityStrOk[]                     = "OK";\r
18 const char UnityStrPass[]                   = "PASS";\r
19 const char UnityStrFail[]                   = "FAIL";\r
20 const char UnityStrIgnore[]                 = "IGNORE";\r
21 const char UnityStrNull[]                   = "NULL";\r
22 const char UnityStrSpacer[]                 = ". ";\r
23 const char UnityStrExpected[]               = " Expected ";\r
24 const char UnityStrWas[]                    = " Was ";\r
25 const char UnityStrTo[]                     = " To ";\r
26 const char UnityStrElement[]                = " Element ";\r
27 const char UnityStrByte[]                   = " Byte ";\r
28 const char UnityStrMemory[]                 = " Memory Mismatch.";\r
29 const char UnityStrDelta[]                  = " Values Not Within Delta ";\r
30 const char UnityStrPointless[]              = " You Asked Me To Compare Nothing, Which Was Pointless.";\r
31 const char UnityStrNullPointerForExpected[] = " Expected pointer to be NULL";\r
32 const char UnityStrNullPointerForActual[]   = " Actual pointer was NULL";\r
33 const char UnityStrNot[]                    = "Not ";\r
34 const char UnityStrInf[]                    = "Infinity";\r
35 const char UnityStrNegInf[]                 = "Negative Infinity";\r
36 const char UnityStrNaN[]                    = "NaN";\r
37 const char UnityStrDet[]                    = "Determinate";\r
38 const char UnityStrErrFloat[]               = "Unity Floating Point Disabled";\r
39 const char UnityStrErrDouble[]              = "Unity Double Precision Disabled";\r
40 const char UnityStrErr64[]                  = "Unity 64-bit Support Disabled";\r
41 const char UnityStrBreaker[]                = "-----------------------";\r
42 const char UnityStrResultsTests[]           = " Tests ";\r
43 const char UnityStrResultsFailures[]        = " Failures ";\r
44 const char UnityStrResultsIgnored[]         = " Ignored ";\r
45 \r
46 #ifndef UNITY_EXCLUDE_FLOAT\r
47 // Dividing by these constants produces +/- infinity.\r
48 // The rationale is given in UnityAssertFloatIsInf's body.\r
49 static const _UF f_zero = 0.0f;\r
50 #ifndef UNITY_EXCLUDE_DOUBLE\r
51 static const _UD d_zero = 0.0;\r
52 #endif\r
53 #endif\r
54 \r
55 // compiler-generic print formatting masks\r
56 const _U_UINT UnitySizeMask[] =\r
57 {\r
58     255u,         // 0xFF\r
59     65535u,       // 0xFFFF\r
60     65535u,\r
61     4294967295u,  // 0xFFFFFFFF\r
62     4294967295u,\r
63     4294967295u,\r
64     4294967295u\r
65 #ifdef UNITY_SUPPORT_64\r
66     ,0xFFFFFFFFFFFFFFFF\r
67 #endif\r
68 };\r
69 \r
70 void UnityPrintFail(void);\r
71 void UnityPrintOk(void);\r
72 \r
73 //-----------------------------------------------\r
74 // Pretty Printers & Test Result Output Handlers\r
75 //-----------------------------------------------\r
76 \r
77 void UnityPrint(const char* string)\r
78 {\r
79     const char* pch = string;\r
80 \r
81     if (pch != NULL)\r
82     {\r
83         while (*pch)\r
84         {\r
85             // printable characters plus CR & LF are printed\r
86             if ((*pch <= 126) && (*pch >= 32))\r
87             {\r
88                 UNITY_OUTPUT_CHAR(*pch);\r
89             }\r
90             //write escaped carriage returns\r
91             else if (*pch == 13)\r
92             {\r
93                 UNITY_OUTPUT_CHAR('\\');\r
94                 UNITY_OUTPUT_CHAR('r');\r
95             }\r
96             //write escaped line feeds\r
97             else if (*pch == 10)\r
98             {\r
99                 UNITY_OUTPUT_CHAR('\\');\r
100                 UNITY_OUTPUT_CHAR('n');\r
101             }\r
102             // unprintable characters are shown as codes\r
103             else\r
104             {\r
105                 UNITY_OUTPUT_CHAR('\\');\r
106                 UnityPrintNumberHex((_U_UINT)*pch, 2);\r
107             }\r
108             pch++;\r
109         }\r
110     }\r
111 }\r
112 \r
113 //-----------------------------------------------\r
114 void UnityPrintNumberByStyle(const _U_SINT number, const UNITY_DISPLAY_STYLE_T style)\r
115 {\r
116     if ((style & UNITY_DISPLAY_RANGE_INT) == UNITY_DISPLAY_RANGE_INT)\r
117     {\r
118         UnityPrintNumber(number);\r
119     }\r
120     else if ((style & UNITY_DISPLAY_RANGE_UINT) == UNITY_DISPLAY_RANGE_UINT)\r
121     {\r
122         UnityPrintNumberUnsigned(  (_U_UINT)number  &  UnitySizeMask[((_U_UINT)style & (_U_UINT)0x0F) - 1]  );\r
123     }\r
124     else\r
125     {\r
126         UnityPrintNumberHex((_U_UINT)number, (char)((style & 0x000F) << 1));\r
127     }\r
128 }\r
129 \r
130 //-----------------------------------------------\r
131 /// basically do an itoa using as little ram as possible\r
132 void UnityPrintNumber(const _U_SINT number_to_print)\r
133 {\r
134     _U_SINT divisor = 1;\r
135     _U_SINT next_divisor;\r
136     _U_UINT number;\r
137 \r
138     if (number_to_print == (1l << (UNITY_LONG_WIDTH-1)))\r
139     {\r
140         //The largest representable negative number\r
141         UNITY_OUTPUT_CHAR('-');\r
142         number = (1ul << (UNITY_LONG_WIDTH-1));\r
143     }\r
144     else if (number_to_print < 0)\r
145     {\r
146         //Some other negative number\r
147         UNITY_OUTPUT_CHAR('-');\r
148         number = (_U_UINT)(-number_to_print);\r
149     }\r
150     else\r
151     {\r
152         //Positive number\r
153         number = (_U_UINT)number_to_print;\r
154     }\r
155 \r
156     // figure out initial divisor\r
157     while (number / divisor > 9)\r
158     {\r
159         next_divisor = divisor * 10;\r
160         if (next_divisor > divisor)\r
161             divisor = next_divisor;\r
162         else\r
163             break;\r
164     }\r
165 \r
166     // now mod and print, then divide divisor\r
167     do\r
168     {\r
169         UNITY_OUTPUT_CHAR((char)('0' + (number / divisor % 10)));\r
170         divisor /= 10;\r
171     }\r
172     while (divisor > 0);\r
173 }\r
174 \r
175 //-----------------------------------------------\r
176 /// basically do an itoa using as little ram as possible\r
177 void UnityPrintNumberUnsigned(const _U_UINT number)\r
178 {\r
179     _U_UINT divisor = 1;\r
180     _U_UINT next_divisor;\r
181 \r
182     // figure out initial divisor\r
183     while (number / divisor > 9)\r
184     {\r
185         next_divisor = divisor * 10;\r
186         if (next_divisor > divisor)\r
187             divisor = next_divisor;\r
188         else\r
189             break;\r
190     }\r
191 \r
192     // now mod and print, then divide divisor\r
193     do\r
194     {\r
195         UNITY_OUTPUT_CHAR((char)('0' + (number / divisor % 10)));\r
196         divisor /= 10;\r
197     }\r
198     while (divisor > 0);\r
199 }\r
200 \r
201 //-----------------------------------------------\r
202 void UnityPrintNumberHex(const _U_UINT number, const char nibbles_to_print)\r
203 {\r
204     _U_UINT nibble;\r
205     char nibbles = nibbles_to_print;\r
206     UNITY_OUTPUT_CHAR('0');\r
207     UNITY_OUTPUT_CHAR('x');\r
208 \r
209     while (nibbles > 0)\r
210     {\r
211         nibble = (number >> (--nibbles << 2)) & 0x0000000F;\r
212         if (nibble <= 9)\r
213         {\r
214             UNITY_OUTPUT_CHAR((char)('0' + nibble));\r
215         }\r
216         else\r
217         {\r
218             UNITY_OUTPUT_CHAR((char)('A' - 10 + nibble));\r
219         }\r
220     }\r
221 }\r
222 \r
223 //-----------------------------------------------\r
224 void UnityPrintMask(const _U_UINT mask, const _U_UINT number)\r
225 {\r
226     _U_UINT current_bit = (_U_UINT)1 << (UNITY_INT_WIDTH - 1);\r
227     _US32 i;\r
228 \r
229     for (i = 0; i < UNITY_INT_WIDTH; i++)\r
230     {\r
231         if (current_bit & mask)\r
232         {\r
233             if (current_bit & number)\r
234             {\r
235                 UNITY_OUTPUT_CHAR('1');\r
236             }\r
237             else\r
238             {\r
239                 UNITY_OUTPUT_CHAR('0');\r
240             }\r
241         }\r
242         else\r
243         {\r
244             UNITY_OUTPUT_CHAR('X');\r
245         }\r
246         current_bit = current_bit >> 1;\r
247     }\r
248 }\r
249 \r
250 //-----------------------------------------------\r
251 #ifdef UNITY_FLOAT_VERBOSE\r
252 #include <string.h>\r
253 void UnityPrintFloat(_UF number)\r
254 {\r
255     char TempBuffer[32];\r
256     sprintf(TempBuffer, "%.6f", number);\r
257     UnityPrint(TempBuffer);\r
258 }\r
259 #endif\r
260 \r
261 //-----------------------------------------------\r
262 \r
263 void UnityPrintFail(void)\r
264 {\r
265     UnityPrint(UnityStrFail);\r
266 }\r
267 \r
268 void UnityPrintOk(void)\r
269 {\r
270     UnityPrint(UnityStrOk);\r
271 }\r
272 \r
273 //-----------------------------------------------\r
274 void UnityTestResultsBegin(const char* file, const UNITY_LINE_TYPE line)\r
275 {\r
276     UNITY_PRINT_EOL;\r
277     UnityPrint(file);\r
278     UNITY_OUTPUT_CHAR(':');\r
279     UnityPrintNumber((_U_SINT)line);\r
280     UNITY_OUTPUT_CHAR(':');\r
281     UnityPrint(Unity.CurrentTestName);\r
282     UNITY_OUTPUT_CHAR(':');\r
283 }\r
284 \r
285 //-----------------------------------------------\r
286 void UnityTestResultsFailBegin(const UNITY_LINE_TYPE line)\r
287 {\r
288     UnityTestResultsBegin(Unity.TestFile, line);\r
289     UnityPrint(UnityStrFail);\r
290     UNITY_OUTPUT_CHAR(':');\r
291 }\r
292 \r
293 //-----------------------------------------------\r
294 void UnityConcludeTest(void)\r
295 {\r
296     if (Unity.CurrentTestIgnored)\r
297     {\r
298         Unity.TestIgnores++;\r
299     }\r
300     else if (!Unity.CurrentTestFailed)\r
301     {\r
302         UnityTestResultsBegin(Unity.TestFile, Unity.CurrentTestLineNumber);\r
303         UnityPrint(UnityStrPass);\r
304     }\r
305     else\r
306     {\r
307         Unity.TestFailures++;\r
308     }\r
309 \r
310     Unity.CurrentTestFailed = 0;\r
311     Unity.CurrentTestIgnored = 0;\r
312 }\r
313 \r
314 //-----------------------------------------------\r
315 void UnityAddMsgIfSpecified(const char* msg)\r
316 {\r
317     if (msg)\r
318     {\r
319         UnityPrint(UnityStrSpacer);\r
320         UnityPrint(msg);\r
321     }\r
322 }\r
323 \r
324 //-----------------------------------------------\r
325 void UnityPrintExpectedAndActualStrings(const char* expected, const char* actual)\r
326 {\r
327     UnityPrint(UnityStrExpected);\r
328     if (expected != NULL)\r
329     {\r
330         UNITY_OUTPUT_CHAR('\'');\r
331         UnityPrint(expected);\r
332         UNITY_OUTPUT_CHAR('\'');\r
333     }\r
334     else\r
335     {\r
336       UnityPrint(UnityStrNull);\r
337     }\r
338     UnityPrint(UnityStrWas);\r
339     if (actual != NULL)\r
340     {\r
341         UNITY_OUTPUT_CHAR('\'');\r
342         UnityPrint(actual);\r
343         UNITY_OUTPUT_CHAR('\'');\r
344     }\r
345     else\r
346     {\r
347       UnityPrint(UnityStrNull);\r
348     }\r
349 }\r
350 \r
351 //-----------------------------------------------\r
352 // Assertion & Control Helpers\r
353 //-----------------------------------------------\r
354 \r
355 int UnityCheckArraysForNull(UNITY_PTR_ATTRIBUTE const void* expected, UNITY_PTR_ATTRIBUTE const void* actual, const UNITY_LINE_TYPE lineNumber, const char* msg)\r
356 {\r
357     //return true if they are both NULL\r
358     if ((expected == NULL) && (actual == NULL))\r
359         return 1;\r
360 \r
361     //throw error if just expected is NULL\r
362     if (expected == NULL)\r
363     {\r
364         UnityTestResultsFailBegin(lineNumber);\r
365         UnityPrint(UnityStrNullPointerForExpected);\r
366         UnityAddMsgIfSpecified(msg);\r
367         UNITY_FAIL_AND_BAIL;\r
368     }\r
369 \r
370     //throw error if just actual is NULL\r
371     if (actual == NULL)\r
372     {\r
373         UnityTestResultsFailBegin(lineNumber);\r
374         UnityPrint(UnityStrNullPointerForActual);\r
375         UnityAddMsgIfSpecified(msg);\r
376         UNITY_FAIL_AND_BAIL;\r
377     }\r
378 \r
379     //return false if neither is NULL\r
380     return 0;\r
381 }\r
382 \r
383 //-----------------------------------------------\r
384 // Assertion Functions\r
385 //-----------------------------------------------\r
386 \r
387 void UnityAssertBits(const _U_SINT mask,\r
388                      const _U_SINT expected,\r
389                      const _U_SINT actual,\r
390                      const char* msg,\r
391                      const UNITY_LINE_TYPE lineNumber)\r
392 {\r
393     UNITY_SKIP_EXECUTION;\r
394 \r
395     if ((mask & expected) != (mask & actual))\r
396     {\r
397         UnityTestResultsFailBegin(lineNumber);\r
398         UnityPrint(UnityStrExpected);\r
399         UnityPrintMask((_U_UINT)mask, (_U_UINT)expected);\r
400         UnityPrint(UnityStrWas);\r
401         UnityPrintMask((_U_UINT)mask, (_U_UINT)actual);\r
402         UnityAddMsgIfSpecified(msg);\r
403         UNITY_FAIL_AND_BAIL;\r
404     }\r
405 }\r
406 \r
407 //-----------------------------------------------\r
408 void UnityAssertEqualNumber(const _U_SINT expected,\r
409                             const _U_SINT actual,\r
410                             const char* msg,\r
411                             const UNITY_LINE_TYPE lineNumber,\r
412                             const UNITY_DISPLAY_STYLE_T style)\r
413 {\r
414     UNITY_SKIP_EXECUTION;\r
415 \r
416     if (expected != actual)\r
417     {\r
418         UnityTestResultsFailBegin(lineNumber);\r
419         UnityPrint(UnityStrExpected);\r
420         UnityPrintNumberByStyle(expected, style);\r
421         UnityPrint(UnityStrWas);\r
422         UnityPrintNumberByStyle(actual, style);\r
423         UnityAddMsgIfSpecified(msg);\r
424         UNITY_FAIL_AND_BAIL;\r
425     }\r
426 }\r
427 \r
428 //-----------------------------------------------\r
429 void UnityAssertEqualIntArray(UNITY_PTR_ATTRIBUTE const void* expected,\r
430                               UNITY_PTR_ATTRIBUTE const void* actual,\r
431                               const _UU32 num_elements,\r
432                               const char* msg,\r
433                               const UNITY_LINE_TYPE lineNumber,\r
434                               const UNITY_DISPLAY_STYLE_T style)\r
435 {\r
436     _UU32 elements = num_elements;\r
437     UNITY_PTR_ATTRIBUTE const _US8* ptr_exp = (UNITY_PTR_ATTRIBUTE const _US8*)expected;\r
438     UNITY_PTR_ATTRIBUTE const _US8* ptr_act = (UNITY_PTR_ATTRIBUTE const _US8*)actual;\r
439 \r
440     UNITY_SKIP_EXECUTION;\r
441 \r
442     if (elements == 0)\r
443     {\r
444         UnityTestResultsFailBegin(lineNumber);\r
445         UnityPrint(UnityStrPointless);\r
446         UnityAddMsgIfSpecified(msg);\r
447         UNITY_FAIL_AND_BAIL;\r
448     }\r
449 \r
450     if (UnityCheckArraysForNull((UNITY_PTR_ATTRIBUTE const void*)expected, (UNITY_PTR_ATTRIBUTE const void*)actual, lineNumber, msg) == 1)\r
451         return;\r
452 \r
453     // If style is UNITY_DISPLAY_STYLE_INT, we'll fall into the default case rather than the INT16 or INT32 (etc) case\r
454     // as UNITY_DISPLAY_STYLE_INT includes a flag for UNITY_DISPLAY_RANGE_AUTO, which the width-specific\r
455     // variants do not. Therefore remove this flag.\r
456     switch(style & (UNITY_DISPLAY_STYLE_T)(~UNITY_DISPLAY_RANGE_AUTO))\r
457     {\r
458         case UNITY_DISPLAY_STYLE_HEX8:\r
459         case UNITY_DISPLAY_STYLE_INT8:\r
460         case UNITY_DISPLAY_STYLE_UINT8:\r
461             while (elements--)\r
462             {\r
463                 if (*ptr_exp != *ptr_act)\r
464                 {\r
465                     UnityTestResultsFailBegin(lineNumber);\r
466                     UnityPrint(UnityStrElement);\r
467                     UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT);\r
468                     UnityPrint(UnityStrExpected);\r
469                     UnityPrintNumberByStyle(*ptr_exp, style);\r
470                     UnityPrint(UnityStrWas);\r
471                     UnityPrintNumberByStyle(*ptr_act, style);\r
472                     UnityAddMsgIfSpecified(msg);\r
473                     UNITY_FAIL_AND_BAIL;\r
474                 }\r
475                 ptr_exp += 1;\r
476                 ptr_act += 1;\r
477             }\r
478             break;\r
479         case UNITY_DISPLAY_STYLE_HEX16:\r
480         case UNITY_DISPLAY_STYLE_INT16:\r
481         case UNITY_DISPLAY_STYLE_UINT16:\r
482             while (elements--)\r
483             {\r
484                 if (*(UNITY_PTR_ATTRIBUTE const _US16*)ptr_exp != *(UNITY_PTR_ATTRIBUTE const _US16*)ptr_act)\r
485                 {\r
486                     UnityTestResultsFailBegin(lineNumber);\r
487                     UnityPrint(UnityStrElement);\r
488                     UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT);\r
489                     UnityPrint(UnityStrExpected);\r
490                     UnityPrintNumberByStyle(*(UNITY_PTR_ATTRIBUTE const _US16*)ptr_exp, style);\r
491                     UnityPrint(UnityStrWas);\r
492                     UnityPrintNumberByStyle(*(UNITY_PTR_ATTRIBUTE const _US16*)ptr_act, style);\r
493                     UnityAddMsgIfSpecified(msg);\r
494                     UNITY_FAIL_AND_BAIL;\r
495                 }\r
496                 ptr_exp += 2;\r
497                 ptr_act += 2;\r
498             }\r
499             break;\r
500 #ifdef UNITY_SUPPORT_64\r
501         case UNITY_DISPLAY_STYLE_HEX64:\r
502         case UNITY_DISPLAY_STYLE_INT64:\r
503         case UNITY_DISPLAY_STYLE_UINT64:\r
504             while (elements--)\r
505             {\r
506                 if (*(UNITY_PTR_ATTRIBUTE const _US64*)ptr_exp != *(UNITY_PTR_ATTRIBUTE const _US64*)ptr_act)\r
507                 {\r
508                     UnityTestResultsFailBegin(lineNumber);\r
509                     UnityPrint(UnityStrElement);\r
510                     UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT);\r
511                     UnityPrint(UnityStrExpected);\r
512                     UnityPrintNumberByStyle(*(UNITY_PTR_ATTRIBUTE const _US64*)ptr_exp, style);\r
513                     UnityPrint(UnityStrWas);\r
514                     UnityPrintNumberByStyle(*(UNITY_PTR_ATTRIBUTE const _US64*)ptr_act, style);\r
515                     UnityAddMsgIfSpecified(msg);\r
516                     UNITY_FAIL_AND_BAIL;\r
517                 }\r
518                 ptr_exp += 8;\r
519                 ptr_act += 8;\r
520             }\r
521             break;\r
522 #endif\r
523         default:\r
524             while (elements--)\r
525             {\r
526                 if (*(UNITY_PTR_ATTRIBUTE const _US32*)ptr_exp != *(UNITY_PTR_ATTRIBUTE const _US32*)ptr_act)\r
527                 {\r
528                     UnityTestResultsFailBegin(lineNumber);\r
529                     UnityPrint(UnityStrElement);\r
530                     UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT);\r
531                     UnityPrint(UnityStrExpected);\r
532                     UnityPrintNumberByStyle(*(UNITY_PTR_ATTRIBUTE const _US32*)ptr_exp, style);\r
533                     UnityPrint(UnityStrWas);\r
534                     UnityPrintNumberByStyle(*(UNITY_PTR_ATTRIBUTE const _US32*)ptr_act, style);\r
535                     UnityAddMsgIfSpecified(msg);\r
536                     UNITY_FAIL_AND_BAIL;\r
537                 }\r
538                 ptr_exp += 4;\r
539                 ptr_act += 4;\r
540             }\r
541             break;\r
542     }\r
543 }\r
544 \r
545 //-----------------------------------------------\r
546 #ifndef UNITY_EXCLUDE_FLOAT\r
547 void UnityAssertEqualFloatArray(UNITY_PTR_ATTRIBUTE const _UF* expected,\r
548                                 UNITY_PTR_ATTRIBUTE const _UF* actual,\r
549                                 const _UU32 num_elements,\r
550                                 const char* msg,\r
551                                 const UNITY_LINE_TYPE lineNumber)\r
552 {\r
553     _UU32 elements = num_elements;\r
554     UNITY_PTR_ATTRIBUTE const _UF* ptr_expected = expected;\r
555     UNITY_PTR_ATTRIBUTE const _UF* ptr_actual = actual;\r
556     _UF diff, tol;\r
557 \r
558     UNITY_SKIP_EXECUTION;\r
559 \r
560     if (elements == 0)\r
561     {\r
562         UnityTestResultsFailBegin(lineNumber);\r
563         UnityPrint(UnityStrPointless);\r
564         UnityAddMsgIfSpecified(msg);\r
565         UNITY_FAIL_AND_BAIL;\r
566     }\r
567 \r
568     if (UnityCheckArraysForNull((UNITY_PTR_ATTRIBUTE const void*)expected, (UNITY_PTR_ATTRIBUTE const void*)actual, lineNumber, msg) == 1)\r
569         return;\r
570 \r
571     while (elements--)\r
572     {\r
573         diff = *ptr_expected - *ptr_actual;\r
574         if (diff < 0.0f)\r
575           diff = 0.0f - diff;\r
576         tol = UNITY_FLOAT_PRECISION * *ptr_expected;\r
577         if (tol < 0.0f)\r
578             tol = 0.0f - tol;\r
579 \r
580         //This first part of this condition will catch any NaN or Infinite values\r
581         if ((diff * 0.0f != 0.0f) || (diff > tol))\r
582         {\r
583             UnityTestResultsFailBegin(lineNumber);\r
584             UnityPrint(UnityStrElement);\r
585             UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT);\r
586 #ifdef UNITY_FLOAT_VERBOSE\r
587             UnityPrint(UnityStrExpected);\r
588             UnityPrintFloat(*ptr_expected);\r
589             UnityPrint(UnityStrWas);\r
590             UnityPrintFloat(*ptr_actual);\r
591 #else\r
592             UnityPrint(UnityStrDelta);\r
593 #endif\r
594             UnityAddMsgIfSpecified(msg);\r
595             UNITY_FAIL_AND_BAIL;\r
596         }\r
597         ptr_expected++;\r
598         ptr_actual++;\r
599     }\r
600 }\r
601 \r
602 //-----------------------------------------------\r
603 void UnityAssertFloatsWithin(const _UF delta,\r
604                              const _UF expected,\r
605                              const _UF actual,\r
606                              const char* msg,\r
607                              const UNITY_LINE_TYPE lineNumber)\r
608 {\r
609     _UF diff = actual - expected;\r
610     _UF pos_delta = delta;\r
611 \r
612     UNITY_SKIP_EXECUTION;\r
613 \r
614     if (diff < 0.0f)\r
615     {\r
616         diff = 0.0f - diff;\r
617     }\r
618     if (pos_delta < 0.0f)\r
619     {\r
620         pos_delta = 0.0f - pos_delta;\r
621     }\r
622 \r
623     //This first part of this condition will catch any NaN or Infinite values\r
624     if ((diff * 0.0f != 0.0f) || (pos_delta < diff))\r
625     {\r
626         UnityTestResultsFailBegin(lineNumber);\r
627 #ifdef UNITY_FLOAT_VERBOSE\r
628         UnityPrint(UnityStrExpected);\r
629         UnityPrintFloat(expected);\r
630         UnityPrint(UnityStrWas);\r
631         UnityPrintFloat(actual);\r
632 #else\r
633         UnityPrint(UnityStrDelta);\r
634 #endif\r
635         UnityAddMsgIfSpecified(msg);\r
636         UNITY_FAIL_AND_BAIL;\r
637     }\r
638 }\r
639 \r
640 //-----------------------------------------------\r
641 void UnityAssertFloatSpecial(const _UF actual,\r
642                              const char* msg,\r
643                              const UNITY_LINE_TYPE lineNumber,\r
644                              const UNITY_FLOAT_TRAIT_T style)\r
645 {\r
646     UNITY_SKIP_EXECUTION;\r
647 \r
648     const char* trait_names[] = { UnityStrInf, UnityStrNegInf, UnityStrNaN, UnityStrDet };\r
649     _U_SINT should_be_trait   = ((_U_SINT)style & 1);\r
650     _U_SINT is_trait          = !should_be_trait;\r
651     _U_SINT trait_index       = style >> 1;\r
652 \r
653     switch(style)\r
654     {\r
655         //To determine Inf / Neg Inf, we compare to an Inf / Neg Inf value we create on the fly\r
656         //We are using a variable to hold the zero value because some compilers complain about dividing by zero otherwise\r
657         case UNITY_FLOAT_IS_INF:\r
658         case UNITY_FLOAT_IS_NOT_INF:\r
659             is_trait = ((1.0f / f_zero) == actual) ? 1 : 0;\r
660             break;\r
661         case UNITY_FLOAT_IS_NEG_INF:\r
662         case UNITY_FLOAT_IS_NOT_NEG_INF:\r
663             is_trait = ((-1.0f / f_zero) == actual) ? 1 : 0;\r
664             break;\r
665 \r
666         //NaN is the only floating point value that does NOT equal itself. Therefore if Actual == Actual, then it is NOT NaN.\r
667         case UNITY_FLOAT_IS_NAN:\r
668         case UNITY_FLOAT_IS_NOT_NAN:\r
669             is_trait = (actual == actual) ? 0 : 1;\r
670             break;\r
671 \r
672         //A determinate number is non infinite and not NaN. (therefore the opposite of the two above)\r
673         case UNITY_FLOAT_IS_DET:\r
674         case UNITY_FLOAT_IS_NOT_DET:\r
675             if ( (actual != actual) || ((1.0f / f_zero) == actual) || ((-1.0f / f_zero) == actual) )\r
676                 is_trait = 0;\r
677             else\r
678                 is_trait = 1;\r
679             break;\r
680     }\r
681 \r
682     if (is_trait != should_be_trait)\r
683     {\r
684         UnityTestResultsFailBegin(lineNumber);\r
685         UnityPrint(UnityStrExpected);\r
686         if (!should_be_trait)\r
687             UnityPrint(UnityStrNot);\r
688         UnityPrint(trait_names[trait_index]);\r
689         UnityPrint(UnityStrWas);\r
690 #ifdef UNITY_FLOAT_VERBOSE\r
691         UnityPrintFloat(actual);\r
692 #else\r
693         if (should_be_trait)\r
694             UnityPrint(UnityStrNot);\r
695         UnityPrint(trait_names[trait_index]);\r
696 #endif\r
697         UnityAddMsgIfSpecified(msg);\r
698         UNITY_FAIL_AND_BAIL;\r
699     }\r
700 }\r
701 \r
702 #endif //not UNITY_EXCLUDE_FLOAT\r
703 \r
704 //-----------------------------------------------\r
705 #ifndef UNITY_EXCLUDE_DOUBLE\r
706 void UnityAssertEqualDoubleArray(UNITY_PTR_ATTRIBUTE const _UD* expected,\r
707                                  UNITY_PTR_ATTRIBUTE const _UD* actual,\r
708                                  const _UU32 num_elements,\r
709                                  const char* msg,\r
710                                  const UNITY_LINE_TYPE lineNumber)\r
711 {\r
712     _UU32 elements = num_elements;\r
713     UNITY_PTR_ATTRIBUTE const _UD* ptr_expected = expected;\r
714     UNITY_PTR_ATTRIBUTE const _UD* ptr_actual = actual;\r
715     _UD diff, tol;\r
716 \r
717     UNITY_SKIP_EXECUTION;\r
718 \r
719     if (elements == 0)\r
720     {\r
721         UnityTestResultsFailBegin(lineNumber);\r
722         UnityPrint(UnityStrPointless);\r
723         UnityAddMsgIfSpecified(msg);\r
724         UNITY_FAIL_AND_BAIL;\r
725     }\r
726 \r
727     if (UnityCheckArraysForNull((UNITY_PTR_ATTRIBUTE void*)expected, (UNITY_PTR_ATTRIBUTE void*)actual, lineNumber, msg) == 1)\r
728         return;\r
729 \r
730     while (elements--)\r
731     {\r
732         diff = *ptr_expected - *ptr_actual;\r
733         if (diff < 0.0)\r
734           diff = 0.0 - diff;\r
735         tol = UNITY_DOUBLE_PRECISION * *ptr_expected;\r
736         if (tol < 0.0)\r
737             tol = 0.0 - tol;\r
738 \r
739         //This first part of this condition will catch any NaN or Infinite values\r
740         if ((diff * 0.0 != 0.0) || (diff > tol))\r
741         {\r
742             UnityTestResultsFailBegin(lineNumber);\r
743             UnityPrint(UnityStrElement);\r
744             UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT);\r
745 #ifdef UNITY_DOUBLE_VERBOSE\r
746             UnityPrint(UnityStrExpected);\r
747             UnityPrintFloat((float)(*ptr_expected));\r
748             UnityPrint(UnityStrWas);\r
749             UnityPrintFloat((float)(*ptr_actual));\r
750 #else\r
751             UnityPrint(UnityStrDelta);\r
752 #endif\r
753             UnityAddMsgIfSpecified(msg);\r
754             UNITY_FAIL_AND_BAIL;\r
755         }\r
756         ptr_expected++;\r
757         ptr_actual++;\r
758     }\r
759 }\r
760 \r
761 //-----------------------------------------------\r
762 void UnityAssertDoublesWithin(const _UD delta,\r
763                               const _UD expected,\r
764                               const _UD actual,\r
765                               const char* msg,\r
766                               const UNITY_LINE_TYPE lineNumber)\r
767 {\r
768     _UD diff = actual - expected;\r
769     _UD pos_delta = delta;\r
770 \r
771     UNITY_SKIP_EXECUTION;\r
772 \r
773     if (diff < 0.0)\r
774     {\r
775         diff = 0.0 - diff;\r
776     }\r
777     if (pos_delta < 0.0)\r
778     {\r
779         pos_delta = 0.0 - pos_delta;\r
780     }\r
781 \r
782     //This first part of this condition will catch any NaN or Infinite values\r
783     if ((diff * 0.0 != 0.0) || (pos_delta < diff))\r
784     {\r
785         UnityTestResultsFailBegin(lineNumber);\r
786 #ifdef UNITY_DOUBLE_VERBOSE\r
787         UnityPrint(UnityStrExpected);\r
788         UnityPrintFloat((float)expected);\r
789         UnityPrint(UnityStrWas);\r
790         UnityPrintFloat((float)actual);\r
791 #else\r
792         UnityPrint(UnityStrDelta);\r
793 #endif\r
794         UnityAddMsgIfSpecified(msg);\r
795         UNITY_FAIL_AND_BAIL;\r
796     }\r
797 }\r
798 \r
799 //-----------------------------------------------\r
800 \r
801 void UnityAssertDoubleSpecial(const _UD actual,\r
802                               const char* msg,\r
803                               const UNITY_LINE_TYPE lineNumber,\r
804                               const UNITY_FLOAT_TRAIT_T style)\r
805 {\r
806     UNITY_SKIP_EXECUTION;\r
807 \r
808     const char* trait_names[] = { UnityStrInf, UnityStrNegInf, UnityStrNaN, UnityStrDet };\r
809     _U_SINT should_be_trait   = ((_U_SINT)style & 1);\r
810     _U_SINT is_trait          = !should_be_trait;\r
811     _U_SINT trait_index       = style >> 1;\r
812 \r
813     switch(style)\r
814     {\r
815         //To determine Inf / Neg Inf, we compare to an Inf / Neg Inf value we create on the fly\r
816         //We are using a variable to hold the zero value because some compilers complain about dividing by zero otherwise\r
817         case UNITY_FLOAT_IS_INF:\r
818         case UNITY_FLOAT_IS_NOT_INF:\r
819             is_trait = ((1.0 / d_zero) == actual) ? 1 : 0;\r
820             break;\r
821         case UNITY_FLOAT_IS_NEG_INF:\r
822         case UNITY_FLOAT_IS_NOT_NEG_INF:\r
823             is_trait = ((-1.0 / d_zero) == actual) ? 1 : 0;\r
824             break;\r
825 \r
826         //NaN is the only floating point value that does NOT equal itself. Therefore if Actual == Actual, then it is NOT NaN.\r
827         case UNITY_FLOAT_IS_NAN:\r
828         case UNITY_FLOAT_IS_NOT_NAN:\r
829             is_trait = (actual == actual) ? 0 : 1;\r
830             break;\r
831 \r
832         //A determinate number is non infinite and not NaN. (therefore the opposite of the two above)\r
833         case UNITY_FLOAT_IS_DET:\r
834         case UNITY_FLOAT_IS_NOT_DET:\r
835             if ( (actual != actual) || ((1.0 / d_zero) == actual) || ((-1.0 / d_zero) == actual) )\r
836                 is_trait = 0;\r
837             else\r
838                 is_trait = 1;\r
839             break;\r
840     }\r
841 \r
842     if (is_trait != should_be_trait)\r
843     {\r
844         UnityTestResultsFailBegin(lineNumber);\r
845         UnityPrint(UnityStrExpected);\r
846         if (!should_be_trait)\r
847             UnityPrint(UnityStrNot);\r
848         UnityPrint(trait_names[trait_index]);\r
849         UnityPrint(UnityStrWas);\r
850 #ifdef UNITY_DOUBLE_VERBOSE\r
851         UnityPrintFloat(actual);\r
852 #else\r
853         if (should_be_trait)\r
854             UnityPrint(UnityStrNot);\r
855         UnityPrint(trait_names[trait_index]);\r
856 #endif\r
857         UnityAddMsgIfSpecified(msg);\r
858         UNITY_FAIL_AND_BAIL;\r
859     }\r
860 }\r
861 \r
862 \r
863 #endif // not UNITY_EXCLUDE_DOUBLE\r
864 \r
865 //-----------------------------------------------\r
866 void UnityAssertNumbersWithin( const _U_SINT delta,\r
867                                const _U_SINT expected,\r
868                                const _U_SINT actual,\r
869                                const char* msg,\r
870                                const UNITY_LINE_TYPE lineNumber,\r
871                                const UNITY_DISPLAY_STYLE_T style)\r
872 {\r
873     UNITY_SKIP_EXECUTION;\r
874 \r
875     if ((style & UNITY_DISPLAY_RANGE_INT) == UNITY_DISPLAY_RANGE_INT)\r
876     {\r
877         if (actual > expected)\r
878           Unity.CurrentTestFailed = ((actual - expected) > delta);\r
879         else\r
880           Unity.CurrentTestFailed = ((expected - actual) > delta);\r
881     }\r
882     else\r
883     {\r
884         if ((_U_UINT)actual > (_U_UINT)expected)\r
885             Unity.CurrentTestFailed = ((_U_UINT)(actual - expected) > (_U_UINT)delta);\r
886         else\r
887             Unity.CurrentTestFailed = ((_U_UINT)(expected - actual) > (_U_UINT)delta);\r
888     }\r
889 \r
890     if (Unity.CurrentTestFailed)\r
891     {\r
892         UnityTestResultsFailBegin(lineNumber);\r
893         UnityPrint(UnityStrDelta);\r
894         UnityPrintNumberByStyle(delta, style);\r
895         UnityPrint(UnityStrExpected);\r
896         UnityPrintNumberByStyle(expected, style);\r
897         UnityPrint(UnityStrWas);\r
898         UnityPrintNumberByStyle(actual, style);\r
899         UnityAddMsgIfSpecified(msg);\r
900         UNITY_FAIL_AND_BAIL;\r
901     }\r
902 }\r
903 \r
904 //-----------------------------------------------\r
905 void UnityAssertEqualString(const char* expected,\r
906                             const char* actual,\r
907                             const char* msg,\r
908                             const UNITY_LINE_TYPE lineNumber)\r
909 {\r
910     _UU32 i;\r
911 \r
912     UNITY_SKIP_EXECUTION;\r
913 \r
914     // if both pointers not null compare the strings\r
915     if (expected && actual)\r
916     {\r
917         for (i = 0; expected[i] || actual[i]; i++)\r
918         {\r
919             if (expected[i] != actual[i])\r
920             {\r
921                 Unity.CurrentTestFailed = 1;\r
922                 break;\r
923             }\r
924         }\r
925     }\r
926     else\r
927     { // handle case of one pointers being null (if both null, test should pass)\r
928         if (expected != actual)\r
929         {\r
930             Unity.CurrentTestFailed = 1;\r
931         }\r
932     }\r
933 \r
934     if (Unity.CurrentTestFailed)\r
935     {\r
936       UnityTestResultsFailBegin(lineNumber);\r
937       UnityPrintExpectedAndActualStrings(expected, actual);\r
938       UnityAddMsgIfSpecified(msg);\r
939       UNITY_FAIL_AND_BAIL;\r
940     }\r
941 }\r
942 \r
943 //-----------------------------------------------\r
944 void UnityAssertEqualStringArray( const char** expected,\r
945                                   const char** actual,\r
946                                   const _UU32 num_elements,\r
947                                   const char* msg,\r
948                                   const UNITY_LINE_TYPE lineNumber)\r
949 {\r
950     _UU32 i, j = 0;\r
951 \r
952     UNITY_SKIP_EXECUTION;\r
953 \r
954     // if no elements, it's an error\r
955     if (num_elements == 0)\r
956     {\r
957         UnityTestResultsFailBegin(lineNumber);\r
958         UnityPrint(UnityStrPointless);\r
959         UnityAddMsgIfSpecified(msg);\r
960         UNITY_FAIL_AND_BAIL;\r
961     }\r
962 \r
963     if (UnityCheckArraysForNull((UNITY_PTR_ATTRIBUTE void*)expected, (UNITY_PTR_ATTRIBUTE void*)actual, lineNumber, msg) == 1)\r
964         return;\r
965 \r
966     do\r
967     {\r
968         // if both pointers not null compare the strings\r
969         if (expected[j] && actual[j])\r
970         {\r
971             for (i = 0; expected[j][i] || actual[j][i]; i++)\r
972             {\r
973                 if (expected[j][i] != actual[j][i])\r
974                 {\r
975                     Unity.CurrentTestFailed = 1;\r
976                     break;\r
977                 }\r
978             }\r
979         }\r
980         else\r
981         { // handle case of one pointers being null (if both null, test should pass)\r
982             if (expected[j] != actual[j])\r
983             {\r
984                 Unity.CurrentTestFailed = 1;\r
985             }\r
986         }\r
987 \r
988         if (Unity.CurrentTestFailed)\r
989         {\r
990             UnityTestResultsFailBegin(lineNumber);\r
991             if (num_elements > 1)\r
992             {\r
993                 UnityPrint(UnityStrElement);\r
994                 UnityPrintNumberByStyle((j), UNITY_DISPLAY_STYLE_UINT);\r
995             }\r
996             UnityPrintExpectedAndActualStrings((const char*)(expected[j]), (const char*)(actual[j]));\r
997             UnityAddMsgIfSpecified(msg);\r
998             UNITY_FAIL_AND_BAIL;\r
999         }\r
1000     } while (++j < num_elements);\r
1001 }\r
1002 \r
1003 //-----------------------------------------------\r
1004 void UnityAssertEqualMemory( UNITY_PTR_ATTRIBUTE const void* expected,\r
1005                              UNITY_PTR_ATTRIBUTE const void* actual,\r
1006                              const _UU32 length,\r
1007                              const _UU32 num_elements,\r
1008                              const char* msg,\r
1009                              const UNITY_LINE_TYPE lineNumber)\r
1010 {\r
1011     UNITY_PTR_ATTRIBUTE const unsigned char* ptr_exp = (UNITY_PTR_ATTRIBUTE const unsigned char*)expected;\r
1012     UNITY_PTR_ATTRIBUTE const unsigned char* ptr_act = (UNITY_PTR_ATTRIBUTE const unsigned char*)actual;\r
1013     _UU32 elements = num_elements;\r
1014     _UU32 bytes;\r
1015 \r
1016     UNITY_SKIP_EXECUTION;\r
1017 \r
1018     if ((elements == 0) || (length == 0))\r
1019     {\r
1020         UnityTestResultsFailBegin(lineNumber);\r
1021         UnityPrint(UnityStrPointless);\r
1022         UnityAddMsgIfSpecified(msg);\r
1023         UNITY_FAIL_AND_BAIL;\r
1024     }\r
1025 \r
1026     if (UnityCheckArraysForNull((UNITY_PTR_ATTRIBUTE const void*)expected, (UNITY_PTR_ATTRIBUTE const void*)actual, lineNumber, msg) == 1)\r
1027         return;\r
1028 \r
1029     while (elements--)\r
1030     {\r
1031         /////////////////////////////////////\r
1032         bytes = length;\r
1033         while (bytes--)\r
1034         {\r
1035             if (*ptr_exp != *ptr_act)\r
1036             {\r
1037                 UnityTestResultsFailBegin(lineNumber);\r
1038                 UnityPrint(UnityStrMemory);\r
1039                 if (num_elements > 1)\r
1040                 {\r
1041                     UnityPrint(UnityStrElement);\r
1042                     UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT);\r
1043                 }\r
1044                 UnityPrint(UnityStrByte);\r
1045                 UnityPrintNumberByStyle((length - bytes - 1), UNITY_DISPLAY_STYLE_UINT);\r
1046                 UnityPrint(UnityStrExpected);\r
1047                 UnityPrintNumberByStyle(*ptr_exp, UNITY_DISPLAY_STYLE_HEX8);\r
1048                 UnityPrint(UnityStrWas);\r
1049                 UnityPrintNumberByStyle(*ptr_act, UNITY_DISPLAY_STYLE_HEX8);\r
1050                 UnityAddMsgIfSpecified(msg);\r
1051                 UNITY_FAIL_AND_BAIL;\r
1052             }\r
1053             ptr_exp += 1;\r
1054             ptr_act += 1;\r
1055         }\r
1056         /////////////////////////////////////\r
1057 \r
1058     }\r
1059 }\r
1060 \r
1061 //-----------------------------------------------\r
1062 // Control Functions\r
1063 //-----------------------------------------------\r
1064 \r
1065 void UnityFail(const char* msg, const UNITY_LINE_TYPE line)\r
1066 {\r
1067     UNITY_SKIP_EXECUTION;\r
1068 \r
1069     UnityTestResultsBegin(Unity.TestFile, line);\r
1070     UnityPrintFail();\r
1071     if (msg != NULL)\r
1072     {\r
1073       UNITY_OUTPUT_CHAR(':');\r
1074       if (msg[0] != ' ')\r
1075       {\r
1076         UNITY_OUTPUT_CHAR(' ');\r
1077       }\r
1078       UnityPrint(msg);\r
1079     }\r
1080     UNITY_FAIL_AND_BAIL;\r
1081 }\r
1082 \r
1083 //-----------------------------------------------\r
1084 void UnityIgnore(const char* msg, const UNITY_LINE_TYPE line)\r
1085 {\r
1086     UNITY_SKIP_EXECUTION;\r
1087 \r
1088     UnityTestResultsBegin(Unity.TestFile, line);\r
1089     UnityPrint(UnityStrIgnore);\r
1090     if (msg != NULL)\r
1091     {\r
1092       UNITY_OUTPUT_CHAR(':');\r
1093       UNITY_OUTPUT_CHAR(' ');\r
1094       UnityPrint(msg);\r
1095     }\r
1096     UNITY_IGNORE_AND_BAIL;\r
1097 }\r
1098 \r
1099 //-----------------------------------------------\r
1100 #ifdef UNITY_SUPPORT_WEAK\r
1101 UNITY_WEAK void setUp(void) { }\r
1102 UNITY_WEAK void tearDown(void) { }\r
1103 #else\r
1104 void setUp(void);\r
1105 void tearDown(void);\r
1106 #endif\r
1107 //-----------------------------------------------\r
1108 void UnityDefaultTestRun(UnityTestFunction Func, const char* FuncName, const int FuncLineNum)\r
1109 {\r
1110     Unity.CurrentTestName = FuncName;\r
1111     Unity.CurrentTestLineNumber = (UNITY_LINE_TYPE)FuncLineNum;\r
1112     Unity.NumberOfTests++;\r
1113     if (TEST_PROTECT())\r
1114     {\r
1115         setUp();\r
1116         Func();\r
1117     }\r
1118     if (TEST_PROTECT() && !(Unity.CurrentTestIgnored))\r
1119     {\r
1120         tearDown();\r
1121     }\r
1122     UnityConcludeTest();\r
1123 }\r
1124 \r
1125 //-----------------------------------------------\r
1126 void UnityBegin(const char* filename)\r
1127 {\r
1128     Unity.TestFile = filename;\r
1129     Unity.CurrentTestName = NULL;\r
1130     Unity.CurrentTestLineNumber = 0;\r
1131     Unity.NumberOfTests = 0;\r
1132     Unity.TestFailures = 0;\r
1133     Unity.TestIgnores = 0;\r
1134     Unity.CurrentTestFailed = 0;\r
1135     Unity.CurrentTestIgnored = 0;\r
1136 \r
1137     UNITY_OUTPUT_START();\r
1138 }\r
1139 \r
1140 //-----------------------------------------------\r
1141 int UnityEnd(void)\r
1142 {\r
1143     UNITY_PRINT_EOL;\r
1144     UnityPrint(UnityStrBreaker);\r
1145     UNITY_PRINT_EOL;\r
1146     UnityPrintNumber((_U_SINT)(Unity.NumberOfTests));\r
1147     UnityPrint(UnityStrResultsTests);\r
1148     UnityPrintNumber((_U_SINT)(Unity.TestFailures));\r
1149     UnityPrint(UnityStrResultsFailures);\r
1150     UnityPrintNumber((_U_SINT)(Unity.TestIgnores));\r
1151     UnityPrint(UnityStrResultsIgnored);\r
1152     UNITY_PRINT_EOL;\r
1153     if (Unity.TestFailures == 0U)\r
1154     {\r
1155         UnityPrintOk();\r
1156     }\r
1157     else\r
1158     {\r
1159         UnityPrintFail();\r
1160     }\r
1161     UNITY_PRINT_EOL;\r
1162     UNITY_OUTPUT_COMPLETE();\r
1163     return (int)(Unity.TestFailures);\r
1164 }\r
1165 \r
1166 //-----------------------------------------------\r
1167 \r
1168 \r