Github User Fetcher
1.0.0
C Application with Server and GUI
Loading...
Searching...
No Matches
assert.h
Go to the documentation of this file.
1
/*
2
* The MIT License (MIT)
3
*
4
* Copyright © 2015-2016 Franklin "Snaipe" Mathieu <http://snai.pe/>
5
*
6
* Permission is hereby granted, free of charge, to any person obtaining a copy
7
* of this software and associated documentation files (the "Software"), to deal
8
* in the Software without restriction, including without limitation the rights
9
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
* copies of the Software, and to permit persons to whom the Software is
11
* furnished to do so, subject to the following conditions:
12
*
13
* The above copyright notice and this permission notice shall be included in
14
* all copies or substantial portions of the Software.
15
*
16
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
* THE SOFTWARE.
23
*/
24
25
/**
26
* @file
27
* @brief Assertion API
28
*****************************************************************************/
29
#ifndef CRITERION_ASSERT_H_
30
#define CRITERION_ASSERT_H_
31
32
#ifdef __cplusplus
33
# include <algorithm>
34
#endif
35
36
/**
37
* @defgroup BaseAsserts Base assertions
38
* @{
39
*/
40
41
/**
42
* Fails always.
43
*
44
* The test is marked as failure and the execution of the function is aborted.
45
*
46
* The optional string is printed on failure.
47
*
48
* @param[in] FormatString (optional) printf-like format string
49
* @param[in] ... (optional) format string parameters
50
*
51
*****************************************************************************/
52
#define cr_assert_fail(FormatString, ...) internal
53
54
/**
55
* Skips the test
56
*
57
* The test is marked as skipped and the execution of the function is aborted.
58
*
59
*****************************************************************************/
60
#define cr_skip_test(FormatString, ...) internal
61
62
/**
63
* Fails always.
64
*
65
* The test is marked as failure but the execution will continue.
66
*
67
* The optional string is printed on failure.
68
*
69
* @param[in] FormatString (optional) printf-like format string
70
* @param[in] ... (optional) format string parameters
71
*
72
*****************************************************************************/
73
#define cr_expect_fail(FormatString, ...) internal
74
75
/**
76
* Passes if Condition is true
77
*
78
* Evaluates the condition and passes if it is true.
79
* Otherwise the test is marked as failure and the execution of the function
80
* is aborted.
81
*
82
* The optional string is printed on failure.
83
*
84
* @param[in] Condition Condition to test
85
* @param[in] FormatString (optional) printf-like format string
86
* @param[in] ... (optional) format string parameters
87
*
88
*****************************************************************************/
89
#define cr_assert(Condition, FormatString, ...) internal
90
91
/**
92
* Passes if Condition is true
93
*
94
* Evaluates the condition and passes if it is true.
95
* Otherwise the test is marked as failure but the execution will continue.
96
*
97
* The optional string is printed on failure.
98
*
99
* @param[in] Condition Condition to test
100
* @param[in] FormatString (optional) printf-like format string
101
* @param[in] ... (optional) format string parameters
102
*
103
*****************************************************************************/
104
#define cr_expect(Condition, FormatString, ...) internal
105
106
/**
107
* Passes if Condition is false
108
*
109
* Evaluates the condition and passes if it is false.
110
* Otherwise the test is marked as failure and the execution of the function
111
* is aborted.
112
*
113
* The optional string is printed on failure.
114
*
115
* @param[in] Condition Condition to test
116
* @param[in] FormatString (optional) printf-like format string
117
* @param[in] ... (optional) format string parameters
118
*
119
*****************************************************************************/
120
#define cr_assert_not(Condition, FormatString, ...) internal
121
122
/**
123
* Passes if Condition is false
124
*
125
* Evaluates the condition and passes if it is false.
126
* Otherwise the test is marked as failure but the execution will continue.
127
*
128
* The optional string is printed on failure.
129
*
130
* @param[in] Condition Condition to test
131
* @param[in] FormatString (optional) printf-like format string
132
* @param[in] ... (optional) format string parameters
133
*
134
*****************************************************************************/
135
#define cr_expect_not(Condition, FormatString, ...) internal
136
137
/**@}*/
138
139
/**
140
* @defgroup CommonBinAsserts Common binary assertions
141
* @{
142
*/
143
144
/**
145
* Passes if Actual is equal to Expected
146
*
147
* Passes if Actual is equal to Expected.
148
* Otherwise the test is marked as failure and the execution of the function
149
* is aborted.
150
*
151
* The optional string is printed on failure.
152
*
153
* @note Compatible with C++ operator overloading.
154
*
155
* @param[in] Actual Value to test
156
* @param[in] Expected Expected value
157
* @param[in] FormatString (optional) printf-like format string
158
* @param[in] ... (optional) format string parameters
159
*
160
*****************************************************************************/
161
#define cr_assert_eq(Actual, Expected, FormatString, ...) internal
162
163
/**
164
* Passes if Actual is equal to Expected
165
*
166
* Passes if Actual is equal to Expected.
167
* Otherwise the test is marked as failure but the execution will continue.
168
*
169
* The optional string is printed on failure.
170
*
171
* @note Compatible with C++ operator overloading.
172
*
173
* @param[in] Actual Value to test
174
* @param[in] Expected Expected value
175
* @param[in] FormatString (optional) printf-like format string
176
* @param[in] ... (optional) format string parameters
177
*
178
*****************************************************************************/
179
#define cr_expect_eq(Actual, Expected, FormatString, ...) internal
180
181
/**
182
* Passes if Actual is not equal to Unexpected
183
*
184
* Passes if Actual is not equal to Unexpected
185
* Otherwise the test is marked as failure and the execution of the function
186
* is aborted.
187
*
188
* The optional string is printed on failure.
189
*
190
* @note Compatible with C++ operator overloading.
191
*
192
* @param[in] Actual Value to test
193
* @param[in] Unexpected Unexpected Value
194
* @param[in] FormatString (optional) printf-like format string
195
* @param[in] ... (optional) format string parameters
196
*
197
*****************************************************************************/
198
#define cr_assert_neq(Actual, Unexpected, FormatString, ...) internal
199
200
/**
201
* Passes if Actual is not equal to Unexpected
202
*
203
* Passes if Actual is not equal to Unexpected.
204
* Otherwise the test is marked as failure but the execution will continue.
205
*
206
* The optional string is printed on failure.
207
*
208
* @note Compatible with C++ operator overloading.
209
*
210
* @param[in] Actual Value to test
211
* @param[in] Unexpected Unexpected Value
212
* @param[in] FormatString (optional) printf-like format string
213
* @param[in] ... (optional) format string parameters
214
*
215
*****************************************************************************/
216
#define cr_expect_neq(Actual, Unexpected, FormatString, ...) internal
217
218
/**
219
* Passes if Actual is less than Reference
220
*
221
* Passes if Actual is less than Reference.
222
* Otherwise the test is marked as failure and the execution of the function
223
* is aborted.
224
*
225
* The optional string is printed on failure.
226
*
227
* @note Compatible with C++ operator overloading.
228
*
229
* @param[in] Actual Value to test
230
* @param[in] Reference Reference value
231
* @param[in] FormatString (optional) printf-like format string
232
* @param[in] ... (optional) format string parameters
233
*
234
*****************************************************************************/
235
#define cr_assert_lt(Actual, Reference, FormatString, ...) internal
236
237
/**
238
* Passes if Actual is less than Reference
239
*
240
* Passes if Actual is less than Reference.
241
* Otherwise the test is marked as failure but the execution will continue.
242
*
243
* The optional string is printed on failure.
244
*
245
* @note Compatible with C++ operator overloading.
246
*
247
* @param[in] Actual Value to test
248
* @param[in] Reference Reference value
249
* @param[in] FormatString (optional) printf-like format string
250
* @param[in] ... (optional) format string parameters
251
*
252
*****************************************************************************/
253
#define cr_expect_lt(Actual, Reference, FormatString, ...) internal
254
255
/**
256
* Passes if Actual is less or equal to Reference
257
*
258
* Passes if Actual is less or equal to Reference.
259
* Otherwise the test is marked as failure and the execution of the function
260
* is aborted.
261
*
262
* The optional string is printed on failure.
263
*
264
* @note Compatible with C++ operator overloading.
265
*
266
* @param[in] Actual Value to test
267
* @param[in] Reference Reference value
268
* @param[in] FormatString (optional) printf-like format string
269
* @param[in] ... (optional) format string parameters
270
*
271
*****************************************************************************/
272
#define cr_assert_leq(Actual, Reference, FormatString, ...) internal
273
274
/**
275
* Passes if Actual is less or equal to Reference
276
*
277
* Passes if Actual is less or equal to Reference.
278
* Otherwise the test is marked as failure but the execution will continue.
279
*
280
* The optional string is printed on failure.
281
*
282
* @note Compatible with C++ operator overloading.
283
*
284
* @param[in] Actual Value to test
285
* @param[in] Reference Reference value
286
* @param[in] FormatString (optional) printf-like format string
287
* @param[in] ... (optional) format string parameters
288
*
289
*****************************************************************************/
290
#define cr_expect_leq(Actual, Reference, FormatString, ...) internal
291
292
/**
293
* Passes if Actual is greater than Reference
294
*
295
* Passes if Actual is greater than Reference.
296
* Otherwise the test is marked as failure and the execution of the function
297
* is aborted.
298
*
299
* The optional string is printed on failure.
300
*
301
* @note Compatible with C++ operator overloading.
302
*
303
* @param[in] Actual Value to test
304
* @param[in] Reference Reference value
305
* @param[in] FormatString (optional) printf-like format string
306
* @param[in] ... (optional) format string parameters
307
*
308
*****************************************************************************/
309
#define cr_assert_gt(Actual, Reference, FormatString, ...) internal
310
311
/**
312
* Passes if Actual is greater than Reference
313
*
314
* Passes if Actual is greater than Reference.
315
* Otherwise the test is marked as failure but the execution will continue.
316
*
317
* The optional string is printed on failure.
318
*
319
* @note Compatible with C++ operator overloading.
320
*
321
* @param[in] Actual Value to test
322
* @param[in] Reference Reference value
323
* @param[in] FormatString (optional) printf-like format string
324
* @param[in] ... (optional) format string parameters
325
*
326
*****************************************************************************/
327
#define cr_expect_gt(Actual, Reference, FormatString, ...) internal
328
329
/**
330
* Passes if Actual is greater or equal to Reference
331
*
332
* Passes if Actual is greater or equal to Reference.
333
* Otherwise the test is marked as failure and the execution of the function
334
* is aborted.
335
*
336
* The optional string is printed on failure.
337
*
338
* @note Compatible with C++ operator overloading.
339
*
340
* @param[in] Actual Value to test
341
* @param[in] Reference Reference value
342
* @param[in] FormatString (optional) printf-like format string
343
* @param[in] ... (optional) format string parameters
344
*
345
*****************************************************************************/
346
#define cr_assert_geq(Actual, Reference, FormatString, ...) internal
347
348
/**
349
* Passes if Actual is greater or equal to Reference
350
*
351
* Passes if Actual is greater or equal to Reference.
352
* Otherwise the test is marked as failure but the execution will continue.
353
*
354
* The optional string is printed on failure.
355
*
356
* @note Compatible with C++ operator overloading.
357
*
358
* @param[in] Actual Value to test
359
* @param[in] Reference Reference value
360
* @param[in] FormatString (optional) printf-like format string
361
* @param[in] ... (optional) format string parameters
362
*
363
*****************************************************************************/
364
#define cr_expect_geq(Actual, Reference, FormatString, ...) internal
365
366
/**@}*/
367
368
/**
369
* @defgroup CommonUnaryAsserts Common unary assertions
370
* @{
371
*/
372
373
/**
374
* Passes if Value is NULL
375
*
376
* Passes if Value is NULL.
377
* Otherwise the test is marked as failure and the execution of the function
378
* is aborted.
379
*
380
* The optional string is printed on failure.
381
*
382
* @param[in] Actual Value to test
383
* @param[in] FormatString (optional) printf-like format string
384
* @param[in] ... (optional) format string parameters
385
*
386
*****************************************************************************/
387
#define cr_assert_null(Value, FormatString, ...) internal
388
389
/**
390
* Passes if Value is NULL
391
*
392
* Passes if Value is NULL.
393
* Otherwise the test is marked as failure but the execution will continue.
394
*
395
* The optional string is printed on failure.
396
*
397
* @param[in] Actual Value to test
398
* @param[in] FormatString (optional) printf-like format string
399
* @param[in] ... (optional) format string parameters
400
*
401
*****************************************************************************/
402
#define cr_expect_null(Value, FormatString, ...) internal
403
404
/**
405
* Passes if Value is not NULL
406
*
407
* Passes if Value is not NULL.
408
* Otherwise the test is marked as failure and the execution of the function
409
* is aborted.
410
*
411
* The optional string is printed on failure.
412
*
413
* @param[in] Value Value to test
414
* @param[in] FormatString (optional) printf-like format string
415
* @param[in] ... (optional) format string parameters
416
*
417
*****************************************************************************/
418
#define cr_assert_not_null(Value, FormatString, ...) internal
419
420
/**
421
* Passes if Value is not NULL
422
*
423
* Passes if Value is not NULL.
424
* Otherwise the test is marked as failure but the execution will continue.
425
*
426
* The optional string is printed on failure.
427
*
428
* @param[in] Value Value to test
429
* @param[in] FormatString (optional) printf-like format string
430
* @param[in] ... (optional) format string parameters
431
*
432
*****************************************************************************/
433
#define cr_expect_not_null(Value, FormatString, ...) internal
434
435
/**@}*/
436
437
/**
438
* @defgroup FloatAsserts Floating-point assertions
439
* @{
440
*/
441
442
/**
443
* Passes if Actual is equal to Expected with a tolerance of Epsilon
444
*
445
* Passes if Actual is equal to Expected with a tolerance of Epsilon.
446
* Otherwise the test is marked as failure and the execution of the function
447
* is aborted.
448
*
449
* The optional string is printed on failure.
450
*
451
* @note Use this to test equality between floats
452
*
453
* @param[in] Actual Value to test
454
* @param[in] Expected Expected value
455
* @param[in] Epsilon Tolerance between Actual and Expected
456
* @param[in] FormatString (optional) printf-like format string
457
* @param[in] ... (optional) format string parameters
458
*
459
*****************************************************************************/
460
#define cr_assert_float_eq(Actual, Expected, Epsilon, FormatString, ...) internal
461
462
/**
463
* Passes if Actual is equal to Expected with a tolerance of Epsilon
464
*
465
* Passes if Actual is equal to Expected with a tolerance of Epsilon.
466
* Otherwise the test is marked as failure but the execution will continue.
467
*
468
* The optional string is printed on failure.
469
*
470
* @note Use this to test equality between floats
471
*
472
* @param[in] Actual Value to test
473
* @param[in] Expected Expected value
474
* @param[in] Epsilon Tolerance between Actual and Expected
475
* @param[in] FormatString (optional) printf-like format string
476
* @param[in] ... (optional) format string parameters
477
*
478
*****************************************************************************/
479
#define cr_expect_float_eq(Actual, Expected, Epsilon, FormatString, ...) internal
480
481
/**
482
* Passes if Actual is not equal to Unexpected with a tolerance of Epsilon
483
*
484
* Passes if Actual is not equal to Unexpected with a tolerance of Epsilon.
485
* Otherwise the test is marked as failure and the execution of the function
486
* is aborted.
487
*
488
* The optional string is printed on failure.
489
*
490
* @note Use this to test inequality between floats
491
*
492
* @param[in] Actual Value to test
493
* @param[in] Unexpected Unexpected value
494
* @param[in] Epsilon Tolerance between Actual and Expected
495
* @param[in] FormatString (optional) printf-like format string
496
* @param[in] ... (optional) format string parameters
497
*
498
*****************************************************************************/
499
#define cr_assert_float_neq(Actual, Unexpected, Epsilon, FormatString, ...) internal
500
501
/**
502
* Passes if Actual is not equal to Unexpected with a tolerance of Epsilon
503
*
504
* Passes if Actual is not equal to Unexpected with a tolerance of Epsilon.
505
* Otherwise the test is marked as failure but the execution will continue.
506
*
507
* The optional string is printed on failure.
508
*
509
* @note Use this to test inequality between floats
510
*
511
* @param[in] Actual Value to test
512
* @param[in] Unexpected Unexpected value
513
* @param[in] Epsilon Tolerance between Actual and Expected
514
* @param[in] FormatString (optional) printf-like format string
515
* @param[in] ... (optional) format string parameters
516
*
517
*****************************************************************************/
518
#define cr_expect_float_neq(Actual, Unexpected, Epsilon, FormatString, ...) internal
519
520
/**@}*/
521
522
/**
523
* @defgroup StringAsserts String assertions
524
*
525
* @note
526
* These macros are meant to deal with *native* strings, i.e. char arrays.
527
* Most of them won't work on ``std::string`` in C++, with some exceptions --
528
* for ``std::string``, you should use regular comparison assersions.
529
*
530
* @{
531
*/
532
533
/**
534
* Passes if Value is an empty string
535
*
536
* Passes if Value is an empty string.
537
* Otherwise the test is marked as failure and the execution of the function
538
* is aborted.
539
*
540
* The optional string is printed on failure.
541
*
542
* @note Also works on std::string.
543
*
544
* @param[in] Value String to test
545
* @param[in] FormatString (optional) printf-like format string
546
* @param[in] ... (optional) format string parameters
547
*
548
*****************************************************************************/
549
#define cr_assert_str_empty(Value, FormatString, ...) internal
550
551
/**
552
* Passes if Value is an empty string
553
*
554
* Passes if Value is an empty string.
555
* Otherwise the test is marked as failure but the execution will continue.
556
*
557
* The optional string is printed on failure.
558
*
559
* @note Also works on std::string.
560
*
561
* @param[in] Value String to test
562
* @param[in] FormatString (optional) printf-like format string
563
* @param[in] ... (optional) format string parameters
564
*
565
*****************************************************************************/
566
#define cr_expect_str_empty(Value, FormatString, ...) internal
567
568
/**
569
* Passes if Value is not an empty string
570
*
571
* Passes if Value is not an empty string.
572
* Otherwise the test is marked as failure and the execution of the function
573
* is aborted.
574
*
575
* The optional string is printed on failure.
576
*
577
* @note Also works on std::string.
578
*
579
* @param[in] Value String to test
580
* @param[in] FormatString (optional) printf-like format string
581
* @param[in] ... (optional) format string parameters
582
*
583
*****************************************************************************/
584
#define cr_assert_str_not_empty(Value, FormatString, ...) internal
585
586
/**
587
* Passes if Value is not an empty string
588
*
589
* Passes if Value is not an empty string.
590
* Otherwise the test is marked as failure but the execution will continue.
591
*
592
* The optional string is printed on failure.
593
*
594
* @note Also works on std::string.
595
*
596
* @param[in] Value String to test
597
* @param[in] FormatString (optional) printf-like format string
598
* @param[in] ... (optional) format string parameters
599
*
600
*****************************************************************************/
601
#define cr_expect_str_not_empty(Value, FormatString, ...) internal
602
603
/**
604
* Passes if Actual is lexicographically equal to Expected
605
*
606
* Passes if Actual is lexicographically equal to Expected.
607
* Otherwise the test is marked as failure and the execution of the function
608
* is aborted.
609
*
610
* The optional string is printed on failure.
611
*
612
* @param[in] Actual String to test
613
* @param[in] Expected Expected String
614
* @param[in] FormatString (optional) printf-like format string
615
* @param[in] ... (optional) format string parameters
616
*
617
*****************************************************************************/
618
#define cr_assert_str_eq(Actual, Expected, FormatString, ...) internal
619
620
/**
621
* Passes if Actual is lexicographically equal to Expected
622
*
623
* Passes if Actual is lexicographically equal to Expected.
624
* Otherwise the test is marked as failure but the execution will continue.
625
*
626
* The optional string is printed on failure.
627
*
628
* @param[in] Actual String to test
629
* @param[in] Expected Expected String
630
* @param[in] FormatString (optional) printf-like format string
631
* @param[in] ... (optional) format string parameters
632
*
633
*****************************************************************************/
634
#define cr_expect_str_eq(Actual, Expected, FormatString, ...) internal
635
636
/**
637
* Passes if Actual is not lexicographically equal to Unexpected
638
*
639
* Passes if Actual is not lexicographically equal to Unexpected.
640
* Otherwise the test is marked as failure and the execution of the function
641
* is aborted.
642
*
643
* The optional string is printed on failure.
644
*
645
* @param[in] Actual String to test
646
* @param[in] Unexpected Unexpected String
647
* @param[in] FormatString (optional) printf-like format string
648
* @param[in] ... (optional) format string parameters
649
*
650
*****************************************************************************/
651
#define cr_assert_str_neq(Actual, Unexpected, FormatString, ...) internal
652
653
/**
654
* Passes if Actual is not lexicographically equal to Unexpected
655
*
656
* Passes if Actual is not lexicographically equal to Unexpected.
657
* Otherwise the test is marked as failure but the execution will continue.
658
*
659
* The optional string is printed on failure.
660
*
661
* @param[in] Actual String to test
662
* @param[in] Unexpected Unexpected String
663
* @param[in] FormatString (optional) printf-like format string
664
* @param[in] ... (optional) format string parameters
665
*
666
*****************************************************************************/
667
#define cr_expect_str_neq(Actual, Unexpected, FormatString, ...) internal
668
669
/**
670
* Passes if Actual is lexicographically less than Reference
671
*
672
* Passes if Actual is lexicographically less than Reference.
673
* Otherwise the test is marked as failure and the execution of the function
674
* is aborted.
675
*
676
* The optional string is printed on failure.
677
*
678
* @param[in] Actual String to test
679
* @param[in] Reference Reference String
680
* @param[in] FormatString (optional) printf-like format string
681
* @param[in] ... (optional) format string parameters
682
*
683
*****************************************************************************/
684
#define cr_assert_str_lt(Actual, Reference, FormatString, ...) internal
685
686
/**
687
* Passes if Actual is lexicographically less than Reference
688
*
689
* Passes if Actual is lexicographically less than Reference.
690
* Otherwise the test is marked as failure but the execution will continue.
691
*
692
* The optional string is printed on failure.
693
*
694
* @param[in] Actual String to test
695
* @param[in] Reference Reference String
696
* @param[in] FormatString (optional) printf-like format string
697
* @param[in] ... (optional) format string parameters
698
*
699
*****************************************************************************/
700
#define cr_expect_str_lt(Actual, Reference, FormatString, ...) internal
701
702
/**
703
* Passes if Actual is lexicographically less or equal to Reference
704
*
705
* Passes if Actual is lexicographically less or equal to Reference.
706
* Otherwise the test is marked as failure and the execution of the function
707
* is aborted.
708
*
709
* The optional string is printed on failure.
710
*
711
* @param[in] Actual String to test
712
* @param[in] Reference Reference String
713
* @param[in] FormatString (optional) printf-like format string
714
* @param[in] ... (optional) format string parameters
715
*
716
*****************************************************************************/
717
#define cr_assert_str_leq(Actual, Reference, FormatString, ...) internal
718
719
/**
720
* Passes if Actual is lexicographically less or equal to Reference
721
*
722
* Passes if Actual is lexicographically less or equal to Reference.
723
* Otherwise the test is marked as failure but the execution will continue.
724
*
725
* The optional string is printed on failure.
726
*
727
* @param[in] Actual String to test
728
* @param[in] Reference Reference String
729
* @param[in] FormatString (optional) printf-like format string
730
* @param[in] ... (optional) format string parameters
731
*
732
*****************************************************************************/
733
#define cr_expect_str_leq(Actual, Reference, FormatString, ...) internal
734
735
/**
736
* Passes if Actual is lexicographically greater than Reference
737
*
738
* Passes if Actual is lexicographically greater than Reference.
739
* Otherwise the test is marked as failure and the execution of the function
740
* is aborted.
741
*
742
* The optional string is printed on failure.
743
*
744
* @param[in] Actual String to test
745
* @param[in] Reference Reference String
746
* @param[in] FormatString (optional) printf-like format string
747
* @param[in] ... (optional) format string parameters
748
*
749
*****************************************************************************/
750
#define cr_assert_str_gt(Actual, Reference, FormatString, ...) internal
751
752
/**
753
* Passes if Actual is lexicographically greater than Reference
754
*
755
* Passes if Actual is lexicographically greater than Reference.
756
* Otherwise the test is marked as failure but the execution will continue.
757
*
758
* The optional string is printed on failure.
759
*
760
* @param[in] Actual String to test
761
* @param[in] Reference Reference String
762
* @param[in] FormatString (optional) printf-like format string
763
* @param[in] ... (optional) format string parameters
764
*
765
*****************************************************************************/
766
#define cr_expect_str_gt(Actual, Reference, FormatString, ...) internal
767
768
/**
769
* Passes if Actual is lexicographically greater or equal to Reference
770
*
771
* Passes if Actual is lexicographically greater or equal to Reference.
772
* Otherwise the test is marked as failure and the execution of the function
773
* is aborted.
774
*
775
* The optional string is printed on failure.
776
*
777
* @param[in] Actual String to test
778
* @param[in] Reference Reference String
779
* @param[in] FormatString (optional) printf-like format string
780
* @param[in] ... (optional) format string parameters
781
*
782
*****************************************************************************/
783
#define cr_assert_str_geq(Actual, Reference, FormatString, ...) internal
784
785
/**
786
* Passes if Actual is lexicographically greater or equal to Reference
787
*
788
* Passes if Actual is lexicographically greater or equal to Reference.
789
* Otherwise the test is marked as failure but the execution will continue.
790
*
791
* The optional string is printed on failure.
792
*
793
* @param[in] Actual String to test
794
* @param[in] Reference Reference String
795
* @param[in] FormatString (optional) printf-like format string
796
* @param[in] ... (optional) format string parameters
797
*
798
*****************************************************************************/
799
#define cr_expect_str_geq(Actual, Reference, FormatString, ...) internal
800
801
/**@}*/
802
803
/**
804
* @defgroup WideStringAsserts Wide String Assertions
805
*
806
* @note
807
* These macros are meant to deal with *native* wide character strings, i.e.
808
* wchar_t arrays. Most of them won't work on ``std::wstring`` in C++, with
809
* some exceptions -- for ``std::wstring``, you should use regular comparison
810
* assertions.
811
*
812
* @{
813
*/
814
815
/**
816
* Passes if Value is an empty wide string
817
*
818
* Passes if Value is an empty wide string.
819
* Otherwise the test is marked as failure and the execution of the function
820
* is aborted.
821
*
822
* The optional (non-wide) string is printed on failure.
823
*
824
* @note Also works on std::wstring.
825
*
826
* @param[in] Value Wide string to test
827
* @param[in] FormatString (optional) printf-like format string
828
* @param[in] ... (optional) format string parameters
829
*
830
*****************************************************************************/
831
#define cr_assert_wcs_empty(Value, FormatString, ...) internal
832
833
/**
834
* Passes if Value is an empty wide string
835
*
836
* Passes if Value is an empty wide string.
837
* Otherwise the test is marked as failure but the execution will continue.
838
*
839
* The optional (non-wide) string is printed on failure.
840
*
841
* @note Also works on std::wstring.
842
*
843
* @param[in] Value Wide string to test
844
* @param[in] FormatString (optional) printf-like format string
845
* @param[in] ... (optional) format string parameters
846
*
847
*****************************************************************************/
848
#define cr_expect_wcs_empty(Value, FormatString, ...) internal
849
850
/**
851
* Passes if Value is not an empty wide string
852
*
853
* Passes if Value is not an empty wide string.
854
* Otherwise the test is marked as failure and the execution of the function
855
* is aborted.
856
*
857
* The optional (non-wide) string is printed on failure.
858
*
859
* @note Also works on std::string.
860
*
861
* @param[in] Value Wide string to test
862
* @param[in] FormatString (optional) printf-like format string
863
* @param[in] ... (optional) format string parameters
864
*
865
*****************************************************************************/
866
#define cr_assert_wcs_not_empty(Value, FormatString, ...) internal
867
868
/**
869
* Passes if Value is not an empty wide string
870
*
871
* Passes if Value is not an empty wide string.
872
* Otherwise the test is marked as failure but the execution will continue.
873
*
874
* The optional (non-wide) string is printed on failure.
875
*
876
* @note Also works on std::string.
877
*
878
* @param[in] Value Wide string to test
879
* @param[in] FormatString (optional) printf-like format string
880
* @param[in] ... (optional) format string parameters
881
*
882
*****************************************************************************/
883
#define cr_expect_wcs_not_empty(Value, FormatString, ...) internal
884
885
/**
886
* Passes if Actual is lexicographically equal to Expected
887
*
888
* Passes if Actual is lexicographically equal to Expected.
889
* Otherwise the test is marked as failure and the execution of the function
890
* is aborted.
891
*
892
* The optional (non-wide) string is printed on failure.
893
*
894
* @param[in] Actual Wide string to test
895
* @param[in] Expected Expected wide string
896
* @param[in] FormatString (optional) printf-like format string
897
* @param[in] ... (optional) format string parameters
898
*
899
*****************************************************************************/
900
#define cr_assert_wcs_eq(Actual, Expected, FormatString, ...) internal
901
902
/**
903
* Passes if Actual is lexicographically equal to Expected
904
*
905
* Passes if Actual is lexicographically equal to Expected.
906
* Otherwise the test is marked as failure but the execution will continue.
907
*
908
* The optional (non-wide) string is printed on failure.
909
*
910
* @param[in] Actual Wide string to test
911
* @param[in] Expected Expected wide string
912
* @param[in] FormatString (optional) printf-like format string
913
* @param[in] ... (optional) format string parameters
914
*
915
*****************************************************************************/
916
#define cr_expect_wcs_eq(Actual, Expected, FormatString, ...) internal
917
918
/**
919
* Passes if Actual is not lexicographically equal to Unexpected
920
*
921
* Passes if Actual is not lexicographically equal to Unexpected.
922
* Otherwise the test is marked as failure and the execution of the function
923
* is aborted.
924
*
925
* The optional (non-wide) string is printed on failure.
926
*
927
* @param[in] Actual Wide string to test
928
* @param[in] Unexpected Unexpected wide string
929
* @param[in] FormatString (optional) printf-like format string
930
* @param[in] ... (optional) format string parameters
931
*
932
*****************************************************************************/
933
#define cr_assert_wcs_neq(Actual, Unexpected, FormatString, ...) internal
934
935
/**
936
* Passes if Actual is not lexicographically equal to Unexpected
937
*
938
* Passes if Actual is not lexicographically equal to Unexpected.
939
* Otherwise the test is marked as failure but the execution will continue.
940
*
941
* The optional (non-wide) string is printed on failure.
942
*
943
* @param[in] Actual Wide string to test
944
* @param[in] Unexpected Unexpected wide string
945
* @param[in] FormatString (optional) printf-like format string
946
* @param[in] ... (optional) format string parameters
947
*
948
*****************************************************************************/
949
#define cr_expect_wcs_neq(Actual, Unexpected, FormatString, ...) internal
950
951
/**
952
* Passes if Actual is lexicographically less than Reference
953
*
954
* Passes if Actual is lexicographically less than Reference.
955
* Otherwise the test is marked as failure and the execution of the function
956
* is aborted.
957
*
958
* The optional (non-wide) string is printed on failure.
959
*
960
* @param[in] Actual Wide string to test
961
* @param[in] Reference Reference wide string
962
* @param[in] FormatString (optional) printf-like format string
963
* @param[in] ... (optional) format string parameters
964
*
965
*****************************************************************************/
966
#define cr_assert_wcs_lt(Actual, Reference, FormatString, ...) internal
967
968
/**
969
* Passes if Actual is lexicographically less than Reference
970
*
971
* Passes if Actual is lexicographically less than Reference.
972
* Otherwise the test is marked as failure but the execution will continue.
973
*
974
* The optional (non-wide) string is printed on failure.
975
*
976
* @param[in] Actual Wide string to test
977
* @param[in] Reference Reference wide string
978
* @param[in] FormatString (optional) printf-like format string
979
* @param[in] ... (optional) format string parameters
980
*
981
*****************************************************************************/
982
#define cr_expect_wcs_lt(Actual, Reference, FormatString, ...) internal
983
984
/**
985
* Passes if Actual is lexicographically less or equal to Reference
986
*
987
* Passes if Actual is lexicographically less or equal to Reference.
988
* Otherwise the test is marked as failure and the execution of the function
989
* is aborted.
990
*
991
* The optional (non-wide) string is printed on failure.
992
*
993
* @param[in] Actual Wide string to test
994
* @param[in] Reference Reference wide string
995
* @param[in] FormatString (optional) printf-like format string
996
* @param[in] ... (optional) format string parameters
997
*
998
*****************************************************************************/
999
#define cr_assert_wcs_leq(Actual, Reference, FormatString, ...) internal
1000
1001
/**
1002
* Passes if Actual is lexicographically less or equal to Reference
1003
*
1004
* Passes if Actual is lexicographically less or equal to Reference.
1005
* Otherwise the test is marked as failure but the execution will continue.
1006
*
1007
* The optional (non-wide) string is printed on failure.
1008
*
1009
* @param[in] Actual Wide string to test
1010
* @param[in] Reference Reference wide string
1011
* @param[in] FormatString (optional) printf-like format string
1012
* @param[in] ... (optional) format string parameters
1013
*
1014
*****************************************************************************/
1015
#define cr_expect_wcs_leq(Actual, Reference, FormatString, ...) internal
1016
1017
/**
1018
* Passes if Actual is lexicographically greater than Reference
1019
*
1020
* Passes if Actual is lexicographically greater than Reference.
1021
* Otherwise the test is marked as failure and the execution of the function
1022
* is aborted.
1023
*
1024
* The optional (non-wide) string is printed on failure.
1025
*
1026
* @param[in] Actual Wide string to test
1027
* @param[in] Reference Reference wide string
1028
* @param[in] FormatString (optional) printf-like format string
1029
* @param[in] ... (optional) format string parameters
1030
*
1031
*****************************************************************************/
1032
#define cr_assert_wcs_gt(Actual, Reference, FormatString, ...) internal
1033
1034
/**
1035
* Passes if Actual is lexicographically greater than Reference
1036
*
1037
* Passes if Actual is lexicographically greater than Reference.
1038
* Otherwise the test is marked as failure but the execution will continue.
1039
*
1040
* The optional (non-wide) string is printed on failure.
1041
*
1042
* @param[in] Actual Wide string to test
1043
* @param[in] Reference Reference wide string
1044
* @param[in] FormatString (optional) printf-like format string
1045
* @param[in] ... (optional) format string parameters
1046
*
1047
*****************************************************************************/
1048
#define cr_expect_wcs_gt(Actual, Reference, FormatString, ...) internal
1049
1050
/**
1051
* Passes if Actual is lexicographically greater or equal to Reference
1052
*
1053
* Passes if Actual is lexicographically greater or equal to Reference.
1054
* Otherwise the test is marked as failure and the execution of the function
1055
* is aborted.
1056
*
1057
* The optional (non-wide) string is printed on failure.
1058
*
1059
* @param[in] Actual Wide string to test
1060
* @param[in] Reference Reference wide string
1061
* @param[in] FormatString (optional) printf-like format string
1062
* @param[in] ... (optional) format string parameters
1063
*
1064
*****************************************************************************/
1065
#define cr_assert_wcs_geq(Actual, Reference, FormatString, ...) internal
1066
1067
/**
1068
* Passes if Actual is lexicographically greater or equal to Reference
1069
*
1070
* Passes if Actual is lexicographically greater or equal to Reference.
1071
* Otherwise the test is marked as failure but the execution will continue.
1072
*
1073
* The optional (non-wide) string is printed on failure.
1074
*
1075
* @param[in] Actual Wide string to test
1076
* @param[in] Reference Reference wide string
1077
* @param[in] FormatString (optional) printf-like format string
1078
* @param[in] ... (optional) format string parameters
1079
*
1080
*****************************************************************************/
1081
#define cr_expect_wcs_geq(Actual, Reference, FormatString, ...) internal
1082
1083
/**@}*/
1084
1085
/**
1086
* @defgroup ArrayAsserts Array assertions
1087
* @{
1088
*/
1089
1090
/**
1091
* Passes if Actual is byte-to-byte equal to Expected
1092
*
1093
* Passes if Actual is byte-to-byte equal to Expected.
1094
* Otherwise the test is marked as failure and the execution of the function
1095
* is aborted.
1096
*
1097
* The optional string is printed on failure.
1098
*
1099
* @warning This should not be used on struct arrays, consider using \c
1100
* cr_assert_arr_eq_cmp() instead.
1101
*
1102
* @param[in] Actual Array to test
1103
* @param[in] Expected Expected array
1104
* @param[in] Size Number of bytes to check
1105
* @param[in] FormatString (optional) printf-like format string
1106
* @param[in] ... (optional) format string parameters
1107
*
1108
*****************************************************************************/
1109
#define cr_assert_arr_eq(Actual, Expected, Size, FormatString, ...) internal
1110
1111
/**
1112
* Passes if Actual is byte-to-byte equal to Expected
1113
*
1114
* Passes if Actual is byte-to-byte equal to Expected.
1115
* Otherwise the test is marked as failure but the execution will continue.
1116
*
1117
* The optional string is printed on failure.
1118
*
1119
* @warning This should not be used on struct arrays, consider using \c
1120
* cr_expect_arr_eq_cmp() instead.
1121
*
1122
* @param[in] Actual Array to test
1123
* @param[in] Expected Expected array
1124
* @param[in] Size Number of bytes to check
1125
* @param[in] FormatString (optional) printf-like format string
1126
* @param[in] ... (optional) format string parameters
1127
*
1128
*****************************************************************************/
1129
#define cr_expect_arr_eq(Actual, Expected, Size, FormatString, ...) internal
1130
1131
/**
1132
* Passes if Actual is not byte-to-byte equal to Expected
1133
*
1134
* Passes if Actual is not byte-to-byte equal to Unexpected.
1135
* Otherwise the test is marked as failure and the execution of the function
1136
* is aborted.
1137
*
1138
* The optional string is printed on failure.
1139
*
1140
* @warning This should not be used on struct arrays, consider using \c
1141
* cr_assert_arr_neq_cmp() instead.
1142
*
1143
* @param[in] Actual Array to test
1144
* @param[in] Unexpected Unexpected array
1145
* @param[in] Size Number of bytes to check
1146
* @param[in] FormatString (optional) printf-like format string
1147
* @param[in] ... (optional) format string parameters
1148
*
1149
*****************************************************************************/
1150
#define cr_assert_arr_neq(Actual, Unexpected, Size, FormatString, ...) internal
1151
1152
/**
1153
* Passes if Actual is not byte-to-byte equal to Unexpected
1154
*
1155
* Passes if Actual is not byte-to-byte equal to Expected.
1156
* Otherwise the test is marked as failure but the execution will continue.
1157
*
1158
* The optional string is printed on failure.
1159
*
1160
* @warning This should not be used on struct arrays, consider using \c
1161
* cr_expect_arr_neq_cmp() instead.
1162
*
1163
* @param[in] Actual Array to test
1164
* @param[in] Unexpected Unexpected array
1165
* @param[in] Size Number of bytes to check
1166
* @param[in] FormatString (optional) printf-like format string
1167
* @param[in] ... (optional) format string parameters
1168
*
1169
*****************************************************************************/
1170
#define cr_expect_arr_neq(Actual, Unexpected, Size, FormatString, ...) internal
1171
1172
/**@}*/
1173
1174
/**
1175
* @defgroup SafeArrCmpAsserts Safe array comparison assertions
1176
* @brief C++ / GNU C only!
1177
*
1178
* These macros are only available on C++ compilers.
1179
* @{
1180
*/
1181
1182
/**
1183
* Passes if Actual is comparatively equal to Expected (C++ / GNU C99 only)
1184
*
1185
* Passes if Actual is comparatively equal to Expected.
1186
* Otherwise the test is marked as failure and the execution of the function
1187
* is aborted.
1188
*
1189
* The macro takes a `int (*comparator)(typeof(Actual) a, typeof(Expected) b)`
1190
* function pointer, that returns -1, 0, or 1 when `a` is respectively less,
1191
* equal to, or greater than `b`.
1192
*
1193
* The optional string is printed on failure.
1194
*
1195
* @note This macro is only available on C++ and GNU C compilers.
1196
*
1197
* @param[in] Actual Array to test
1198
* @param[in] Expected Expected array
1199
* @param[in] Size Number of bytes to check
1200
* @param[in] Cmp The comparator to use
1201
* @param[in] FormatString (optional) printf-like format string
1202
* @param[in] ... (optional) format string parameters
1203
*
1204
*****************************************************************************/
1205
#define cr_assert_arr_eq_cmp(Actual, Expected, Size, Cmp, FormatString, ...) internal
1206
1207
/**
1208
* Passes if Actual is comparatively equal to Expected (C++ / GNU C99 only)
1209
*
1210
* Passes if Actual is comparatively equal to Expected.
1211
* Otherwise the test is marked as failure but the execution will continue.
1212
*
1213
* The macro takes a `int (*comparator)(typeof(Actual) a, typeof(Expected) b)`
1214
* function pointer, that returns -1, 0, or 1 when `a` is respectively less,
1215
* equal to, or greater than `b`.
1216
*
1217
* The optional string is printed on failure.
1218
*
1219
* @note This macro is only available on C++ and GNU C compilers.
1220
*
1221
* @param[in] Actual Array to test
1222
* @param[in] Expected Expected array
1223
* @param[in] Size Number of bytes to check
1224
* @param[in] Cmp The comparator to use
1225
* @param[in] FormatString (optional) printf-like format string
1226
* @param[in] ... (optional) format string parameters
1227
*
1228
*****************************************************************************/
1229
#define cr_expect_arr_eq_cmp(Actual, Expected, Size, Cmp, FormatString, ...) internal
1230
1231
/**
1232
* Passes if Actual is not comparatively equal to Unexpected (C++ / GNU C99
1233
* only)
1234
*
1235
* Passes if Actual is not comparatively equal to Unexpected.
1236
* Otherwise the test is marked as failure and the execution of the function
1237
* is aborted.
1238
*
1239
* The macro takes a `int (*comparator)(typeof(Actual) a, typeof(Expected) b)`
1240
* function pointer, that returns -1, 0, or 1 when `a` is respectively less,
1241
* equal to, or greater than `b`.
1242
*
1243
* The optional string is printed on failure.
1244
*
1245
* @note This macro is only available on C++ and GNU C compilers.
1246
*
1247
* @param[in] Actual Array to test
1248
* @param[in] Unexpected Unexpected array
1249
* @param[in] Size Number of bytes to check
1250
* @param[in] Cmp The comparator to use
1251
* @param[in] FormatString (optional) printf-like format string
1252
* @param[in] ... (optional) format string parameters
1253
*
1254
*****************************************************************************/
1255
#define cr_assert_arr_neq_cmp(Actual, Unexpected, Size, Cmp, FormatString, ...) internal
1256
1257
/**
1258
* Passes if Actual is not comparatively equal to Unexpected (C++ / GNU C99
1259
* only)
1260
*
1261
* Passes if Actual is not comparatively equal to Unexpected.
1262
* Otherwise the test is marked as failure but the execution will continue.
1263
*
1264
* The macro takes a `int (*comparator)(typeof(Actual) a, typeof(Expected) b)`
1265
* function pointer, that returns -1, 0, or 1 when `a` is respectively less,
1266
* equal to, or greater than `b`.
1267
*
1268
* The optional string is printed on failure.
1269
*
1270
* @note This macro is only available on C++ and GNU C compilers.
1271
*
1272
* @param[in] Actual Array to test
1273
* @param[in] Unexpected Unexpected array
1274
* @param[in] Size Number of bytes to check
1275
* @param[in] Cmp The comparator to use
1276
* @param[in] FormatString (optional) printf-like format string
1277
* @param[in] ... (optional) format string parameters
1278
*
1279
*****************************************************************************/
1280
#define cr_expect_arr_neq_cmp(Actual, Unexpected, Size, Cmp, FormatString, ...) internal
1281
1282
/**
1283
* Passes if Actual is comparatively less than Reference (C++ / GNU C99 only)
1284
*
1285
* Passes if Actual is comparatively less than Reference.
1286
* Otherwise the test is marked as failure and the execution of the function
1287
* is aborted.
1288
*
1289
* The macro takes a `int (*comparator)(typeof(Actual) a, typeof(Expected) b)`
1290
* function pointer, that returns -1, 0, or 1 when `a` is respectively less,
1291
* equal to, or greater than `b`.
1292
*
1293
* The optional string is printed on failure.
1294
*
1295
* @note This macro is only available on C++ and GNU C compilers.
1296
*
1297
* @param[in] Actual Array to test
1298
* @param[in] Reference Reference array
1299
* @param[in] Size Number of bytes to check
1300
* @param[in] Cmp The comparator to use
1301
* @param[in] FormatString (optional) printf-like format string
1302
* @param[in] ... (optional) format string parameters
1303
*
1304
*****************************************************************************/
1305
#define cr_assert_arr_lt_cmp(Actual, Reference, Size, Cmp, FormatString, ...) internal
1306
1307
/**
1308
* Passes if Actual is comparatively less than Reference (C++ / GNU C99 only)
1309
*
1310
* Passes if Actual is comparatively less than Reference.
1311
* Otherwise the test is marked as failure but the execution will continue.
1312
*
1313
* The macro takes a `int (*comparator)(typeof(Actual) a, typeof(Expected) b)`
1314
* function pointer, that returns -1, 0, or 1 when `a` is respectively less,
1315
* equal to, or greater than `b`.
1316
*
1317
* The optional string is printed on failure.
1318
*
1319
* @note This macro is only available on C++ and GNU C compilers.
1320
*
1321
* @param[in] Actual Array to test
1322
* @param[in] Reference Reference array
1323
* @param[in] Size Number of bytes to check
1324
* @param[in] Cmp The comparator to use
1325
* @param[in] FormatString (optional) printf-like format string
1326
* @param[in] ... (optional) format string parameters
1327
*
1328
*****************************************************************************/
1329
#define cr_expect_arr_lt_cmp(Actual, Reference, Size, Cmp, FormatString, ...) internal
1330
1331
/**
1332
* Passes if Actual is comparatively less or equal to Reference (C++ / GNU C99
1333
* only)
1334
*
1335
* Passes if Actual is comparatively less or equal to Reference.
1336
* Otherwise the test is marked as failure and the execution of the function
1337
* is aborted.
1338
*
1339
* The macro takes a `int (*comparator)(typeof(Actual) a, typeof(Expected) b)`
1340
* function pointer, that returns -1, 0, or 1 when `a` is respectively less,
1341
* equal to, or greater than `b`.
1342
*
1343
* The optional string is printed on failure.
1344
*
1345
* @note This macro is only available on C++ and GNU C compilers.
1346
*
1347
* @param[in] Actual Array to test
1348
* @param[in] Reference Reference array
1349
* @param[in] Size Number of bytes to check
1350
* @param[in] Cmp The comparator to use
1351
* @param[in] FormatString (optional) printf-like format string
1352
* @param[in] ... (optional) format string parameters
1353
*
1354
*****************************************************************************/
1355
#define cr_assert_arr_leq_cmp(Actual, Reference, Size, Cmp, FormatString, ...) internal
1356
1357
/**
1358
* Passes if Actual is comparatively less or equal to Reference (C++ / GNU C99
1359
* only)
1360
*
1361
* Passes if Actual is comparatively less or equal to Reference.
1362
* Otherwise the test is marked as failure but the execution will continue.
1363
*
1364
* The macro takes a `int (*comparator)(typeof(Actual) a, typeof(Expected) b)`
1365
* function pointer, that returns -1, 0, or 1 when `a` is respectively less,
1366
* equal to, or greater than `b`.
1367
*
1368
* The optional string is printed on failure.
1369
*
1370
* @note This macro is only available on C++ and GNU C compilers.
1371
*
1372
* @param[in] Actual Array to test
1373
* @param[in] Reference Reference array
1374
* @param[in] Size Number of bytes to check
1375
* @param[in] Cmp The comparator to use
1376
* @param[in] FormatString (optional) printf-like format string
1377
* @param[in] ... (optional) format string parameters
1378
*
1379
*****************************************************************************/
1380
#define cr_expect_arr_leq_cmp(Actual, Reference, Size, Cmp, FormatString, ...) internal
1381
1382
/**
1383
* Passes if Actual is comparatively greater than Reference (C++ / GNU C99 only)
1384
*
1385
* Passes if Actual is comparatively greater than Reference.
1386
* Otherwise the test is marked as failure and the execution of the function
1387
* is aborted.
1388
*
1389
* The macro takes a `int (*comparator)(typeof(Actual) a, typeof(Expected) b)`
1390
* function pointer, that returns -1, 0, or 1 when `a` is respectively less,
1391
* equal to, or greater than `b`.
1392
*
1393
* The optional string is printed on failure.
1394
*
1395
* @note This macro is only available on C++ and GNU C compilers.
1396
*
1397
* @param[in] Actual Array to test
1398
* @param[in] Reference Reference array
1399
* @param[in] Size Number of bytes to check
1400
* @param[in] Cmp The comparator to use
1401
* @param[in] FormatString (optional) printf-like format string
1402
* @param[in] ... (optional) format string parameters
1403
*
1404
*****************************************************************************/
1405
#define cr_assert_arr_gt_cmp(Actual, Reference, Size, Cmp, FormatString, ...) internal
1406
1407
/**
1408
* Passes if Actual is comparatively greater than Reference (C++ / GNU C99 only)
1409
*
1410
* Passes if Actual is comparatively greater than Reference.
1411
* Otherwise the test is marked as failure but the execution will continue.
1412
*
1413
* The macro takes a `int (*comparator)(typeof(Actual) a, typeof(Expected) b)`
1414
* function pointer, that returns -1, 0, or 1 when `a` is respectively less,
1415
* equal to, or greater than `b`.
1416
*
1417
* The optional string is printed on failure.
1418
*
1419
* @note This macro is only available on C++ and GNU C compilers.
1420
*
1421
* @param[in] Actual Array to test
1422
* @param[in] Reference Reference array
1423
* @param[in] Size Number of bytes to check
1424
* @param[in] Cmp The comparator to use
1425
* @param[in] FormatString (optional) printf-like format string
1426
* @param[in] ... (optional) format string parameters
1427
*
1428
*****************************************************************************/
1429
#define cr_expect_arr_gt_cmp(Actual, Reference, Size, Cmp, FormatString, ...) internal
1430
1431
/**
1432
* Passes if Actual is comparatively greater or equal to Reference (C++ / GNU
1433
* C99 only)
1434
*
1435
* Passes if Actual is comparatively greater or equal to Reference.
1436
* Otherwise the test is marked as failure and the execution of the function
1437
* is aborted.
1438
*
1439
* The macro takes a `int (*comparator)(typeof(Actual) a, typeof(Expected) b)`
1440
* function pointer, that returns -1, 0, or 1 when `a` is respectively less,
1441
* equal to, or greater than `b`.
1442
*
1443
* The optional string is printed on failure.
1444
*
1445
* @note This macro is only available on C++ and GNU C compilers.
1446
*
1447
* @param[in] Actual Array to test
1448
* @param[in] Reference Reference array
1449
* @param[in] Size Number of bytes to check
1450
* @param[in] Cmp The comparator to use
1451
* @param[in] FormatString (optional) printf-like format string
1452
* @param[in] ... (optional) format string parameters
1453
*
1454
*****************************************************************************/
1455
#define cr_assert_arr_geq_cmp(Actual, Reference, Size, Cmp, FormatString, ...) internal
1456
1457
/**
1458
* Passes if Actual is comparatively greater or equal to Reference (C++ / GNU
1459
* C99 only)
1460
*
1461
* Passes if Actual is comparatively greater or equal to Reference.
1462
* Otherwise the test is marked as failure but the execution will continue.
1463
*
1464
* The macro takes a `int (*comparator)(typeof(Actual) a, typeof(Expected) b)`
1465
* function pointer, that returns -1, 0, or 1 when `a` is respectively less,
1466
* equal to, or greater than `b`.
1467
*
1468
* The optional string is printed on failure.
1469
*
1470
* @note This macro is only available on C++ and GNU C compilers.
1471
*
1472
* @param[in] Actual Array to test
1473
* @param[in] Reference Reference array
1474
* @param[in] Size Number of bytes to check
1475
* @param[in] Cmp The comparator to use
1476
* @param[in] FormatString (optional) printf-like format string
1477
* @param[in] ... (optional) format string parameters
1478
*
1479
*****************************************************************************/
1480
#define cr_expect_arr_geq_cmp(Actual, Reference, Size, Cmp, FormatString, ...) internal
1481
1482
/**@}*/
1483
1484
#ifdef __cplusplus
1485
1486
/**
1487
* @defgroup ExceptionAsserts Exception asserts
1488
* @brief C++ only!
1489
*
1490
* These macros are only available on C++ compilers.
1491
* @{
1492
*/
1493
1494
/**
1495
* Passes if Statement throws an instance of Exception (C++ only)
1496
*
1497
* Passes if Statement throws an instance of Exception.
1498
* Otherwise the test is marked as failure and the execution of the function
1499
* is aborted.
1500
*
1501
* The optional string is printed on failure.
1502
*
1503
* @note This macro is only available on C++ compilers.
1504
*
1505
* @param[in] Statement Statement to be executed
1506
* @param[in] Exception Expected exception
1507
* @param[in] FormatString (optional) printf-like format string
1508
* @param[in] ... (optional) format string parameters
1509
*
1510
*****************************************************************************/
1511
# define cr_assert_throw(Statement, Exception, FormatString, ...) internal
1512
1513
/**
1514
* Passes if Statement throws an instance of Exception (C++ only)
1515
*
1516
* Passes if Statement throws an instance of Exception.
1517
* Otherwise the test is marked as failure but the execution will continue.
1518
*
1519
* The optional string is printed on failure.
1520
*
1521
* @note This macro is only available on C++ compilers.
1522
*
1523
* @param[in] Statement Statement to be executed
1524
* @param[in] Exception Expected exception
1525
* @param[in] FormatString (optional) printf-like format string
1526
* @param[in] ... (optional) format string parameters
1527
*
1528
*****************************************************************************/
1529
# define cr_expect_throw(Statement, Exception, FormatString, ...) internal
1530
1531
/**
1532
* Passes if Statement does not throws an instance of Exception (C++ only)
1533
*
1534
* Passes if Statement does not throws an instance of Exception.
1535
* Otherwise the test is marked as failure and the execution of the function
1536
* is aborted.
1537
*
1538
* The optional string is printed on failure.
1539
*
1540
* @note This macro is only available on C++ compilers.
1541
*
1542
* @param[in] Statement Statement to be executed
1543
* @param[in] Exception Unexpected exception
1544
* @param[in] FormatString (optional) printf-like format string
1545
* @param[in] ... (optional) format string parameters
1546
*
1547
*****************************************************************************/
1548
# define cr_assert_no_throw(Statement, Exception, FormatString, ...) internal
1549
1550
/**
1551
* Passes if Statement does not throws an instance of Exception (C++ only)
1552
*
1553
* Passes if Statement does not throws an instance of Exception.
1554
* Otherwise the test is marked as failure but the execution will continue.
1555
*
1556
* The optional string is printed on failure.
1557
*
1558
* @note This macro is only available on C++ compilers.
1559
*
1560
* @param[in] Statement Statement to be executed
1561
* @param[in] Exception Unexpected exception
1562
* @param[in] FormatString (optional) printf-like format string
1563
* @param[in] ... (optional) format string parameters
1564
*
1565
*****************************************************************************/
1566
# define cr_expect_no_throw(Statement, Exception, FormatString, ...) internal
1567
1568
/**
1569
* Passes if Statement throws any kind of exception (C++ only)
1570
*
1571
* Passes if Statement throws any kind of exception
1572
* Otherwise the test is marked as failure and the execution of the function
1573
* is aborted.
1574
*
1575
* The optional string is printed on failure.
1576
*
1577
* @note This macro is only available on C++ compilers.
1578
*
1579
* @param[in] Statement Statement to be executed
1580
* @param[in] FormatString (optional) printf-like format string
1581
* @param[in] ... (optional) format string parameters
1582
*
1583
*****************************************************************************/
1584
# define cr_assert_any_throw(Statement, FormatString, ...) internal
1585
1586
/**
1587
* Passes if Statement throws any kind of exception (C++ only)
1588
*
1589
* Passes if Statement throws any kind of exception
1590
* Otherwise the test is marked as failure but the execution will continue.
1591
*
1592
* The optional string is printed on failure.
1593
*
1594
* @note This macro is only available on C++ compilers.
1595
*
1596
* @param[in] Statement Statement to be executed
1597
* @param[in] FormatString (optional) printf-like format string
1598
* @param[in] ... (optional) format string parameters
1599
*
1600
*****************************************************************************/
1601
# define cr_expect_any_throw(Statement, FormatString, ...) internal
1602
1603
/**
1604
* Passes if Statement does not throws any kind of exception (C++ only)
1605
*
1606
* Passes if Statement does not throws any kind of exception
1607
* Otherwise the test is marked as failure and the execution of the function
1608
* is aborted.
1609
*
1610
* The optional string is printed on failure.
1611
*
1612
* @note This macro is only available on C++ compilers.
1613
*
1614
* @param[in] Statement Statement to be executed
1615
* @param[in] FormatString (optional) printf-like format string
1616
* @param[in] ... (optional) format string parameters
1617
*
1618
*****************************************************************************/
1619
# define cr_assert_none_throw(Statement, FormatString, ...) internal
1620
1621
/**
1622
* Passes if Statement does not throws any kind of exception (C++ only)
1623
*
1624
* Passes if Statement does not throws any kind of exception
1625
* Otherwise the test is marked as failure but the execution will continue.
1626
*
1627
* The optional string is printed on failure.
1628
*
1629
* @note This macro is only available on C++ compilers.
1630
*
1631
* @param[in] Statement Statement to be executed
1632
* @param[in] FormatString (optional) printf-like format string
1633
* @param[in] ... (optional) format string parameters
1634
*
1635
*****************************************************************************/
1636
# define cr_expect_none_throw(Statement, FormatString, ...) internal
1637
1638
#endif
1639
/**@}*/
1640
1641
/** @cond CRITERION_DOC_DEPRECATED */
1642
1643
/* The section below is here for backward compatibility purposes.
1644
It shall be removed in the next major version of Criterion */
1645
#ifndef CRITERION_NO_COMPAT
1646
1647
# define CRITERION_ASSERT_DEPRECATED_B(Name, Newname) \
1648
CRITERION_ASSERT_DEPRECATED__( \
1649
message \
1650
("The `" #Name "` macro is deprecated, " \
1651
"please use `" #Newname "` instead.") \
1652
)
1653
1654
# ifdef _MSC_VER
1655
# define CRITERION_ASSERT_DEPRECATED__(Msg) \
1656
__pragma(Msg)
1657
# else
1658
# define CRITERION_ASSERT_DEPRECATED__(Msg) \
1659
_Pragma(#Msg)
1660
# endif
1661
1662
/* scheduled for removal after 2.0 */
1663
# define cr_abort_test(Message) CRITERION_ASSERT_DEPRECATED_B(cr_abort_test, cr_assert_fail) cr_assert_fail(Message)
1664
# define cr_assert_strings_eq(...) CRITERION_ASSERT_DEPRECATED_B(cr_assert_strings_eq, cr_assert_str_eq) cr_assert_str_eq(__VA_ARGS__)
1665
# define cr_assert_strings_neq(...) CRITERION_ASSERT_DEPRECATED_B(cr_assert_strings_neq, cr_assert_str_neq) cr_assert_str_neq(__VA_ARGS__)
1666
# define cr_assert_strings_lt(...) CRITERION_ASSERT_DEPRECATED_B(cr_assert_strings_lt, cr_assert_str_lt) cr_assert_str_lt(__VA_ARGS__)
1667
# define cr_assert_strings_leq(...) CRITERION_ASSERT_DEPRECATED_B(cr_assert_strings_leq, cr_assert_str_leq) cr_assert_str_leq(__VA_ARGS__)
1668
# define cr_assert_strings_gt(...) CRITERION_ASSERT_DEPRECATED_B(cr_assert_strings_gt, cr_assert_str_gt) cr_assert_str_gt(__VA_ARGS__)
1669
# define cr_assert_strings_geq(...) CRITERION_ASSERT_DEPRECATED_B(cr_assert_strings_geq, cr_assert_str_geq) cr_assert_str_geq(__VA_ARGS__)
1670
1671
# define cr_assert_arrays_eq(...) CRITERION_ASSERT_DEPRECATED_B(cr_assert_arrays_eq, cr_assert_arr_eq) cr_assert_arr_eq(__VA_ARGS__)
1672
# define cr_assert_arrays_neq(...) CRITERION_ASSERT_DEPRECATED_B(cr_assert_arrays_neq, cr_assert_arr_neq) cr_assert_arr_neq(__VA_ARGS__)
1673
1674
# define cr_assert_arrays_eq_cmp(...) CRITERION_ASSERT_DEPRECATED_B(cr_assert_arrays_eq_cmp, cr_assert_arr_eq_cmp) cr_assert_arr_eq_cmp(__VA_ARGS__)
1675
# define cr_assert_arrays_neq_cmp(...) CRITERION_ASSERT_DEPRECATED_B(cr_assert_arrays_neq_cmp, cr_assert_arr_neq_cmp) cr_assert_arr_neq_cmp(__VA_ARGS__)
1676
1677
#endif
1678
1679
/** @endcond */
1680
1681
#include "
internal/assert.h
"
1682
1683
#endif
/* !CRITERION_ASSERT_H_ */
assert.h
nix
store
2xpcmdrzviw89gzpf8p7l7691wk51i89-criterion-2.4.2-dev
include
criterion
assert.h
Generated by
1.10.0