• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* ==========================================
2     Unity Project - A Test Framework for C
3     Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams
4     [Released under MIT License. Please refer to license.txt for details]
5 ========================================== */
6 
7 #include "unity.h"
8 #define TEST_INSTANCES
9 #include "self_assessment_utils.h"
10 
11 static int SetToOneToFailInTearDown;
12 static int SetToOneMeanWeAlreadyCheckedThisGuy;
13 
setUp(void)14 void setUp(void)
15 {
16     SetToOneToFailInTearDown = 0;
17     SetToOneMeanWeAlreadyCheckedThisGuy = 0;
18 }
19 
tearDown(void)20 void tearDown(void)
21 {
22     endPutcharSpy(); /* Stop suppressing test output */
23     if (SetToOneToFailInTearDown == 1)
24     {
25         /* These will be skipped internally if already failed/ignored */
26         TEST_FAIL_MESSAGE("<= Failed in tearDown");
27         TEST_IGNORE_MESSAGE("<= Ignored in tearDown");
28     }
29     if ((SetToOneMeanWeAlreadyCheckedThisGuy == 0) && (Unity.CurrentTestFailed > 0))
30     {
31         UnityPrint(": [[[[ Test Should Have Passed But Did Not ]]]]");
32         UNITY_OUTPUT_CHAR('\n');
33     }
34 }
35 
testInt64ArrayWithinDelta(void)36 void testInt64ArrayWithinDelta(void)
37 {
38 #ifndef UNITY_SUPPORT_64
39     TEST_IGNORE();
40 #else
41     UNITY_INT64 expected[] = {12345000, -12344995, 12345005};
42     UNITY_INT64 actualSmallDelta[] = {12345001, -12344996, 12345005};
43     UNITY_INT64 actualBigDelta[] = {12345101, -12344896, 12345055};
44 
45     TEST_ASSERT_INT64_ARRAY_WITHIN(1, expected, actualSmallDelta, 3);
46     TEST_ASSERT_INT64_ARRAY_WITHIN(110, expected, actualBigDelta, 3);
47 #endif
48 }
49 
testInt64ArrayWithinDeltaAndMessage(void)50 void testInt64ArrayWithinDeltaAndMessage(void)
51 {
52 #ifndef UNITY_SUPPORT_64
53     TEST_IGNORE();
54 #else
55     UNITY_INT64 expected[] = {12345000, -12344995, 12345005};
56     UNITY_INT64 actualSmallDelta[] = {12345001, -12344996, 12345005};
57     UNITY_INT64 actualBigDelta[] = {12345101, -12344896, 12345055};
58 
59     TEST_ASSERT_INT64_ARRAY_WITHIN_MESSAGE(1, expected, actualSmallDelta, 3, "Custom Message.");
60     TEST_ASSERT_INT64_ARRAY_WITHIN_MESSAGE(110, expected, actualBigDelta, 3, "Custom Message.");
61 #endif
62 }
63 
tesUInt64ArrayNotWithinDelta(void)64 void tesUInt64ArrayNotWithinDelta(void)
65 {
66 #ifndef UNITY_SUPPORT_64
67     TEST_IGNORE();
68 #else
69     UNITY_INT64 expected[] = {12345000, -12344995, 12345005};
70     UNITY_INT64 actualBigDelta[] = {12345101, -12344896, 12345055};
71 
72     EXPECT_ABORT_BEGIN
73     TEST_ASSERT_UINT64_ARRAY_WITHIN(1, expected, actualBigDelta, 3);
74     VERIFY_FAILS_END
75 #endif
76 }
77 
testInt64ArrayNotWithinDeltaAndMessage(void)78 void testInt64ArrayNotWithinDeltaAndMessage(void)
79 {
80 #ifndef UNITY_SUPPORT_64
81     TEST_IGNORE();
82 #else
83     UNITY_INT64 expected[] = {12345000, -12344995, 12345005};
84     UNITY_INT64 actualBigDelta[] = {12345101, -12344896, 12345055};
85 
86     EXPECT_ABORT_BEGIN
87     TEST_ASSERT_INT64_ARRAY_WITHIN_MESSAGE(1, expected, actualBigDelta, 3, "Custom Message.");
88     VERIFY_FAILS_END
89 #endif
90 }
91 
testInt64ArrayWithinDeltaPointless(void)92 void testInt64ArrayWithinDeltaPointless(void)
93 {
94 #ifndef UNITY_SUPPORT_64
95     TEST_IGNORE();
96 #else
97     UNITY_INT64 expected[] = {12345000, -12344995, 12345005};
98     UNITY_INT64 actualBigDelta[] = {12345101, -12344896, 12345055};
99 
100     EXPECT_ABORT_BEGIN
101     TEST_ASSERT_INT64_ARRAY_WITHIN(110, expected, actualBigDelta, 0);
102     VERIFY_FAILS_END
103 #endif
104 }
105 
testInt64ArrayWithinDeltaPointlessAndMessage(void)106 void testInt64ArrayWithinDeltaPointlessAndMessage(void)
107 {
108 #ifndef UNITY_SUPPORT_64
109     TEST_IGNORE();
110 #else
111     UNITY_INT64 expected[] = {12345000, -12344995, 12345005};
112     UNITY_INT64 actualBigDelta[] = {12345101, -12344896, 12345055};
113 
114     EXPECT_ABORT_BEGIN
115     TEST_ASSERT_INT64_ARRAY_WITHIN_MESSAGE(110, expected, actualBigDelta, 0, "Custom Message.");
116     VERIFY_FAILS_END
117 #endif
118 }
119 
testInt64ArrayWithinDeltaExpectedNull(void)120 void testInt64ArrayWithinDeltaExpectedNull(void)
121 {
122 #ifndef UNITY_SUPPORT_64
123     TEST_IGNORE();
124 #else
125     UNITY_INT64 actualBigDelta[] = {12345101, -12344896, 12345055};
126 
127     EXPECT_ABORT_BEGIN
128     TEST_ASSERT_INT64_ARRAY_WITHIN(110, NULL, actualBigDelta, 3);
129     VERIFY_FAILS_END
130 #endif
131 }
132 
testInt64ArrayWithinDeltaExpectedNullAndMessage(void)133 void testInt64ArrayWithinDeltaExpectedNullAndMessage(void)
134 {
135 #ifndef UNITY_SUPPORT_64
136     TEST_IGNORE();
137 #else
138     UNITY_INT64 actualBigDelta[] = {12345101, -12344896, 12345055};
139 
140     EXPECT_ABORT_BEGIN
141     TEST_ASSERT_INT64_ARRAY_WITHIN_MESSAGE(110, NULL, actualBigDelta, 3, "Custom Message.");
142     VERIFY_FAILS_END
143 #endif
144 }
145 
testInt64ArrayWithinDeltaActualNull(void)146 void testInt64ArrayWithinDeltaActualNull(void)
147 {
148 #ifndef UNITY_SUPPORT_64
149     TEST_IGNORE();
150 #else
151     UNITY_INT64 expected[] = {12345000, -12344995, 12345005};
152 
153     EXPECT_ABORT_BEGIN
154     TEST_ASSERT_INT64_ARRAY_WITHIN(110, expected, NULL, 3);
155     VERIFY_FAILS_END
156 #endif
157 }
158 
testInt64ArrayWithinDeltaActualNullAndMessage(void)159 void testInt64ArrayWithinDeltaActualNullAndMessage(void)
160 {
161 #ifndef UNITY_SUPPORT_64
162     TEST_IGNORE();
163 #else
164     UNITY_INT64 expected[] = {12345000, -12344995, 12345005};
165 
166     EXPECT_ABORT_BEGIN
167     TEST_ASSERT_INT64_ARRAY_WITHIN_MESSAGE(110, expected, NULL, 3, "Custom Message.");
168     VERIFY_FAILS_END
169 #endif
170 }
171 
testInt64ArrayWithinDeltaSamePointer(void)172 void testInt64ArrayWithinDeltaSamePointer(void)
173 {
174 #ifndef UNITY_SUPPORT_64
175     TEST_IGNORE();
176 #else
177     UNITY_INT64 expected[] = {12345000, -12344995, 12345005};
178 
179     TEST_ASSERT_UINT64_ARRAY_WITHIN(110, expected, expected, 3);
180 #endif
181 }
182 
testInt64ArrayWithinDeltaSamePointerAndMessage(void)183 void testInt64ArrayWithinDeltaSamePointerAndMessage(void)
184 {
185 #ifndef UNITY_SUPPORT_64
186     TEST_IGNORE();
187 #else
188     UNITY_INT64 expected[] = {12345000, -12344995, 12345005};
189 
190     TEST_ASSERT_INT64_ARRAY_WITHIN_MESSAGE(110, expected, expected, 3, "Custom Message.");
191 #endif
192 }
193 
testUInt64ArrayWithinDelta(void)194 void testUInt64ArrayWithinDelta(void)
195 {
196 #ifndef UNITY_SUPPORT_64
197     TEST_IGNORE();
198 #else
199     UNITY_UINT64 expected[] = {12345000, 12344995, 12345005};
200     UNITY_UINT64 actualSmallDelta[] = {12345001, 12344996, 12345005};
201     UNITY_UINT64 actualBigDelta[] = {12345101, 12344896, 12345055};
202 
203     TEST_ASSERT_UINT64_ARRAY_WITHIN(1, expected, actualSmallDelta, 3);
204     TEST_ASSERT_UINT64_ARRAY_WITHIN(110, expected, actualBigDelta, 3);
205 #endif
206 }
207 
testUInt64ArrayWithinDeltaAndMessage(void)208 void testUInt64ArrayWithinDeltaAndMessage(void)
209 {
210 #ifndef UNITY_SUPPORT_64
211     TEST_IGNORE();
212 #else
213     UNITY_UINT64 expected[] = {12345000, 12344995, 12345005};
214     UNITY_UINT64 actualSmallDelta[] = {12345001, 12344996, 12345005};
215     UNITY_UINT64 actualBigDelta[] = {12345101, 12344896, 12345055};
216 
217     TEST_ASSERT_UINT64_ARRAY_WITHIN_MESSAGE(1, expected, actualSmallDelta, 3, "Custom Message.");
218     TEST_ASSERT_UINT64_ARRAY_WITHIN_MESSAGE(110, expected, actualBigDelta, 3, "Custom Message.");
219 #endif
220 }
221 
testUInt64ArrayNotWithinDelta(void)222 void testUInt64ArrayNotWithinDelta(void)
223 {
224 #ifndef UNITY_SUPPORT_64
225     TEST_IGNORE();
226 #else
227     UNITY_UINT64 expected[] = {12345000, 12344995, 12345005};
228     UNITY_UINT64 actualBigDelta[] = {12345101, 12344896, 12345055};
229 
230     EXPECT_ABORT_BEGIN
231     TEST_ASSERT_UINT64_ARRAY_WITHIN(1, expected, actualBigDelta, 3);
232     VERIFY_FAILS_END
233 #endif
234 }
235 
testUInt64ArrayNotWithinDeltaAndMessage(void)236 void testUInt64ArrayNotWithinDeltaAndMessage(void)
237 {
238 #ifndef UNITY_SUPPORT_64
239     TEST_IGNORE();
240 #else
241     UNITY_UINT64 expected[] = {12345000, 12344995, 12345005};
242     UNITY_UINT64 actualBigDelta[] = {12345101, 12344896, 12345055};
243 
244     EXPECT_ABORT_BEGIN
245     TEST_ASSERT_UINT64_ARRAY_WITHIN_MESSAGE(1, expected, actualBigDelta, 3, "Custom Message.");
246     VERIFY_FAILS_END
247 #endif
248 }
249 
testUInt64ArrayWithinDeltaPointless(void)250 void testUInt64ArrayWithinDeltaPointless(void)
251 {
252 #ifndef UNITY_SUPPORT_64
253     TEST_IGNORE();
254 #else
255     UNITY_UINT64 expected[] = {12345000, 12344995, 12345005};
256     UNITY_UINT64 actualBigDelta[] = {12345101, 12344896, 12345055};
257 
258     EXPECT_ABORT_BEGIN
259     TEST_ASSERT_UINT64_ARRAY_WITHIN(110, expected, actualBigDelta, 0);
260     VERIFY_FAILS_END
261 #endif
262 }
263 
testUInt64ArrayWithinDeltaPointlessAndMessage(void)264 void testUInt64ArrayWithinDeltaPointlessAndMessage(void)
265 {
266 #ifndef UNITY_SUPPORT_64
267     TEST_IGNORE();
268 #else
269     UNITY_UINT64 expected[] = {12345000, 12344995, 12345005};
270     UNITY_UINT64 actualBigDelta[] = {12345101, 12344896, 12345055};
271 
272     EXPECT_ABORT_BEGIN
273     TEST_ASSERT_UINT64_ARRAY_WITHIN_MESSAGE(110, expected, actualBigDelta, 0, "Custom Message.");
274     VERIFY_FAILS_END
275 #endif
276 }
277 
testUInt64ArrayWithinDeltaExpectedNull(void)278 void testUInt64ArrayWithinDeltaExpectedNull(void)
279 {
280 #ifndef UNITY_SUPPORT_64
281     TEST_IGNORE();
282 #else
283     UNITY_UINT64 actualBigDelta[] = {12345101, 12344896, 12345055};
284 
285     EXPECT_ABORT_BEGIN
286     TEST_ASSERT_UINT64_ARRAY_WITHIN(110, NULL, actualBigDelta, 3);
287     VERIFY_FAILS_END
288 #endif
289 }
290 
testUInt64ArrayWithinDeltaExpectedNullAndMessage(void)291 void testUInt64ArrayWithinDeltaExpectedNullAndMessage(void)
292 {
293 #ifndef UNITY_SUPPORT_64
294     TEST_IGNORE();
295 #else
296     UNITY_UINT64 actualBigDelta[] = {12345101, 12344896, 12345055};
297 
298     EXPECT_ABORT_BEGIN
299     TEST_ASSERT_UINT64_ARRAY_WITHIN_MESSAGE(110, NULL, actualBigDelta, 3, "Custom Message.");
300     VERIFY_FAILS_END
301 #endif
302 }
303 
testUInt64ArrayWithinDeltaActualNull(void)304 void testUInt64ArrayWithinDeltaActualNull(void)
305 {
306 #ifndef UNITY_SUPPORT_64
307     TEST_IGNORE();
308 #else
309     UNITY_UINT64 expected[] = {12345000, 12344995, 12345005};
310 
311     EXPECT_ABORT_BEGIN
312     TEST_ASSERT_UINT64_ARRAY_WITHIN(110, expected, NULL, 3);
313     VERIFY_FAILS_END
314 #endif
315 }
316 
testUInt64ArrayWithinDeltaActualNullAndMessage(void)317 void testUInt64ArrayWithinDeltaActualNullAndMessage(void)
318 {
319 #ifndef UNITY_SUPPORT_64
320     TEST_IGNORE();
321 #else
322     UNITY_UINT64 expected[] = {12345000, 12344995, 12345005};
323 
324     EXPECT_ABORT_BEGIN
325     TEST_ASSERT_UINT64_ARRAY_WITHIN_MESSAGE(110, expected, NULL, 3, "Custom Message.");
326     VERIFY_FAILS_END
327 #endif
328 }
329 
testUInt64ArrayWithinDeltaSamePointer(void)330 void testUInt64ArrayWithinDeltaSamePointer(void)
331 {
332 #ifndef UNITY_SUPPORT_64
333     TEST_IGNORE();
334 #else
335     UNITY_UINT64 expected[] = {12345000, 12344995, 12345005};
336 
337     TEST_ASSERT_UINT64_ARRAY_WITHIN(110, expected, expected, 3);
338 #endif
339 }
340 
testUInt64ArrayWithinDeltaSamePointerAndMessage(void)341 void testUInt64ArrayWithinDeltaSamePointerAndMessage(void)
342 {
343 #ifndef UNITY_SUPPORT_64
344     TEST_IGNORE();
345 #else
346     UNITY_UINT64 expected[] = {12345000, 12344995, 12345005};
347 
348     TEST_ASSERT_UINT64_ARRAY_WITHIN_MESSAGE(110, expected, expected, 3, "Custom Message.");
349 #endif
350 }
351 
testHEX64ArrayWithinDelta(void)352 void testHEX64ArrayWithinDelta(void)
353 {
354 #ifndef UNITY_SUPPORT_64
355     TEST_IGNORE();
356 #else
357     UNITY_UINT64 expected[] = {0xABCD123400000000, 0xABCD112200000000, 0xABCD127700000000};
358     UNITY_UINT64 actualSmallDelta[] = {0xABCD123500000000, 0xABCD112100000000, 0xABCD127700000000};
359     UNITY_UINT64 actualBigDelta[] = {0xABCD126700000000, 0xABCD118800000000, 0xABCD12AC00000000};
360 
361     TEST_ASSERT_HEX64_ARRAY_WITHIN(0x100000000, expected, actualSmallDelta, 3);
362     TEST_ASSERT_HEX64_ARRAY_WITHIN(0x6E00000000, expected, actualBigDelta, 3);
363 #endif
364 }
365 
testHEX64ArrayWithinDeltaAndMessage(void)366 void testHEX64ArrayWithinDeltaAndMessage(void)
367 {
368 #ifndef UNITY_SUPPORT_64
369     TEST_IGNORE();
370 #else
371     UNITY_UINT64 expected[] = {0xABCD123400000000, 0xABCD112200000000, 0xABCD127700000000};
372     UNITY_UINT64 actualSmallDelta[] = {0xABCD123500000000, 0xABCD112100000000, 0xABCD127700000000};
373     UNITY_UINT64 actualBigDelta[] = {0xABCD126700000000, 0xABCD118800000000, 0xABCD12AC00000000};
374 
375     TEST_ASSERT_HEX64_ARRAY_WITHIN_MESSAGE(0x100000000, expected, actualSmallDelta, 3, "Custom Message.");
376     TEST_ASSERT_HEX64_ARRAY_WITHIN_MESSAGE(0x6E00000000, expected, actualBigDelta, 3, "Custom Message.");
377 #endif
378 }
379 
testHEX64ArrayNotWithinDelta(void)380 void testHEX64ArrayNotWithinDelta(void)
381 {
382 #ifndef UNITY_SUPPORT_64
383     TEST_IGNORE();
384 #else
385     UNITY_UINT64 expected[] = {0xABCD123400000000, 0xABCD112200000000, 0xABCD127700000000};
386     UNITY_UINT64 actualBigDelta[] = {0xABCD126700000000, 0xABCD118800000000, 0xABCD12AC00000000};
387 
388     EXPECT_ABORT_BEGIN
389     TEST_ASSERT_HEX64_ARRAY_WITHIN(0x100000000, expected, actualBigDelta, 3);
390     VERIFY_FAILS_END
391 #endif
392 }
393 
testHEX64ArrayNotWithinDeltaAndMessage(void)394 void testHEX64ArrayNotWithinDeltaAndMessage(void)
395 {
396 #ifndef UNITY_SUPPORT_64
397     TEST_IGNORE();
398 #else
399     UNITY_UINT64 expected[] = {0xABCD123400000000, 0xABCD112200000000, 0xABCD127700000000};
400     UNITY_UINT64 actualBigDelta[] = {0xABCD126700000000, 0xABCD118800000000, 0xABCD12AC00000000};
401 
402     EXPECT_ABORT_BEGIN
403     TEST_ASSERT_HEX64_ARRAY_WITHIN_MESSAGE(0x100000000, expected, actualBigDelta, 3, "Custom Message.");
404     VERIFY_FAILS_END
405 #endif
406 }
407 
testHEX64ArrayWithinDeltaPointless(void)408 void testHEX64ArrayWithinDeltaPointless(void)
409 {
410 #ifndef UNITY_SUPPORT_64
411     TEST_IGNORE();
412 #else
413     UNITY_UINT64 expected[] = {0xABCD123400000000, 0xABCD112200000000, 0xABCD127700000000};
414     UNITY_UINT64 actualBigDelta[] = {0xABCD126700000000, 0xABCD118800000000, 0xABCD12AC00000000};
415 
416     EXPECT_ABORT_BEGIN
417     TEST_ASSERT_HEX64_ARRAY_WITHIN(0x6E00000000, expected, actualBigDelta, 0);
418     VERIFY_FAILS_END
419 #endif
420 }
421 
testHEX64ArrayWithinDeltaPointlessAndMessage(void)422 void testHEX64ArrayWithinDeltaPointlessAndMessage(void)
423 {
424 #ifndef UNITY_SUPPORT_64
425     TEST_IGNORE();
426 #else
427     UNITY_UINT64 expected[] = {0xABCD123400000000, 0xABCD112200000000, 0xABCD127700000000};
428     UNITY_UINT64 actualBigDelta[] = {0xABCD126700000000, 0xABCD118800000000, 0xABCD12AC00000000};
429 
430     EXPECT_ABORT_BEGIN
431     TEST_ASSERT_HEX64_ARRAY_WITHIN_MESSAGE(0x6E00000000, expected, actualBigDelta, 0, "Custom Message.");
432     VERIFY_FAILS_END
433 #endif
434 }
435 
testHEX64ArrayWithinDeltaExpectedNull(void)436 void testHEX64ArrayWithinDeltaExpectedNull(void)
437 {
438 #ifndef UNITY_SUPPORT_64
439     TEST_IGNORE();
440 #else
441     UNITY_UINT64 actualBigDelta[] = {0xABCD126700000000, 0xABCD118800000000, 0xABCD12AC00000000};
442 
443     EXPECT_ABORT_BEGIN
444     TEST_ASSERT_HEX64_ARRAY_WITHIN(0x6E00000000, NULL, actualBigDelta, 3);
445     VERIFY_FAILS_END
446 #endif
447 }
448 
testHEX64ArrayWithinDeltaExpectedNullAndMessage(void)449 void testHEX64ArrayWithinDeltaExpectedNullAndMessage(void)
450 {
451 #ifndef UNITY_SUPPORT_64
452     TEST_IGNORE();
453 #else
454     UNITY_UINT64 actualBigDelta[] = {0xABCD126700000000, 0xABCD118800000000, 0xABCD12AC00000000};
455 
456     EXPECT_ABORT_BEGIN
457     TEST_ASSERT_HEX64_ARRAY_WITHIN_MESSAGE(0x6E00000000, NULL, actualBigDelta, 3, "Custom Message.");
458     VERIFY_FAILS_END
459 #endif
460 }
461 
testHEX64ArrayWithinDeltaActualNull(void)462 void testHEX64ArrayWithinDeltaActualNull(void)
463 {
464 #ifndef UNITY_SUPPORT_64
465     TEST_IGNORE();
466 #else
467     UNITY_UINT64 expected[] = {0xABCD123400000000, 0xABCD112200000000, 0xABCD127700000000};
468 
469     EXPECT_ABORT_BEGIN
470     TEST_ASSERT_HEX64_ARRAY_WITHIN(0x6E00000000, expected, NULL, 3);
471     VERIFY_FAILS_END
472 #endif
473 }
474 
testHEX64ArrayWithinDeltaActualNullAndMessage(void)475 void testHEX64ArrayWithinDeltaActualNullAndMessage(void)
476 {
477 #ifndef UNITY_SUPPORT_64
478     TEST_IGNORE();
479 #else
480     UNITY_UINT64 expected[] = {0xABCD123400000000, 0xABCD112200000000, 0xABCD127700000000};
481 
482     EXPECT_ABORT_BEGIN
483     TEST_ASSERT_HEX64_ARRAY_WITHIN_MESSAGE(0x6E00000000, expected, NULL, 3, "Custom Message.");
484     VERIFY_FAILS_END
485 #endif
486 }
487 
testHEX64ArrayWithinDeltaSamePointer(void)488 void testHEX64ArrayWithinDeltaSamePointer(void)
489 {
490 #ifndef UNITY_SUPPORT_64
491     TEST_IGNORE();
492 #else
493     UNITY_UINT64 expected[] = {0xABCD123400000000, 0xABCD112200000000, 0xABCD127700000000};
494 
495     TEST_ASSERT_HEX64_ARRAY_WITHIN(0x6E00000000, expected, expected, 3);
496 #endif
497 }
498 
testHEX64ArrayWithinDeltaSamePointerAndMessage(void)499 void testHEX64ArrayWithinDeltaSamePointerAndMessage(void)
500 {
501 #ifndef UNITY_SUPPORT_64
502     TEST_IGNORE();
503 #else
504     UNITY_UINT64 expected[] = {0xABCD123400000000, 0xABCD112200000000, 0xABCD127700000000};
505 
506     TEST_ASSERT_HEX64_ARRAY_WITHIN_MESSAGE(0x6E00000000, expected, expected, 3, "Custom Message.");
507 #endif
508 }
509 
testEqualHex64s(void)510 void testEqualHex64s(void)
511 {
512 #ifndef UNITY_SUPPORT_64
513     TEST_IGNORE();
514 #else
515     UNITY_UINT64 v0, v1;
516     UNITY_UINT64 *p0, *p1;
517 
518     v0 = 0x9876543201234567;
519     v1 = 0x9876543201234567;
520     p0 = &v0;
521     p1 = &v1;
522 
523     TEST_ASSERT_EQUAL_HEX64(0x9876543201234567, 0x9876543201234567);
524     TEST_ASSERT_EQUAL_HEX64(v0, v1);
525     TEST_ASSERT_EQUAL_HEX64(0x9876543201234567, v1);
526     TEST_ASSERT_EQUAL_HEX64(v0, 0x9876543201234567);
527     TEST_ASSERT_EQUAL_HEX64(*p0, v1);
528     TEST_ASSERT_EQUAL_HEX64(*p0, *p1);
529     TEST_ASSERT_EQUAL_HEX64(*p0, 0x9876543201234567);
530 #endif
531 }
532 
testEqualUint64s(void)533 void testEqualUint64s(void)
534 {
535 #ifndef UNITY_SUPPORT_64
536     TEST_IGNORE();
537 #else
538     UNITY_UINT64 v0, v1;
539     UNITY_UINT64 *p0, *p1;
540 
541     v0 = 0x9876543201234567;
542     v1 = 0x9876543201234567;
543     p0 = &v0;
544     p1 = &v1;
545 
546     TEST_ASSERT_EQUAL_UINT64(0x9876543201234567, 0x9876543201234567);
547     TEST_ASSERT_EQUAL_UINT64(v0, v1);
548     TEST_ASSERT_EQUAL_UINT64(0x9876543201234567, v1);
549     TEST_ASSERT_EQUAL_UINT64(v0, 0x9876543201234567);
550     TEST_ASSERT_EQUAL_UINT64(*p0, v1);
551     TEST_ASSERT_EQUAL_UINT64(*p0, *p1);
552     TEST_ASSERT_EQUAL_UINT64(*p0, 0x9876543201234567);
553 #endif
554 }
555 
testEqualInt64s(void)556 void testEqualInt64s(void)
557 {
558 #ifndef UNITY_SUPPORT_64
559     TEST_IGNORE();
560 #else
561     UNITY_INT64 v0, v1;
562     UNITY_INT64 *p0, *p1;
563 
564     v0 = (UNITY_INT64)0x9876543201234567;
565     v1 = (UNITY_INT64)0x9876543201234567;
566     p0 = &v0;
567     p1 = &v1;
568 
569     TEST_ASSERT_EQUAL_INT64(0x9876543201234567, 0x9876543201234567);
570     TEST_ASSERT_EQUAL_INT64(v0, v1);
571     TEST_ASSERT_EQUAL_INT64(0x9876543201234567, v1);
572     TEST_ASSERT_EQUAL_INT64(v0, 0x9876543201234567);
573     TEST_ASSERT_EQUAL_INT64(*p0, v1);
574     TEST_ASSERT_EQUAL_INT64(*p0, *p1);
575     TEST_ASSERT_EQUAL_INT64(*p0, 0x9876543201234567);
576 #endif
577 }
578 
579 
testNotEqualHex64s(void)580 void testNotEqualHex64s(void)
581 {
582 #ifndef UNITY_SUPPORT_64
583     TEST_IGNORE();
584 #else
585     UNITY_UINT64 v0, v1;
586 
587     v0 = 9000000000;
588     v1 = 9100000000;
589 
590     EXPECT_ABORT_BEGIN
591     TEST_ASSERT_EQUAL_HEX64(v0, v1);
592     VERIFY_FAILS_END
593 #endif
594 }
595 
testNotEqualUint64s(void)596 void testNotEqualUint64s(void)
597 {
598 #ifndef UNITY_SUPPORT_64
599     TEST_IGNORE();
600 #else
601     UNITY_UINT64 v0, v1;
602 
603     v0 = 9000000000;
604     v1 = 9100000000;
605 
606     EXPECT_ABORT_BEGIN
607     TEST_ASSERT_EQUAL_UINT64(v0, v1);
608     VERIFY_FAILS_END
609 #endif
610 }
611 
testNotEqualInt64s(void)612 void testNotEqualInt64s(void)
613 {
614 #ifndef UNITY_SUPPORT_64
615     TEST_IGNORE();
616 #else
617     UNITY_INT64 v0, v1;
618 
619     v0 = -9000000000;
620     v1 = 9100000000;
621 
622     EXPECT_ABORT_BEGIN
623     TEST_ASSERT_EQUAL_INT64(v0, v1);
624     VERIFY_FAILS_END
625 #endif
626 }
627 
testNotEqualHex64sIfSigned(void)628 void testNotEqualHex64sIfSigned(void)
629 {
630 #ifndef UNITY_SUPPORT_64
631     TEST_IGNORE();
632 #else
633     UNITY_INT64 v0, v1;
634 
635     v0 = -9000000000;
636     v1 = 9000000000;
637 
638     EXPECT_ABORT_BEGIN
639     TEST_ASSERT_EQUAL_HEX64(v0, v1);
640     VERIFY_FAILS_END
641 #endif
642 }
643 
testHEX64sWithinDelta(void)644 void testHEX64sWithinDelta(void)
645 {
646 #ifndef UNITY_SUPPORT_64
647     TEST_IGNORE();
648 #else
649     TEST_ASSERT_HEX64_WITHIN(1, 0x7FFFFFFFFFFFFFFF,0x7FFFFFFFFFFFFFFE);
650     TEST_ASSERT_HEX64_WITHIN(5, 5000, 4996);
651     TEST_ASSERT_HEX64_WITHIN(5, 5000, 5005);
652 #endif
653 }
654 
testHEX64sNotWithinDelta(void)655 void testHEX64sNotWithinDelta(void)
656 {
657 #ifndef UNITY_SUPPORT_64
658     TEST_IGNORE();
659 #else
660     EXPECT_ABORT_BEGIN
661     TEST_ASSERT_HEX64_WITHIN(1, 0x7FFFFFFFFFFFFFFF, 0x7FFFFFFFFFFFFFFC);
662     VERIFY_FAILS_END
663 #endif
664 }
665 
testHEX64sNotWithinDeltaEvenThoughASignedIntWouldPass(void)666 void testHEX64sNotWithinDeltaEvenThoughASignedIntWouldPass(void)
667 {
668 #ifndef UNITY_SUPPORT_64
669     TEST_IGNORE();
670 #else
671     EXPECT_ABORT_BEGIN
672     TEST_ASSERT_HEX64_WITHIN(5, 1, -1);
673     VERIFY_FAILS_END
674 #endif
675 }
676 
testUINT64sWithinDelta(void)677 void testUINT64sWithinDelta(void)
678 {
679 #ifndef UNITY_SUPPORT_64
680     TEST_IGNORE();
681 #else
682     TEST_ASSERT_UINT64_WITHIN(1, 0x7FFFFFFFFFFFFFFF,0x7FFFFFFFFFFFFFFE);
683     TEST_ASSERT_UINT64_WITHIN(5, 5000, 4996);
684     TEST_ASSERT_UINT64_WITHIN(5, 5000, 5005);
685 #endif
686 }
687 
testUINT64sNotWithinDelta(void)688 void testUINT64sNotWithinDelta(void)
689 {
690 #ifndef UNITY_SUPPORT_64
691     TEST_IGNORE();
692 #else
693     EXPECT_ABORT_BEGIN
694     TEST_ASSERT_UINT64_WITHIN(1, 0x7FFFFFFFFFFFFFFF, 0x7FFFFFFFFFFFFFFC);
695     VERIFY_FAILS_END
696 #endif
697 }
698 
testUINT64sNotWithinDeltaEvenThoughASignedIntWouldPass(void)699 void testUINT64sNotWithinDeltaEvenThoughASignedIntWouldPass(void)
700 {
701 #ifndef UNITY_SUPPORT_64
702     TEST_IGNORE();
703 #else
704     EXPECT_ABORT_BEGIN
705     TEST_ASSERT_UINT64_WITHIN(5, 1, -1);
706     VERIFY_FAILS_END
707 #endif
708 }
709 
testINT64sWithinDelta(void)710 void testINT64sWithinDelta(void)
711 {
712 #ifndef UNITY_SUPPORT_64
713     TEST_IGNORE();
714 #else
715     TEST_ASSERT_INT64_WITHIN(1, 0x7FFFFFFFFFFFFFFF,0x7FFFFFFFFFFFFFFE);
716     TEST_ASSERT_INT64_WITHIN(5, 5000, 4996);
717     TEST_ASSERT_INT64_WITHIN(5, 5000, 5005);
718 #endif
719 }
720 
testINT64sNotWithinDelta(void)721 void testINT64sNotWithinDelta(void)
722 {
723 #ifndef UNITY_SUPPORT_64
724     TEST_IGNORE();
725 #else
726     EXPECT_ABORT_BEGIN
727     TEST_ASSERT_INT64_WITHIN(1, 0x7FFFFFFFFFFFFFFF, 0x7FFFFFFFFFFFFFFC);
728     VERIFY_FAILS_END
729 #endif
730 }
731 
testINT64sNotWithinDeltaAndDifferenceOverflows(void)732 void testINT64sNotWithinDeltaAndDifferenceOverflows(void)
733 {
734 #ifndef UNITY_SUPPORT_64
735     TEST_IGNORE();
736 #else
737     EXPECT_ABORT_BEGIN
738     TEST_ASSERT_INT64_WITHIN(1, 0x8000000000000000, 0x7FFFFFFFFFFFFFFF);
739     VERIFY_FAILS_END
740 #endif
741 }
742 
testPrintNumbersInt64(void)743 void testPrintNumbersInt64(void)
744 {
745 #ifndef UNITY_SUPPORT_64
746     TEST_IGNORE();
747 #else
748   #ifndef USING_OUTPUT_SPY
749     TEST_IGNORE();
750   #else
751     TEST_ASSERT_EQUAL_PRINT_NUMBERS("0", 0);
752     TEST_ASSERT_EQUAL_PRINT_NUMBERS("10000000000", 10000000000);
753     TEST_ASSERT_EQUAL_PRINT_NUMBERS("-9223372036854775808", (UNITY_INT)0x8000000000000000);
754     TEST_ASSERT_EQUAL_PRINT_NUMBERS("-1", (UNITY_INT)0xFFFFFFFFFFFFFFFF);
755   #endif
756 #endif
757 }
758 
testPrintNumbersUInt64(void)759 void testPrintNumbersUInt64(void)
760 {
761 #ifndef UNITY_SUPPORT_64
762     TEST_IGNORE();
763 #else
764   #ifndef USING_OUTPUT_SPY
765     TEST_IGNORE();
766   #else
767     TEST_ASSERT_EQUAL_PRINT_UNSIGNED_NUMBERS("0", 0);
768     TEST_ASSERT_EQUAL_PRINT_UNSIGNED_NUMBERS("70000000000", 70000000000);
769     TEST_ASSERT_EQUAL_PRINT_UNSIGNED_NUMBERS("9223372036854775808",  (UNITY_UINT)0x8000000000000000);
770     TEST_ASSERT_EQUAL_PRINT_UNSIGNED_NUMBERS("18446744073709551615", (UNITY_UINT)0xFFFFFFFFFFFFFFFF);
771   #endif
772 #endif
773 }
774