Mistake on this page?
Report an issue in GitHub or email us
unity_internals.h
1 
2 /** \addtogroup frameworks */
3 /** @{*/
4 /* ==========================================
5  Unity Project - A Test Framework for C
6  Copyright (c) 2007-14 Mike Karlesky, Mark VanderVoord, Greg Williams
7  [Released under MIT License. Please refer to license.txt for details]
8 ========================================== */
9 
10 #ifndef UNITY_INTERNALS_H
11 #define UNITY_INTERNALS_H
12 
13 #ifdef UNITY_INCLUDE_CONFIG_H
14 #include "unity_config.h"
15 #endif
16 
17 #include <setjmp.h>
18 
19 /* Unity Attempts to Auto-Detect Integer Types
20  * Attempt 1: UINT_MAX, ULONG_MAX, etc in <stdint.h>
21  * Attempt 2: UINT_MAX, ULONG_MAX, etc in <limits.h>
22  * Attempt 3: Deduced from sizeof() macros */
23 #ifndef UNITY_EXCLUDE_STDINT_H
24 #include <stdint.h>
25 #endif
26 
27 #ifndef UNITY_EXCLUDE_LIMITS_H
28 #include <limits.h>
29 #endif
30 
31 #ifndef UNITY_EXCLUDE_SIZEOF
32 #ifndef UINT_MAX
33 #define UINT_MAX (sizeof(unsigned int) * 256 - 1)
34 #endif
35 #ifndef ULONG_MAX
36 #define ULONG_MAX (sizeof(unsigned long) * 256 - 1)
37 #endif
38 #ifndef UINTPTR_MAX
39 /* apparently this is not a constant expression: (sizeof(unsigned int *) * 256 - 1) so we have to just let this fall through */
40 #endif
41 #endif
42 
43 #ifndef UNITY_EXCLUDE_MATH_H
44 #include <math.h>
45 #endif
46 
47 /*-------------------------------------------------------
48  * Guess Widths If Not Specified
49  *-------------------------------------------------------*/
50 
51 /* Determine the size of an int, if not already specificied.
52  * We cannot use sizeof(int), because it is not yet defined
53  * at this stage in the trnslation of the C program.
54  * Therefore, infer it from UINT_MAX if possible. */
55 #ifndef UNITY_INT_WIDTH
56  #ifdef UINT_MAX
57  #if (UINT_MAX == 0xFFFF)
58  #define UNITY_INT_WIDTH (16)
59  #elif (UINT_MAX == 0xFFFFFFFF)
60  #define UNITY_INT_WIDTH (32)
61  #elif (UINT_MAX == 0xFFFFFFFFFFFFFFFF)
62  #define UNITY_INT_WIDTH (64)
63  #endif
64  #endif
65 #endif
66 #ifndef UNITY_INT_WIDTH
67  #define UNITY_INT_WIDTH (32)
68 #endif
69 
70 /* Determine the size of a long, if not already specified,
71  * by following the process used above to define
72  * UNITY_INT_WIDTH. */
73 #ifndef UNITY_LONG_WIDTH
74  #ifdef ULONG_MAX
75  #if (ULONG_MAX == 0xFFFF)
76  #define UNITY_LONG_WIDTH (16)
77  #elif (ULONG_MAX == 0xFFFFFFFF)
78  #define UNITY_LONG_WIDTH (32)
79  #elif (ULONG_MAX == 0xFFFFFFFFFFFFFFFF)
80  #define UNITY_LONG_WIDTH (64)
81  #endif
82  #endif
83 #endif
84 #ifndef UNITY_LONG_WIDTH
85  #define UNITY_LONG_WIDTH (32)
86 #endif
87 
88 /* Determine the size of a pointer, if not already specified,
89  * by following the process used above to define
90  * UNITY_INT_WIDTH. */
91 #ifndef UNITY_POINTER_WIDTH
92  #ifdef UINTPTR_MAX
93  #if (UINTPTR_MAX+0 <= 0xFFFF)
94  #define UNITY_POINTER_WIDTH (16)
95  #elif (UINTPTR_MAX+0 <= 0xFFFFFFFF)
96  #define UNITY_POINTER_WIDTH (32)
97  #elif (UINTPTR_MAX+0 <= 0xFFFFFFFFFFFFFFFF)
98  #define UNITY_POINTER_WIDTH (64)
99  #endif
100  #endif
101 #endif
102 #ifndef UNITY_POINTER_WIDTH
103  #ifdef INTPTR_MAX
104  #if (INTPTR_MAX+0 <= 0x7FFF)
105  #define UNITY_POINTER_WIDTH (16)
106  #elif (INTPTR_MAX+0 <= 0x7FFFFFFF)
107  #define UNITY_POINTER_WIDTH (32)
108  #elif (INTPTR_MAX+0 <= 0x7FFFFFFFFFFFFFFF)
109  #define UNITY_POINTER_WIDTH (64)
110  #endif
111  #endif
112 #endif
113 #ifndef UNITY_POINTER_WIDTH
114  #define UNITY_POINTER_WIDTH UNITY_LONG_WIDTH
115 #endif
116 
117 /*-------------------------------------------------------
118  * Int Support (Define types based on detected sizes)
119  *-------------------------------------------------------*/
120 
121 #if (UNITY_INT_WIDTH == 32)
122  typedef unsigned char _UU8;
123  typedef unsigned short _UU16;
124  typedef unsigned int _UU32;
125  typedef signed char _US8;
126  typedef signed short _US16;
127  typedef signed int _US32;
128 #elif (UNITY_INT_WIDTH == 16)
129  typedef unsigned char _UU8;
130  typedef unsigned int _UU16;
131  typedef unsigned long _UU32;
132  typedef signed char _US8;
133  typedef signed int _US16;
134  typedef signed long _US32;
135 #else
136  #error Invalid UNITY_INT_WIDTH specified! (16 or 32 are supported)
137 #endif
138 
139 /*-------------------------------------------------------
140  * 64-bit Support
141  *-------------------------------------------------------*/
142 
143 #ifndef UNITY_SUPPORT_64
144 #if UNITY_LONG_WIDTH > 32
145 #define UNITY_SUPPORT_64
146 #endif
147 #endif
148 #ifndef UNITY_SUPPORT_64
149 #if UNITY_POINTER_WIDTH > 32
150 #define UNITY_SUPPORT_64
151 #endif
152 #endif
153 
154 #ifndef UNITY_SUPPORT_64
155 
156 /* No 64-bit Support */
157 typedef _UU32 _U_UINT;
158 typedef _US32 _U_SINT;
159 
160 #else
161 
162 /* 64-bit Support */
163 #if (UNITY_LONG_WIDTH == 32)
164  typedef unsigned long long _UU64;
165  typedef signed long long _US64;
166 #elif (UNITY_LONG_WIDTH == 64)
167  typedef unsigned long _UU64;
168  typedef signed long _US64;
169 #else
170  #error Invalid UNITY_LONG_WIDTH specified! (32 or 64 are supported)
171 #endif
172 typedef _UU64 _U_UINT;
173 typedef _US64 _U_SINT;
174 
175 #endif
176 
177 /*-------------------------------------------------------
178  * Pointer Support
179  *-------------------------------------------------------*/
180 
181 #if (UNITY_POINTER_WIDTH == 32)
182  typedef _UU32 _UP;
183 #define UNITY_DISPLAY_STYLE_POINTER UNITY_DISPLAY_STYLE_HEX32
184 #elif (UNITY_POINTER_WIDTH == 64)
185  typedef _UU64 _UP;
186 #define UNITY_DISPLAY_STYLE_POINTER UNITY_DISPLAY_STYLE_HEX64
187 #elif (UNITY_POINTER_WIDTH == 16)
188  typedef _UU16 _UP;
189 #define UNITY_DISPLAY_STYLE_POINTER UNITY_DISPLAY_STYLE_HEX16
190 #else
191  #error Invalid UNITY_POINTER_WIDTH specified! (16, 32 or 64 are supported)
192 #endif
193 
194 #ifndef UNITY_PTR_ATTRIBUTE
195 #define UNITY_PTR_ATTRIBUTE
196 #endif
197 
198 #ifndef UNITY_INTERNAL_PTR
199 #define UNITY_INTERNAL_PTR UNITY_PTR_ATTRIBUTE const void*
200 /* #define UNITY_INTERNAL_PTR UNITY_PTR_ATTRIBUTE const _UU8* */
201 #endif
202 
203 /*-------------------------------------------------------
204  * Float Support
205  *-------------------------------------------------------*/
206 
207 #ifdef UNITY_EXCLUDE_FLOAT
208 
209 /* No Floating Point Support */
210 #undef UNITY_INCLUDE_FLOAT
211 #undef UNITY_FLOAT_PRECISION
212 #undef UNITY_FLOAT_TYPE
213 #undef UNITY_FLOAT_VERBOSE
214 
215 #else
216 
217 #ifndef UNITY_INCLUDE_FLOAT
218 #define UNITY_INCLUDE_FLOAT
219 #endif
220 
221 /* Floating Point Support */
222 #ifndef UNITY_FLOAT_PRECISION
223 #define UNITY_FLOAT_PRECISION (0.00001f)
224 #endif
225 #ifndef UNITY_FLOAT_TYPE
226 #define UNITY_FLOAT_TYPE float
227 #endif
228 typedef UNITY_FLOAT_TYPE _UF;
229 
230 #if !defined(__ARMCC_VERSION)
231 #ifndef isinf
232 #define isinf(n) (((1.0f / f_zero) == n) ? 1 : 0) || (((-1.0f / f_zero) == n) ? 1 : 0)
233 #define UNITY_FLOAT_NEEDS_ZERO
234 #endif
235 
236 #ifndef isnan
237 #define isnan(n) ((n != n) ? 1 : 0)
238 #endif
239 
240 #endif /* ARMC6 */
241 
242 #ifndef isneg
243 #define isneg(n) ((n < 0.0f) ? 1 : 0)
244 #endif
245 
246 #ifndef ispos
247 #define ispos(n) ((n > 0.0f) ? 1 : 0)
248 #endif
249 
250 #endif
251 
252 /*-------------------------------------------------------
253  * Double Float Support
254  *-------------------------------------------------------*/
255 
256 /* unlike FLOAT, we DON'T include by default */
257 #ifndef UNITY_EXCLUDE_DOUBLE
258 #ifndef UNITY_INCLUDE_DOUBLE
259 #define UNITY_EXCLUDE_DOUBLE
260 #endif
261 #endif
262 
263 #ifdef UNITY_EXCLUDE_DOUBLE
264 
265 /* No Floating Point Support */
266 #undef UNITY_DOUBLE_PRECISION
267 #undef UNITY_DOUBLE_TYPE
268 #undef UNITY_DOUBLE_VERBOSE
269 
270 #ifdef UNITY_INCLUDE_DOUBLE
271 #undef UNITY_INCLUDE_DOUBLE
272 #endif
273 
274 #else
275 
276 /* Double Floating Point Support */
277 #ifndef UNITY_DOUBLE_PRECISION
278 #define UNITY_DOUBLE_PRECISION (1e-12f)
279 #endif
280 #ifndef UNITY_DOUBLE_TYPE
281 #define UNITY_DOUBLE_TYPE double
282 #endif
283 typedef UNITY_DOUBLE_TYPE _UD;
284 
285 #endif
286 
287 #ifdef UNITY_DOUBLE_VERBOSE
288 #ifndef UNITY_FLOAT_VERBOSE
289 #define UNITY_FLOAT_VERBOSE
290 #endif
291 #endif
292 
293 /*-------------------------------------------------------
294  * Output Method: stdout (DEFAULT)
295  *-------------------------------------------------------*/
296 #ifndef UNITY_OUTPUT_CHAR
297 /* Default to using putchar, which is defined in stdio.h */
298 #include <stdio.h>
299 #define UNITY_OUTPUT_CHAR(a) (void)putchar(a)
300 #else
301  /* If defined as something else, make sure we declare it here so it's ready for use */
302  #ifndef UNITY_OMIT_OUTPUT_CHAR_HEADER_DECLARATION
303 extern void UNITY_OUTPUT_CHAR(int);
304  #endif
305 #endif
306 
307 #ifndef UNITY_OUTPUT_FLUSH
308 /* Default to using putchar, which is defined in stdio.h */
309 #include <stdio.h>
310 #define UNITY_OUTPUT_FLUSH() (void)fflush(stdout)
311 #else
312  /* If defined as something else, make sure we declare it here so it's ready for use */
313  #ifndef UNITY_OMIT_OUTPUT_FLUSH_HEADER_DECLARATION
314 extern void UNITY_OUTPUT_FLUSH(void);
315  #endif
316 #endif
317 
318 #ifndef UNITY_PRINT_EOL
319 #define UNITY_PRINT_EOL() UNITY_OUTPUT_CHAR('\n')
320 #endif
321 
322 #ifndef UNITY_OUTPUT_START
323 #define UNITY_OUTPUT_START()
324 #endif
325 
326 #ifndef UNITY_OUTPUT_COMPLETE
327 #define UNITY_OUTPUT_COMPLETE()
328 #endif
329 
330 /*-------------------------------------------------------
331  * Footprint
332  *-------------------------------------------------------*/
333 
334 #ifndef UNITY_LINE_TYPE
335 #define UNITY_LINE_TYPE _U_UINT
336 #endif
337 
338 #ifndef UNITY_COUNTER_TYPE
339 #define UNITY_COUNTER_TYPE _U_UINT
340 #endif
341 
342 /*-------------------------------------------------------
343  * Language Features Available
344  *-------------------------------------------------------*/
345 #if !defined(UNITY_WEAK_ATTRIBUTE) && !defined(UNITY_WEAK_PRAGMA)
346 # ifdef __GNUC__ /* includes clang */
347 # if !(defined(__WIN32__) && defined(__clang__))
348 # define UNITY_WEAK_ATTRIBUTE __attribute__((weak))
349 # endif
350 # endif
351 #endif
352 
353 #ifdef UNITY_NO_WEAK
354 # undef UNITY_WEAK_ATTRIBUTE
355 # undef UNITY_WEAK_PRAGMA
356 #endif
357 
358 
359 /*-------------------------------------------------------
360  * Internal Structs Needed
361  *-------------------------------------------------------*/
362 
363 typedef void (*UnityTestFunction)(void);
364 
365 #define UNITY_DISPLAY_RANGE_INT (0x10)
366 #define UNITY_DISPLAY_RANGE_UINT (0x20)
367 #define UNITY_DISPLAY_RANGE_HEX (0x40)
368 #define UNITY_DISPLAY_RANGE_AUTO (0x80)
369 
370 typedef enum
371 {
372 #if (UNITY_INT_WIDTH == 16)
373  UNITY_DISPLAY_STYLE_INT = 2 + UNITY_DISPLAY_RANGE_INT + UNITY_DISPLAY_RANGE_AUTO,
374 #elif (UNITY_INT_WIDTH == 32)
375  UNITY_DISPLAY_STYLE_INT = 4 + UNITY_DISPLAY_RANGE_INT + UNITY_DISPLAY_RANGE_AUTO,
376 #elif (UNITY_INT_WIDTH == 64)
377  UNITY_DISPLAY_STYLE_INT = 8 + UNITY_DISPLAY_RANGE_INT + UNITY_DISPLAY_RANGE_AUTO,
378 #endif
379  UNITY_DISPLAY_STYLE_INT8 = 1 + UNITY_DISPLAY_RANGE_INT,
380  UNITY_DISPLAY_STYLE_INT16 = 2 + UNITY_DISPLAY_RANGE_INT,
381  UNITY_DISPLAY_STYLE_INT32 = 4 + UNITY_DISPLAY_RANGE_INT,
382 #ifdef UNITY_SUPPORT_64
383  UNITY_DISPLAY_STYLE_INT64 = 8 + UNITY_DISPLAY_RANGE_INT,
384 #endif
385 
386 #if (UNITY_INT_WIDTH == 16)
387  UNITY_DISPLAY_STYLE_UINT = 2 + UNITY_DISPLAY_RANGE_UINT + UNITY_DISPLAY_RANGE_AUTO,
388 #elif (UNITY_INT_WIDTH == 32)
389  UNITY_DISPLAY_STYLE_UINT = 4 + UNITY_DISPLAY_RANGE_UINT + UNITY_DISPLAY_RANGE_AUTO,
390 #elif (UNITY_INT_WIDTH == 64)
391  UNITY_DISPLAY_STYLE_UINT = 8 + UNITY_DISPLAY_RANGE_UINT + UNITY_DISPLAY_RANGE_AUTO,
392 #endif
393  UNITY_DISPLAY_STYLE_UINT8 = 1 + UNITY_DISPLAY_RANGE_UINT,
394  UNITY_DISPLAY_STYLE_UINT16 = 2 + UNITY_DISPLAY_RANGE_UINT,
395  UNITY_DISPLAY_STYLE_UINT32 = 4 + UNITY_DISPLAY_RANGE_UINT,
396 #ifdef UNITY_SUPPORT_64
397  UNITY_DISPLAY_STYLE_UINT64 = 8 + UNITY_DISPLAY_RANGE_UINT,
398 #endif
399  UNITY_DISPLAY_STYLE_HEX8 = 1 + UNITY_DISPLAY_RANGE_HEX,
400  UNITY_DISPLAY_STYLE_HEX16 = 2 + UNITY_DISPLAY_RANGE_HEX,
401  UNITY_DISPLAY_STYLE_HEX32 = 4 + UNITY_DISPLAY_RANGE_HEX,
402 #ifdef UNITY_SUPPORT_64
403  UNITY_DISPLAY_STYLE_HEX64 = 8 + UNITY_DISPLAY_RANGE_HEX,
404 #endif
405  UNITY_DISPLAY_STYLE_UNKNOWN
406 } UNITY_DISPLAY_STYLE_T;
407 
408 #ifndef UNITY_EXCLUDE_FLOAT
409 typedef enum _UNITY_FLOAT_TRAIT_T
410 {
411  UNITY_FLOAT_IS_NOT_INF = 0,
412  UNITY_FLOAT_IS_INF,
413  UNITY_FLOAT_IS_NOT_NEG_INF,
414  UNITY_FLOAT_IS_NEG_INF,
415  UNITY_FLOAT_IS_NOT_NAN,
416  UNITY_FLOAT_IS_NAN,
417  UNITY_FLOAT_IS_NOT_DET,
418  UNITY_FLOAT_IS_DET,
419  UNITY_FLOAT_INVALID_TRAIT
420 } UNITY_FLOAT_TRAIT_T;
421 #endif
422 
423 struct _Unity
424 {
425  const char* TestFile;
426  const char* CurrentTestName;
427 #ifndef UNITY_EXCLUDE_DETAILS
428  const char* CurrentDetail1;
429  const char* CurrentDetail2;
430 #endif
431  UNITY_LINE_TYPE CurrentTestLineNumber;
432  UNITY_COUNTER_TYPE NumberOfTests;
433  UNITY_COUNTER_TYPE TestFailures;
434  UNITY_COUNTER_TYPE TestIgnores;
435  UNITY_COUNTER_TYPE CurrentTestFailed;
436  UNITY_COUNTER_TYPE CurrentTestIgnored;
437  jmp_buf AbortFrame;
438 };
439 
440 extern struct _Unity Unity;
441 
442 #ifdef __cplusplus
443 extern "C" {
444 #endif
445 
446 /*-------------------------------------------------------
447  * Test Suite Management
448  *-------------------------------------------------------*/
449 
450 
451 void UnityBegin(const char* filename);
452 int UnityEnd(void);
453 void UnityConcludeTest(void);
454 void UnityDefaultTestRun(UnityTestFunction Func, const char* FuncName, const int FuncLineNum);
455 
456 /*-------------------------------------------------------
457  * Details Support
458  *-------------------------------------------------------*/
459 
460 #ifdef UNITY_EXCLUDE_DETAILS
461 #define UNITY_CLR_DETAILS()
462 #define UNITY_SET_DETAIL(d1)
463 #define UNITY_SET_DETAILS(d1,d2)
464 #else
465 #define UNITY_CLR_DETAILS() { Unity.CurrentDetail1 = 0; Unity.CurrentDetail2 = 0; }
466 #define UNITY_SET_DETAIL(d1) { Unity.CurrentDetail1 = d1; Unity.CurrentDetail2 = 0; }
467 #define UNITY_SET_DETAILS(d1,d2) { Unity.CurrentDetail1 = d1; Unity.CurrentDetail2 = d2; }
468 
469 #ifndef UNITY_DETAIL1_NAME
470 #define UNITY_DETAIL1_NAME "Function"
471 #endif
472 
473 #ifndef UNITY_DETAIL2_NAME
474 #define UNITY_DETAIL2_NAME "Argument"
475 #endif
476 #endif
477 
478 /*-------------------------------------------------------
479  * Test Output
480  *-------------------------------------------------------*/
481 
482 void UnityPrint(const char* string);
483 void UnityPrintMask(const _U_UINT mask, const _U_UINT number);
484 void UnityPrintNumberByStyle(const _U_SINT number, const UNITY_DISPLAY_STYLE_T style);
485 void UnityPrintNumber(const _U_SINT number);
486 void UnityPrintNumberUnsigned(const _U_UINT number);
487 void UnityPrintNumberHex(const _U_UINT number, const char nibbles);
488 
489 #ifdef UNITY_FLOAT_VERBOSE
490 void UnityPrintFloat(const _UF number);
491 #endif
492 
493 /*-------------------------------------------------------
494  * Test Assertion Fuctions
495  *-------------------------------------------------------
496  * Use the macros below this section instead of calling
497  * these directly. The macros have a consistent naming
498  * convention and will pull in file and line information
499  * for you. */
500 
501 void UnityAssertEqualNumber(const _U_SINT expected,
502  const _U_SINT actual,
503  const char* msg,
504  const UNITY_LINE_TYPE lineNumber,
505  const UNITY_DISPLAY_STYLE_T style);
506 
507 void UnityAssertEqualIntArray(UNITY_INTERNAL_PTR expected,
508  UNITY_INTERNAL_PTR actual,
509  const _UU32 num_elements,
510  const char* msg,
511  const UNITY_LINE_TYPE lineNumber,
512  const UNITY_DISPLAY_STYLE_T style);
513 
514 void UnityAssertBits(const _U_SINT mask,
515  const _U_SINT expected,
516  const _U_SINT actual,
517  const char* msg,
518  const UNITY_LINE_TYPE lineNumber);
519 
520 void UnityAssertEqualString(const char* expected,
521  const char* actual,
522  const char* msg,
523  const UNITY_LINE_TYPE lineNumber);
524 
525 void UnityAssertEqualStringLen(const char* expected,
526  const char* actual,
527  const _UU32 length,
528  const char* msg,
529  const UNITY_LINE_TYPE lineNumber);
530 
531 void UnityAssertEqualStringArray( const char** expected,
532  const char** actual,
533  const _UU32 num_elements,
534  const char* msg,
535  const UNITY_LINE_TYPE lineNumber);
536 
537 void UnityAssertEqualMemory( UNITY_INTERNAL_PTR expected,
538  UNITY_INTERNAL_PTR actual,
539  const _UU32 length,
540  const _UU32 num_elements,
541  const char* msg,
542  const UNITY_LINE_TYPE lineNumber);
543 
544 void UnityAssertNumbersWithin(const _U_UINT delta,
545  const _U_SINT expected,
546  const _U_SINT actual,
547  const char* msg,
548  const UNITY_LINE_TYPE lineNumber,
549  const UNITY_DISPLAY_STYLE_T style);
550 
551 void UnityFail(const char* message, const UNITY_LINE_TYPE line);
552 
553 void UnityIgnore(const char* message, const UNITY_LINE_TYPE line);
554 
555 void UnitySkipPrint(const char* message, const UNITY_LINE_TYPE line);
556 
557 #ifndef UNITY_EXCLUDE_FLOAT
558 void UnityAssertFloatsWithin(const _UF delta,
559  const _UF expected,
560  const _UF actual,
561  const char* msg,
562  const UNITY_LINE_TYPE lineNumber);
563 
564 void UnityAssertEqualFloatArray(UNITY_PTR_ATTRIBUTE const _UF* expected,
565  UNITY_PTR_ATTRIBUTE const _UF* actual,
566  const _UU32 num_elements,
567  const char* msg,
568  const UNITY_LINE_TYPE lineNumber);
569 
570 void UnityAssertFloatSpecial(const _UF actual,
571  const char* msg,
572  const UNITY_LINE_TYPE lineNumber,
573  const UNITY_FLOAT_TRAIT_T style);
574 #endif
575 
576 #ifndef UNITY_EXCLUDE_DOUBLE
577 void UnityAssertDoublesWithin(const _UD delta,
578  const _UD expected,
579  const _UD actual,
580  const char* msg,
581  const UNITY_LINE_TYPE lineNumber);
582 
583 void UnityAssertEqualDoubleArray(UNITY_PTR_ATTRIBUTE const _UD* expected,
584  UNITY_PTR_ATTRIBUTE const _UD* actual,
585  const _UU32 num_elements,
586  const char* msg,
587  const UNITY_LINE_TYPE lineNumber);
588 
589 void UnityAssertDoubleSpecial(const _UD actual,
590  const char* msg,
591  const UNITY_LINE_TYPE lineNumber,
592  const UNITY_FLOAT_TRAIT_T style);
593 #endif
594 
595 #ifdef __cplusplus
596 }
597 #endif // __cplusplus
598 
599 /*-------------------------------------------------------
600  * Error Strings We Might Need
601  *-------------------------------------------------------*/
602 
603 extern const char UnityStrErrFloat[];
604 extern const char UnityStrErrDouble[];
605 extern const char UnityStrErr64[];
606 
607 /*-------------------------------------------------------
608  * Test Running Macros
609  *-------------------------------------------------------*/
610 
611 #define TEST_PROTECT() (setjmp(Unity.AbortFrame) == 0)
612 
613 #define TEST_ABORT() {longjmp(Unity.AbortFrame, 1);}
614 
615 /* This tricky series of macros gives us an optional line argument to treat it as RUN_TEST(func, num=__LINE__) */
616 #ifndef RUN_TEST
617 #ifdef __STDC_VERSION__
618 #if __STDC_VERSION__ >= 199901L
619 #define RUN_TEST(...) UnityDefaultTestRun(RUN_TEST_FIRST(__VA_ARGS__), RUN_TEST_SECOND(__VA_ARGS__))
620 #define RUN_TEST_FIRST(...) RUN_TEST_FIRST_HELPER(__VA_ARGS__, throwaway)
621 #define RUN_TEST_FIRST_HELPER(first, ...) (first), #first
622 #define RUN_TEST_SECOND(...) RUN_TEST_SECOND_HELPER(__VA_ARGS__, __LINE__, throwaway)
623 #define RUN_TEST_SECOND_HELPER(first, second, ...) (second)
624 #endif
625 #endif
626 #endif
627 
628 /* If we can't do the tricky version, we'll just have to require them to always include the line number */
629 #ifndef RUN_TEST
630 #ifdef CMOCK
631 #define RUN_TEST(func, num) UnityDefaultTestRun(func, #func, num)
632 #else
633 #define RUN_TEST(func) UnityDefaultTestRun(func, #func, __LINE__)
634 #endif
635 #endif
636 
637 #define TEST_LINE_NUM (Unity.CurrentTestLineNumber)
638 #define TEST_IS_IGNORED (Unity.CurrentTestIgnored)
639 #define UNITY_NEW_TEST(a) \
640  Unity.CurrentTestName = (a); \
641  Unity.CurrentTestLineNumber = (UNITY_LINE_TYPE)(__LINE__); \
642  Unity.NumberOfTests++;
643 
644 #ifndef UNITY_BEGIN
645 #define UNITY_BEGIN() UnityBegin(__FILE__)
646 #endif
647 
648 #ifndef UNITY_END
649 #define UNITY_END() UnityEnd()
650 #endif
651 
652 #define UNITY_UNUSED(x) (void)(sizeof(x))
653 
654 /*-------------------------------------------------------
655  * Basic Fail and Ignore
656  *-------------------------------------------------------*/
657 
658 #define UNITY_TEST_FAIL(line, message) UnityFail( (message), (UNITY_LINE_TYPE)(line))
659 #define UNITY_TEST_IGNORE(line, message) UnityIgnore( (message), (UNITY_LINE_TYPE)(line))
660 
661 /*-------------------------------------------------------
662  * Test Asserts
663  *-------------------------------------------------------*/
664 
665 #define UNITY_TEST_ASSERT(condition, line, message) if (condition) {} else {UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), (message));}
666 #define UNITY_TEST_ASSERT_NULL(pointer, line, message) UNITY_TEST_ASSERT(((pointer) == NULL), (UNITY_LINE_TYPE)(line), (message))
667 #define UNITY_TEST_ASSERT_NOT_NULL(pointer, line, message) UNITY_TEST_ASSERT(((pointer) != NULL), (UNITY_LINE_TYPE)(line), (message))
668 
669 #define UNITY_TEST_ASSERT_EQUAL_INT(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT)
670 #define UNITY_TEST_ASSERT_EQUAL_INT8(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(_US8 )(expected), (_U_SINT)(_US8 )(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT8)
671 #define UNITY_TEST_ASSERT_EQUAL_INT16(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(_US16)(expected), (_U_SINT)(_US16)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT16)
672 #define UNITY_TEST_ASSERT_EQUAL_INT32(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(_US32)(expected), (_U_SINT)(_US32)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT32)
673 #define UNITY_TEST_ASSERT_EQUAL_UINT(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT)
674 #define UNITY_TEST_ASSERT_EQUAL_UINT8(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(_UU8 )(expected), (_U_SINT)(_UU8 )(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT8)
675 #define UNITY_TEST_ASSERT_EQUAL_UINT16(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(_UU16)(expected), (_U_SINT)(_UU16)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT16)
676 #define UNITY_TEST_ASSERT_EQUAL_UINT32(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(_UU32)(expected), (_U_SINT)(_UU32)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT32)
677 #define UNITY_TEST_ASSERT_EQUAL_HEX8(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(_US8 )(expected), (_U_SINT)(_US8 )(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX8)
678 #define UNITY_TEST_ASSERT_EQUAL_HEX16(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(_US16)(expected), (_U_SINT)(_US16)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX16)
679 #define UNITY_TEST_ASSERT_EQUAL_HEX32(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(_US32)(expected), (_U_SINT)(_US32)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX32)
680 #define UNITY_TEST_ASSERT_BITS(mask, expected, actual, line, message) UnityAssertBits((_U_SINT)(mask), (_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)(line))
681 
682 #define UNITY_TEST_ASSERT_INT_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((delta), (_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT)
683 #define UNITY_TEST_ASSERT_INT8_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_UU8 )(delta), (_U_SINT)(_US8 )(expected), (_U_SINT)(_US8 )(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT8)
684 #define UNITY_TEST_ASSERT_INT16_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_UU16)(delta), (_U_SINT)(_US16)(expected), (_U_SINT)(_US16)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT16)
685 #define UNITY_TEST_ASSERT_INT32_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_UU32)(delta), (_U_SINT)(_US32)(expected), (_U_SINT)(_US32)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT32)
686 #define UNITY_TEST_ASSERT_UINT_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((delta), (_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT)
687 #define UNITY_TEST_ASSERT_UINT8_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_UU8 )(delta), (_U_SINT)(_U_UINT)(_UU8 )(expected), (_U_SINT)(_U_UINT)(_UU8 )(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT8)
688 #define UNITY_TEST_ASSERT_UINT16_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_UU16)(delta), (_U_SINT)(_U_UINT)(_UU16)(expected), (_U_SINT)(_U_UINT)(_UU16)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT16)
689 #define UNITY_TEST_ASSERT_UINT32_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_UU32)(delta), (_U_SINT)(_U_UINT)(_UU32)(expected), (_U_SINT)(_U_UINT)(_UU32)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT32)
690 #define UNITY_TEST_ASSERT_HEX8_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_UU8 )(delta), (_U_SINT)(_U_UINT)(_UU8 )(expected), (_U_SINT)(_U_UINT)(_UU8 )(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX8)
691 #define UNITY_TEST_ASSERT_HEX16_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_UU16)(delta), (_U_SINT)(_U_UINT)(_UU16)(expected), (_U_SINT)(_U_UINT)(_UU16)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX16)
692 #define UNITY_TEST_ASSERT_HEX32_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_UU32)(delta), (_U_SINT)(_U_UINT)(_UU32)(expected), (_U_SINT)(_U_UINT)(_UU32)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX32)
693 
694 #define UNITY_TEST_ASSERT_EQUAL_PTR(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(_UP)(expected), (_U_SINT)(_UP)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_POINTER)
695 #define UNITY_TEST_ASSERT_EQUAL_STRING(expected, actual, line, message) UnityAssertEqualString((const char*)(expected), (const char*)(actual), (message), (UNITY_LINE_TYPE)(line))
696 #define UNITY_TEST_ASSERT_EQUAL_STRING_LEN(expected, actual, len, line, message) UnityAssertEqualStringLen((const char*)(expected), (const char*)(actual), (_UU32)(len), (message), (UNITY_LINE_TYPE)(line))
697 #define UNITY_TEST_ASSERT_EQUAL_MEMORY(expected, actual, len, line, message) UnityAssertEqualMemory((UNITY_INTERNAL_PTR)(expected), (UNITY_INTERNAL_PTR)(actual), (_UU32)(len), 1, (message), (UNITY_LINE_TYPE)(line))
698 
699 #define UNITY_TEST_ASSERT_EQUAL_INT_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((UNITY_INTERNAL_PTR)(expected), (UNITY_INTERNAL_PTR)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT)
700 #define UNITY_TEST_ASSERT_EQUAL_INT8_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((UNITY_INTERNAL_PTR)(expected), (UNITY_INTERNAL_PTR)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT8)
701 #define UNITY_TEST_ASSERT_EQUAL_INT16_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((UNITY_INTERNAL_PTR)(expected), (UNITY_INTERNAL_PTR)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT16)
702 #define UNITY_TEST_ASSERT_EQUAL_INT32_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((UNITY_INTERNAL_PTR)(expected), (UNITY_INTERNAL_PTR)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT32)
703 #define UNITY_TEST_ASSERT_EQUAL_UINT_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((UNITY_INTERNAL_PTR)(expected), (UNITY_INTERNAL_PTR)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT)
704 #define UNITY_TEST_ASSERT_EQUAL_UINT8_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((UNITY_INTERNAL_PTR)(expected), (UNITY_INTERNAL_PTR)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT8)
705 #define UNITY_TEST_ASSERT_EQUAL_UINT16_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((UNITY_INTERNAL_PTR)(expected), (UNITY_INTERNAL_PTR)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT16)
706 #define UNITY_TEST_ASSERT_EQUAL_UINT32_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((UNITY_INTERNAL_PTR)(expected), (UNITY_INTERNAL_PTR)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT32)
707 #define UNITY_TEST_ASSERT_EQUAL_HEX8_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((UNITY_INTERNAL_PTR)(expected), (UNITY_INTERNAL_PTR)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX8)
708 #define UNITY_TEST_ASSERT_EQUAL_HEX16_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((UNITY_INTERNAL_PTR)(expected), (UNITY_INTERNAL_PTR)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX16)
709 #define UNITY_TEST_ASSERT_EQUAL_HEX32_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((UNITY_INTERNAL_PTR)(expected), (UNITY_INTERNAL_PTR)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX32)
710 #define UNITY_TEST_ASSERT_EQUAL_PTR_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((UNITY_INTERNAL_PTR)(_UP*)(expected), (UNITY_INTERNAL_PTR)(_UP*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_POINTER)
711 #define UNITY_TEST_ASSERT_EQUAL_STRING_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualStringArray((const char**)(expected), (const char**)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)(line))
712 #define UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY(expected, actual, len, num_elements, line, message) UnityAssertEqualMemory((UNITY_INTERNAL_PTR)(expected), (UNITY_INTERNAL_PTR)(actual), (_UU32)(len), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)(line))
713 
714 #ifdef UNITY_SUPPORT_64
715 #define UNITY_TEST_ASSERT_EQUAL_INT64(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT64)
716 #define UNITY_TEST_ASSERT_EQUAL_UINT64(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT64)
717 #define UNITY_TEST_ASSERT_EQUAL_HEX64(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX64)
718 #define UNITY_TEST_ASSERT_EQUAL_INT64_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((UNITY_INTERNAL_PTR)(expected), (UNITY_INTERNAL_PTR)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT64)
719 #define UNITY_TEST_ASSERT_EQUAL_UINT64_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((UNITY_INTERNAL_PTR)(expected), (UNITY_INTERNAL_PTR)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT64)
720 #define UNITY_TEST_ASSERT_EQUAL_HEX64_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((UNITY_INTERNAL_PTR)(expected), (UNITY_INTERNAL_PTR)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX64)
721 #define UNITY_TEST_ASSERT_INT64_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((delta), (_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT64)
722 #define UNITY_TEST_ASSERT_UINT64_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((delta), (_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_UINT64)
723 #define UNITY_TEST_ASSERT_HEX64_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((delta), (_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_HEX64)
724 #else
725 #define UNITY_TEST_ASSERT_EQUAL_INT64(expected, actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErr64)
726 #define UNITY_TEST_ASSERT_EQUAL_UINT64(expected, actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErr64)
727 #define UNITY_TEST_ASSERT_EQUAL_HEX64(expected, actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErr64)
728 #define UNITY_TEST_ASSERT_EQUAL_INT64_ARRAY(expected, actual, num_elements, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErr64)
729 #define UNITY_TEST_ASSERT_EQUAL_UINT64_ARRAY(expected, actual, num_elements, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErr64)
730 #define UNITY_TEST_ASSERT_EQUAL_HEX64_ARRAY(expected, actual, num_elements, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErr64)
731 #define UNITY_TEST_ASSERT_INT64_WITHIN(delta, expected, actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErr64)
732 #define UNITY_TEST_ASSERT_UINT64_WITHIN(delta, expected, actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErr64)
733 #define UNITY_TEST_ASSERT_HEX64_WITHIN(delta, expected, actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErr64)
734 #endif
735 
736 #ifdef UNITY_EXCLUDE_FLOAT
737 #define UNITY_TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErrFloat)
738 #define UNITY_TEST_ASSERT_EQUAL_FLOAT(expected, actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErrFloat)
739 #define UNITY_TEST_ASSERT_EQUAL_FLOAT_ARRAY(expected, actual, num_elements, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErrFloat)
740 #define UNITY_TEST_ASSERT_FLOAT_IS_INF(actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErrFloat)
741 #define UNITY_TEST_ASSERT_FLOAT_IS_NEG_INF(actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErrFloat)
742 #define UNITY_TEST_ASSERT_FLOAT_IS_NAN(actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErrFloat)
743 #define UNITY_TEST_ASSERT_FLOAT_IS_DETERMINATE(actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErrFloat)
744 #define UNITY_TEST_ASSERT_FLOAT_IS_NOT_INF(actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErrFloat)
745 #define UNITY_TEST_ASSERT_FLOAT_IS_NOT_NEG_INF(actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErrFloat)
746 #define UNITY_TEST_ASSERT_FLOAT_IS_NOT_NAN(actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErrFloat)
747 #define UNITY_TEST_ASSERT_FLOAT_IS_NOT_DETERMINATE(actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErrFloat)
748 #else
749 #define UNITY_TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual, line, message) UnityAssertFloatsWithin((_UF)(delta), (_UF)(expected), (_UF)(actual), (message), (UNITY_LINE_TYPE)(line))
750 #define UNITY_TEST_ASSERT_EQUAL_FLOAT(expected, actual, line, message) UNITY_TEST_ASSERT_FLOAT_WITHIN((_UF)(expected) * (_UF)UNITY_FLOAT_PRECISION, (_UF)(expected), (_UF)(actual), (UNITY_LINE_TYPE)(line), (message))
751 #define UNITY_TEST_ASSERT_EQUAL_FLOAT_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualFloatArray((_UF*)(expected), (_UF*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)(line))
752 #define UNITY_TEST_ASSERT_FLOAT_IS_INF(actual, line, message) UnityAssertFloatSpecial((_UF)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_FLOAT_IS_INF)
753 #define UNITY_TEST_ASSERT_FLOAT_IS_NEG_INF(actual, line, message) UnityAssertFloatSpecial((_UF)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_FLOAT_IS_NEG_INF)
754 #define UNITY_TEST_ASSERT_FLOAT_IS_NAN(actual, line, message) UnityAssertFloatSpecial((_UF)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_FLOAT_IS_NAN)
755 #define UNITY_TEST_ASSERT_FLOAT_IS_DETERMINATE(actual, line, message) UnityAssertFloatSpecial((_UF)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_FLOAT_IS_DET)
756 #define UNITY_TEST_ASSERT_FLOAT_IS_NOT_INF(actual, line, message) UnityAssertFloatSpecial((_UF)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_FLOAT_IS_NOT_INF)
757 #define UNITY_TEST_ASSERT_FLOAT_IS_NOT_NEG_INF(actual, line, message) UnityAssertFloatSpecial((_UF)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_FLOAT_IS_NOT_NEG_INF)
758 #define UNITY_TEST_ASSERT_FLOAT_IS_NOT_NAN(actual, line, message) UnityAssertFloatSpecial((_UF)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_FLOAT_IS_NOT_NAN)
759 #define UNITY_TEST_ASSERT_FLOAT_IS_NOT_DETERMINATE(actual, line, message) UnityAssertFloatSpecial((_UF)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_FLOAT_IS_NOT_DET)
760 #endif
761 
762 #ifdef UNITY_EXCLUDE_DOUBLE
763 #define UNITY_TEST_ASSERT_DOUBLE_WITHIN(delta, expected, actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErrDouble)
764 #define UNITY_TEST_ASSERT_EQUAL_DOUBLE(expected, actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErrDouble)
765 #define UNITY_TEST_ASSERT_EQUAL_DOUBLE_ARRAY(expected, actual, num_elements, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErrDouble)
766 #define UNITY_TEST_ASSERT_DOUBLE_IS_INF(actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErrDouble)
767 #define UNITY_TEST_ASSERT_DOUBLE_IS_NEG_INF(actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErrDouble)
768 #define UNITY_TEST_ASSERT_DOUBLE_IS_NAN(actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErrDouble)
769 #define UNITY_TEST_ASSERT_DOUBLE_IS_DETERMINATE(actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErrDouble)
770 #define UNITY_TEST_ASSERT_DOUBLE_IS_NOT_INF(actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErrDouble)
771 #define UNITY_TEST_ASSERT_DOUBLE_IS_NOT_NEG_INF(actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErrDouble)
772 #define UNITY_TEST_ASSERT_DOUBLE_IS_NOT_NAN(actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErrDouble)
773 #define UNITY_TEST_ASSERT_DOUBLE_IS_NOT_DETERMINATE(actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), UnityStrErrDouble)
774 #else
775 #define UNITY_TEST_ASSERT_DOUBLE_WITHIN(delta, expected, actual, line, message) UnityAssertDoublesWithin((_UD)(delta), (_UD)(expected), (_UD)(actual), (message), (UNITY_LINE_TYPE)line)
776 #define UNITY_TEST_ASSERT_EQUAL_DOUBLE(expected, actual, line, message) UNITY_TEST_ASSERT_DOUBLE_WITHIN((_UD)(expected) * (_UD)UNITY_DOUBLE_PRECISION, (_UD)expected, (_UD)actual, (UNITY_LINE_TYPE)(line), message)
777 #define UNITY_TEST_ASSERT_EQUAL_DOUBLE_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualDoubleArray((_UD*)(expected), (_UD*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line)
778 #define UNITY_TEST_ASSERT_DOUBLE_IS_INF(actual, line, message) UnityAssertDoubleSpecial((_UD)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_FLOAT_IS_INF)
779 #define UNITY_TEST_ASSERT_DOUBLE_IS_NEG_INF(actual, line, message) UnityAssertDoubleSpecial((_UD)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_FLOAT_IS_NEG_INF)
780 #define UNITY_TEST_ASSERT_DOUBLE_IS_NAN(actual, line, message) UnityAssertDoubleSpecial((_UD)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_FLOAT_IS_NAN)
781 #define UNITY_TEST_ASSERT_DOUBLE_IS_DETERMINATE(actual, line, message) UnityAssertDoubleSpecial((_UD)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_FLOAT_IS_DET)
782 #define UNITY_TEST_ASSERT_DOUBLE_IS_NOT_INF(actual, line, message) UnityAssertDoubleSpecial((_UD)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_FLOAT_IS_NOT_INF)
783 #define UNITY_TEST_ASSERT_DOUBLE_IS_NOT_NEG_INF(actual, line, message) UnityAssertDoubleSpecial((_UD)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_FLOAT_IS_NOT_NEG_INF)
784 #define UNITY_TEST_ASSERT_DOUBLE_IS_NOT_NAN(actual, line, message) UnityAssertDoubleSpecial((_UD)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_FLOAT_IS_NOT_NAN)
785 #define UNITY_TEST_ASSERT_DOUBLE_IS_NOT_DETERMINATE(actual, line, message) UnityAssertDoubleSpecial((_UD)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_FLOAT_IS_NOT_DET)
786 #endif
787 
788 /*-------------------------------------------------------
789  * Test skip
790  *-------------------------------------------------------*/
791 
792 #define UNITY_TEST_SKIP(line, message) { UnitySkipPrint( (message), (UNITY_LINE_TYPE)(line)); return; }
793 #define UNITY_TEST_SKIP_UNLESS(condition, line, message) if (!(condition)) UNITY_TEST_SKIP((line), (message))
794 
795 /* End of UNITY_INTERNALS_H */
796 #endif
797 
798 /** @}*/
Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.