Mercurial > libbase64
comparison extern/librexo/rexo.h @ 38:c25a01b2229b
tests: switch to rexo
author | David Demelier <markand@malikania.fr> |
---|---|
date | Mon, 11 Oct 2021 17:03:45 +0200 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
37:7c10de272d6b | 38:c25a01b2229b |
---|---|
1 /* | |
2 This is free and unencumbered software released into the public domain. | |
3 | |
4 Anyone is free to copy, modify, publish, use, compile, sell, or | |
5 distribute this software, either in source code form or as a compiled | |
6 binary, for any purpose, commercial or non-commercial, and by any | |
7 means. | |
8 | |
9 In jurisdictions that recognize copyright laws, the author or authors | |
10 of this software dedicate any and all copyright interest in the | |
11 software to the public domain. We make this dedication for the benefit | |
12 of the public at large and to the detriment of our heirs and | |
13 successors. We intend this dedication to be an overt act of | |
14 relinquishment in perpetuity of all present and future rights to this | |
15 software under copyright law. | |
16 | |
17 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | |
18 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | |
19 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. | |
20 IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR | |
21 OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | |
22 ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | |
23 OTHER DEALINGS IN THE SOFTWARE. | |
24 | |
25 For more information, please refer to <https://unlicense.org> | |
26 */ | |
27 | |
28 #ifndef REXO_REXO_H | |
29 #define REXO_REXO_H | |
30 | |
31 #define RX_MAJOR_VERSION 0 | |
32 #define RX_MINOR_VERSION 2 | |
33 #define RX_PATCH_VERSION 2 | |
34 | |
35 #define RX_VERSION \ | |
36 ((RX_MAJOR_VERSION << 20) | (RX_MINOR_VERSION << 10) | (RX_PATCH_VERSION)) | |
37 | |
38 /* | |
39 The environment macro represents whether the code is to be generated for a | |
40 32-bit or 64-bit target platform. Some CPUs, such as the x86-64 processors, | |
41 allow running code in 32-bit mode if compiled using the -m32 or -mx32 | |
42 compiler switches, in which case `RX__ENVIRONMENT` is set to 32. | |
43 */ | |
44 #if (!(defined(__x86_64__) || defined(_M_X64)) || defined(__ILP32__)) \ | |
45 && !(defined(__itanium__) || defined(_M_IA64)) \ | |
46 && !(defined(__powerpc64__) || defined(__ppc64__)) \ | |
47 && !defined(__aarch64__) | |
48 #define RX__ENVIRONMENT 32 | |
49 #else | |
50 #define RX__ENVIRONMENT 64 | |
51 #endif | |
52 | |
53 /* | |
54 The common data models, that is ILP32 (most recent 32-bit systems), | |
55 LP64 (Unix-like systems), and LLP64 (Windows), all have the `int` type set to | |
56 32 bits, and the `long long` type to 64 bits. | |
57 */ | |
58 #if defined(RX_UINT32_TYPE) | |
59 typedef RX_UINT32_TYPE rx_uint32; | |
60 #else | |
61 typedef unsigned int rx_uint32; | |
62 #endif | |
63 typedef char rx__invalid_uint32_type[sizeof(rx_uint32) == 4 ? 1 : -1]; | |
64 | |
65 #if defined(RX_UINT64_TYPE) | |
66 typedef RX_UINT64_TYPE rx_uint64; | |
67 #else | |
68 #if defined(__GNUC__) | |
69 #pragma GCC diagnostic push | |
70 #pragma GCC diagnostic ignored "-Wlong-long" | |
71 #endif | |
72 /* | |
73 Even though the `long long` type is not part of the C89 and C++98 | |
74 standards, assume that it's defined by current compilers. | |
75 */ | |
76 typedef unsigned long long rx_uint64; | |
77 #if defined(__GNUC__) | |
78 #pragma GCC diagnostic pop | |
79 #endif | |
80 #endif | |
81 typedef char rx__invalid_uint64_type[sizeof(rx_uint64) == 8 ? 1 : -1]; | |
82 | |
83 /* | |
84 The C standard provides no guarantees about the size of the type `size_t`, | |
85 and some exotic platforms will in fact provide original values, but this | |
86 should cover most of the use cases. | |
87 */ | |
88 #if defined(RX_SIZE_TYPE) | |
89 typedef RX_SIZE_TYPE rx_size; | |
90 #elif RX__ENVIRONMENT == 32 | |
91 typedef rx_uint32 rx_size; | |
92 #else | |
93 typedef rx_uint64 rx_size; | |
94 #endif | |
95 | |
96 #if defined(RX_ENABLE_EXTERNAL_LINKING) | |
97 #define RX__STORAGE extern | |
98 #else | |
99 #define RX__STORAGE static | |
100 #endif | |
101 | |
102 #if defined(__GNUC__) | |
103 #define RX__MAYBE_UNUSED __attribute__((unused)) | |
104 #else | |
105 #define RX__MAYBE_UNUSED | |
106 #endif | |
107 | |
108 #if defined(_MSC_VER) | |
109 #define RX__DEFINE_PARAMS(type) \ | |
110 _Pragma("warning(push)") \ | |
111 _Pragma("warning(disable : 4100)") \ | |
112 struct rx_context *RX_PARAM_CONTEXT RX__MAYBE_UNUSED, \ | |
113 type *RX_PARAM_DATA RX__MAYBE_UNUSED \ | |
114 _Pragma("warning(pop)") | |
115 #else | |
116 #define RX__DEFINE_PARAMS(type) \ | |
117 struct rx_context *RX_PARAM_CONTEXT RX__MAYBE_UNUSED, \ | |
118 type *RX_PARAM_DATA RX__MAYBE_UNUSED | |
119 #endif | |
120 | |
121 /* | |
122 Support compilers that checks printf-style functions. | |
123 */ | |
124 #if defined(__GNUC__) | |
125 #define RX__PRINTF_CHECK(fmt, args) \ | |
126 __attribute__((format (printf, (fmt), (args)))) | |
127 #else | |
128 #define RX__PRINTF_CHECK(fmt, args) | |
129 #endif | |
130 | |
131 /* Public Interface O-(''Q) | |
132 -------------------------------------------------------------------------- */ | |
133 | |
134 #define RX_PARAM_CONTEXT rx__context | |
135 #define RX_PARAM_DATA rx__data | |
136 | |
137 #define RX_DATA RX_PARAM_DATA | |
138 | |
139 enum rx_status { | |
140 RX_SUCCESS = 0, | |
141 RX_ERROR = -1, | |
142 RX_ERROR_ABORTED = -2, | |
143 RX_ERROR_ALLOCATION = -3, | |
144 RX_ERROR_MAX_SIZE_EXCEEDED = -4 | |
145 }; | |
146 | |
147 enum rx_severity { RX_NONFATAL = 0, RX_FATAL = 1 }; | |
148 | |
149 enum rx_log_level { | |
150 RX_LOG_LEVEL_NONE = 0, | |
151 RX_LOG_LEVEL_FATAL = 1, | |
152 RX_LOG_LEVEL_ERROR = 3, | |
153 RX_LOG_LEVEL_WARNING = 4, | |
154 RX_LOG_LEVEL_INFO = 5, | |
155 RX_LOG_LEVEL_DEBUG = 6, | |
156 RX_LOG_LEVEL_ALL = RX_LOG_LEVEL_DEBUG | |
157 }; | |
158 | |
159 struct rx_context; | |
160 | |
161 typedef enum rx_status (*rx_set_up_fn)(RX__DEFINE_PARAMS(void)); | |
162 typedef void (*rx_tear_down_fn)(RX__DEFINE_PARAMS(void)); | |
163 typedef void (*rx_run_fn)(RX__DEFINE_PARAMS(void)); | |
164 | |
165 struct rx_fixture_config { | |
166 rx_set_up_fn set_up; | |
167 rx_tear_down_fn tear_down; | |
168 }; | |
169 | |
170 struct rx_fixture { | |
171 rx_size size; | |
172 struct rx_fixture_config config; | |
173 }; | |
174 | |
175 struct rx_test_case_config { | |
176 int skip; | |
177 struct rx_fixture fixture; | |
178 }; | |
179 | |
180 struct rx_test_case { | |
181 const char *suite_name; | |
182 const char *name; | |
183 rx_run_fn run; | |
184 struct rx_test_case_config config; | |
185 }; | |
186 | |
187 struct rx_failure { | |
188 const char *file; | |
189 int line; | |
190 enum rx_severity severity; | |
191 const char *msg; | |
192 const char *diagnostic_msg; | |
193 }; | |
194 | |
195 struct rx_summary { | |
196 const struct rx_test_case *test_case; | |
197 int skipped; | |
198 const char *error; | |
199 rx_size assessed_count; | |
200 rx_size failure_count; | |
201 struct rx_failure *failures; | |
202 rx_uint64 elapsed; | |
203 }; | |
204 | |
205 struct rx_summary_group { | |
206 rx_size count; | |
207 const struct rx_summary *array; | |
208 }; | |
209 | |
210 #if defined(__cplusplus) | |
211 extern "C" { | |
212 #endif | |
213 | |
214 RX__STORAGE void | |
215 rx_abort(struct rx_context *context); | |
216 | |
217 RX__STORAGE enum rx_status | |
218 rx_handle_test_result(struct rx_context *context, | |
219 int result, | |
220 const char *file, | |
221 int line, | |
222 enum rx_severity severity, | |
223 const char *failure_msg, | |
224 const char *diagnostic_msg); | |
225 | |
226 RX__STORAGE enum rx_status | |
227 rx_summary_initialize(struct rx_summary *summary, | |
228 const struct rx_test_case *test_case); | |
229 | |
230 RX__STORAGE void | |
231 rx_summary_terminate(struct rx_summary *summary); | |
232 | |
233 RX__STORAGE void | |
234 rx_summary_print(const struct rx_summary *summary); | |
235 | |
236 RX__STORAGE void | |
237 rx_sort_summaries_by_test_suite(struct rx_summary *summaries, | |
238 rx_size summary_count); | |
239 | |
240 RX__STORAGE void | |
241 rx_group_summaries_by_test_suite(rx_size *summary_group_count, | |
242 struct rx_summary_group *summary_groups, | |
243 rx_size summary_count, | |
244 const struct rx_summary *summaries); | |
245 | |
246 RX__STORAGE enum rx_status | |
247 rx_test_case_run(struct rx_summary *summary, | |
248 const struct rx_test_case *test_case); | |
249 | |
250 RX__STORAGE void | |
251 rx_enumerate_test_cases(rx_size *test_case_count, | |
252 struct rx_test_case *test_cases); | |
253 | |
254 RX__STORAGE enum rx_status | |
255 rx_run(rx_size test_case_count, const struct rx_test_case *test_cases); | |
256 | |
257 RX__STORAGE enum rx_status | |
258 rx_main(rx_size test_case_count, | |
259 const struct rx_test_case *test_cases, | |
260 int argc, | |
261 const char **argv); | |
262 | |
263 #if defined(__cplusplus) | |
264 } | |
265 #endif | |
266 | |
267 /* Helpers O-(''Q) | |
268 -------------------------------------------------------------------------- */ | |
269 | |
270 #define RX__LANG_C 0 | |
271 #define RX__LANG_CPP 1 | |
272 | |
273 #if defined(__cplusplus) | |
274 #define RX__LANG RX__LANG_CPP | |
275 #define RX__LANG_VERSION __cplusplus | |
276 #else | |
277 #define RX__LANG RX__LANG_C | |
278 #if defined(__STDC_VERSION__) | |
279 #define RX__LANG_VERSION __STDC_VERSION__ | |
280 #else | |
281 #define RX__LANG_VERSION 0L | |
282 #endif | |
283 #endif | |
284 | |
285 #if defined(RX_DISABLE_NPRINTF) \ | |
286 || (!defined(RX_ENABLE_NPRINTF) \ | |
287 && !defined(_MSC_VER) \ | |
288 && ((RX__LANG == RX__LANG_C && RX__LANG_VERSION < 199901L) \ | |
289 || (RX__LANG == RX__LANG_CPP && RX__LANG_VERSION < 201103L))) | |
290 #define RX__HAS_NPRINTF 0 | |
291 #else | |
292 #define RX__HAS_NPRINTF 1 | |
293 #endif | |
294 | |
295 #if defined(RX_DISABLE_VARIADIC_MACROS) \ | |
296 || (!defined(RX_ENABLE_VARIADIC_MACROS) \ | |
297 && !defined(_MSC_VER) \ | |
298 && ((RX__LANG == RX__LANG_C && RX__LANG_VERSION < 199901L) \ | |
299 || (RX__LANG == RX__LANG_CPP && RX__LANG_VERSION < 201103L))) | |
300 #define RX__HAS_VARIADIC_MACROS 0 | |
301 #else | |
302 #define RX__HAS_VARIADIC_MACROS 1 | |
303 #endif | |
304 | |
305 #define RX__FALSE ((int)0) | |
306 #define RX__TRUE ((int)1) | |
307 | |
308 /* Automatic Registration Framework O-(''Q) | |
309 -------------------------------------------------------------------------- */ | |
310 | |
311 #define RX_SET_UP(id) \ | |
312 static enum rx_status \ | |
313 id(RX__DEFINE_PARAMS(void)) | |
314 | |
315 #define RX_TEAR_DOWN(id) \ | |
316 static void \ | |
317 id(RX__DEFINE_PARAMS(void)) | |
318 | |
319 #if RX__HAS_VARIADIC_MACROS | |
320 #define RX_FIXTURE(...) \ | |
321 RX__EXPAND( \ | |
322 RX__CONCAT( \ | |
323 RX__FIXTURE_DISPATCH_, \ | |
324 RX__HAS_AT_LEAST_3_ARGS(__VA_ARGS__) \ | |
325 )(__VA_ARGS__)) \ | |
326 RX__REQUIRE_SEMICOLON | |
327 | |
328 #define RX__FIXTURE_DISPATCH_0(id, type) \ | |
329 RX__FIXTURE_0(id, sizeof(type)) | |
330 | |
331 #define RX__FIXTURE_DISPATCH_1(id, type, ...) \ | |
332 RX__FIXTURE_1(id, \ | |
333 sizeof(type), \ | |
334 RX__COUNT_ARGS(__VA_ARGS__), \ | |
335 (__VA_ARGS__)) | |
336 #else | |
337 #define RX_FIXTURE(id, type) \ | |
338 RX__FIXTURE_0(id, sizeof(type)) \ | |
339 RX__REQUIRE_SEMICOLON | |
340 | |
341 #define RX_FIXTURE_1(id, type, _0) \ | |
342 RX__FIXTURE_1(id, sizeof(type), 1, (_0)) \ | |
343 RX__REQUIRE_SEMICOLON | |
344 | |
345 #define RX_FIXTURE_2(id, type, _0, _1) \ | |
346 RX__FIXTURE_1(id, sizeof(type), 2, (_0, _1)) \ | |
347 RX__REQUIRE_SEMICOLON | |
348 #endif | |
349 | |
350 #if RX__HAS_VARIADIC_MACROS | |
351 #define RX_VOID_FIXTURE(...) \ | |
352 RX__EXPAND( \ | |
353 RX__CONCAT( \ | |
354 RX__VOID_FIXTURE_DISPATCH_, \ | |
355 RX__HAS_AT_LEAST_2_ARGS(__VA_ARGS__) \ | |
356 )(__VA_ARGS__)) \ | |
357 RX__REQUIRE_SEMICOLON | |
358 | |
359 #define RX__VOID_FIXTURE_DISPATCH_0(id) \ | |
360 RX__FIXTURE_0(id, 0) | |
361 | |
362 #define RX__VOID_FIXTURE_DISPATCH_1(id, ...) \ | |
363 RX__FIXTURE_1(id, \ | |
364 0, \ | |
365 RX__COUNT_ARGS(__VA_ARGS__), \ | |
366 (__VA_ARGS__)) | |
367 #else | |
368 #define RX_VOID_FIXTURE(id) \ | |
369 RX__FIXTURE_0(id, 0) \ | |
370 RX__REQUIRE_SEMICOLON | |
371 | |
372 #define RX_VOID_FIXTURE_1(id, _0) \ | |
373 RX__FIXTURE_1(id, 0, 1, (_0)) \ | |
374 RX__REQUIRE_SEMICOLON | |
375 | |
376 #define RX_VOID_FIXTURE_2(id, _0, _1) \ | |
377 RX__FIXTURE_1(id, 0, 2, (_0, _1)) \ | |
378 RX__REQUIRE_SEMICOLON | |
379 #endif | |
380 | |
381 #if RX__HAS_VARIADIC_MACROS | |
382 #define RX_TEST_SUITE(...) \ | |
383 RX__EXPAND( \ | |
384 RX__CONCAT( \ | |
385 RX__TEST_SUITE_DISPATCH_, \ | |
386 RX__HAS_AT_LEAST_2_ARGS(__VA_ARGS__) \ | |
387 )(__VA_ARGS__)) \ | |
388 RX__REQUIRE_SEMICOLON | |
389 | |
390 #define RX__TEST_SUITE_DISPATCH_0(id) \ | |
391 RX__TEST_SUITE_0(id) | |
392 | |
393 #define RX__TEST_SUITE_DISPATCH_1(id, ...) \ | |
394 RX__TEST_SUITE_1(id, \ | |
395 RX__COUNT_ARGS(__VA_ARGS__), \ | |
396 (__VA_ARGS__)) | |
397 #else | |
398 #define RX_TEST_SUITE(id) \ | |
399 RX__TEST_SUITE_0(id) \ | |
400 RX__REQUIRE_SEMICOLON | |
401 | |
402 #define RX_TEST_SUITE_1(id, _0) \ | |
403 RX__TEST_SUITE_1(id, 1, (_0)) \ | |
404 RX__REQUIRE_SEMICOLON | |
405 | |
406 #define RX_TEST_SUITE_2(id, _0, _1) \ | |
407 RX__TEST_SUITE_1(id, 2, (_0, _1)) \ | |
408 RX__REQUIRE_SEMICOLON | |
409 #endif | |
410 | |
411 #if RX__HAS_VARIADIC_MACROS | |
412 #define RX_TEST_CASE(...) \ | |
413 RX__EXPAND( \ | |
414 RX__CONCAT( \ | |
415 RX__TEST_CASE_DISPATCH_, \ | |
416 RX__HAS_AT_LEAST_3_ARGS(__VA_ARGS__) \ | |
417 )(__VA_ARGS__)) | |
418 | |
419 #define RX__TEST_CASE_DISPATCH_0(suite_id, id) \ | |
420 RX__TEST_CASE_0(suite_id, id) | |
421 | |
422 #define RX__TEST_CASE_DISPATCH_1(suite_id, id, ...) \ | |
423 RX__TEST_CASE_1(suite_id, \ | |
424 id, \ | |
425 RX__COUNT_ARGS(__VA_ARGS__), \ | |
426 (__VA_ARGS__)) | |
427 #else | |
428 #define RX_TEST_CASE(suite_id, id) \ | |
429 RX__TEST_CASE_0(suite_id, id) | |
430 | |
431 #define RX_TEST_CASE_1(suite_id, id, _0) \ | |
432 RX__TEST_CASE_1(suite_id, id, 1, (_0)) | |
433 | |
434 #define RX_TEST_CASE_2(suite_id, id, _0, _1) \ | |
435 RX__TEST_CASE_1(suite_id, id, 2, (_0, _1)) | |
436 #endif | |
437 | |
438 /* Generic Assertions O-(''Q) | |
439 -------------------------------------------------------------------------- */ | |
440 | |
441 #if RX__HAS_VARIADIC_MACROS | |
442 #define RX__DEFINE_TEST(severity, expected, condition, ...) \ | |
443 rx__assess_value(RX_PARAM_CONTEXT, \ | |
444 !!(condition), \ | |
445 expected, \ | |
446 #condition, \ | |
447 __FILE__, \ | |
448 __LINE__, \ | |
449 severity, \ | |
450 __VA_ARGS__) | |
451 #else | |
452 #define RX__DEFINE_TEST(severity, expected, condition, msg, \ | |
453 _0, _1, _2, _3, _4, _5, _6, _7) \ | |
454 rx__assess_value(RX_PARAM_CONTEXT, \ | |
455 !!(condition), \ | |
456 expected, \ | |
457 #condition, \ | |
458 __FILE__, \ | |
459 __LINE__, \ | |
460 severity, \ | |
461 msg, \ | |
462 _0, _1, _2, _3, _4, _5, _6, _7) | |
463 #endif | |
464 | |
465 #define RX_REQUIRE(condition) \ | |
466 RX_REQUIRE_MSG(condition, NULL) | |
467 | |
468 #if RX__HAS_VARIADIC_MACROS | |
469 #define RX_REQUIRE_MSG(condition, ...) \ | |
470 RX__DEFINE_TEST(RX_FATAL, RX__TRUE, condition, __VA_ARGS__) | |
471 #else | |
472 #define RX_REQUIRE_MSG(condition, msg) \ | |
473 RX__DEFINE_TEST(RX_FATAL, RX__TRUE, condition, msg, \ | |
474 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) | |
475 #endif | |
476 | |
477 #define RX_REQUIRE_MSG_1(condition, msg, \ | |
478 _0) \ | |
479 RX__DEFINE_TEST(RX_FATAL, RX__TRUE, condition, msg, \ | |
480 _0, NULL, NULL, NULL, NULL, NULL, NULL, NULL) | |
481 | |
482 #define RX_REQUIRE_MSG_2(condition, msg, \ | |
483 _0, _1) \ | |
484 RX__DEFINE_TEST(RX_FATAL, RX__TRUE, condition, msg, \ | |
485 _0, _1, NULL, NULL, NULL, NULL, NULL, NULL) | |
486 | |
487 #define RX_REQUIRE_MSG_3(condition, msg, \ | |
488 _0, _1, _2) \ | |
489 RX__DEFINE_TEST(RX_FATAL, RX__TRUE, condition, msg, \ | |
490 _0, _1, _2, NULL, NULL, NULL, NULL, NULL) | |
491 | |
492 #define RX_REQUIRE_MSG_4(condition, msg, \ | |
493 _0, _1, _2, _3) \ | |
494 RX__DEFINE_TEST(RX_FATAL, RX__TRUE, condition, msg, \ | |
495 _0, _1, _2, _3, NULL, NULL, NULL, NULL) | |
496 | |
497 #define RX_REQUIRE_MSG_5(condition, msg, \ | |
498 _0, _1, _2, _3, _4) \ | |
499 RX__DEFINE_TEST(RX_FATAL, RX__TRUE, condition, msg, \ | |
500 _0, _1, _2, _3, _4, NULL, NULL, NULL) | |
501 | |
502 #define RX_REQUIRE_MSG_6(condition, msg, \ | |
503 _0, _1, _2, _3, _4, _5) \ | |
504 RX__DEFINE_TEST(RX_FATAL, RX__TRUE, condition, msg, \ | |
505 _0, _1, _2, _3, _4, _5, NULL, NULL) | |
506 | |
507 #define RX_REQUIRE_MSG_7(condition, msg, \ | |
508 _0, _1, _2, _3, _4, _5, _6) \ | |
509 RX__DEFINE_TEST(RX_FATAL, RX__TRUE, condition, msg, \ | |
510 _0, _1, _2, _3, _4, _5, _6, NULL) | |
511 | |
512 #define RX_REQUIRE_MSG_8(condition, msg, \ | |
513 _0, _1, _2, _3, _4, _5, _6, _7) \ | |
514 RX__DEFINE_TEST(RX_FATAL, RX__TRUE, condition, msg, \ | |
515 _0, _1, _2, _3, _4, _5, _6, _7) | |
516 | |
517 #define RX_CHECK(condition) \ | |
518 RX_CHECK_MSG(condition, NULL) | |
519 | |
520 #if RX__HAS_VARIADIC_MACROS | |
521 #define RX_CHECK_MSG(condition, ...) \ | |
522 RX__DEFINE_TEST(RX_NONFATAL, RX__TRUE, condition, __VA_ARGS__) | |
523 #else | |
524 #define RX_CHECK_MSG(condition, msg) \ | |
525 RX__DEFINE_TEST(RX_NONFATAL, RX__TRUE, condition, msg, \ | |
526 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) | |
527 #endif | |
528 | |
529 #define RX_CHECK_MSG_1(condition, msg, \ | |
530 _0) \ | |
531 RX__DEFINE_TEST(RX_NONFATAL, RX__TRUE, condition, msg, \ | |
532 _0, NULL, NULL, NULL, NULL, NULL, NULL, NULL) | |
533 | |
534 #define RX_CHECK_MSG_2(condition, msg, \ | |
535 _0, _1) \ | |
536 RX__DEFINE_TEST(RX_NONFATAL, RX__TRUE, condition, msg, \ | |
537 _0, _1, NULL, NULL, NULL, NULL, NULL, NULL) | |
538 | |
539 #define RX_CHECK_MSG_3(condition, msg, \ | |
540 _0, _1, _2) \ | |
541 RX__DEFINE_TEST(RX_NONFATAL, RX__TRUE, condition, msg, \ | |
542 _0, _1, _2, NULL, NULL, NULL, NULL, NULL) | |
543 | |
544 #define RX_CHECK_MSG_4(condition, msg, \ | |
545 _0, _1, _2, _3) \ | |
546 RX__DEFINE_TEST(RX_NONFATAL, RX__TRUE, condition, msg, \ | |
547 _0, _1, _2, _3, NULL, NULL, NULL, NULL) | |
548 | |
549 #define RX_CHECK_MSG_5(condition, msg, \ | |
550 _0, _1, _2, _3, _4) \ | |
551 RX__DEFINE_TEST(RX_NONFATAL, RX__TRUE, condition, msg, \ | |
552 _0, _1, _2, _3, _4, NULL, NULL, NULL) | |
553 | |
554 #define RX_CHECK_MSG_6(condition, msg, \ | |
555 _0, _1, _2, _3, _4, _5) \ | |
556 RX__DEFINE_TEST(RX_NONFATAL, RX__TRUE, condition, msg, \ | |
557 _0, _1, _2, _3, _4, _5, NULL, NULL) | |
558 | |
559 #define RX_CHECK_MSG_7(condition, msg, \ | |
560 _0, _1, _2, _3, _4, _5, _6) \ | |
561 RX__DEFINE_TEST(RX_NONFATAL, RX__TRUE, condition, msg, \ | |
562 _0, _1, _2, _3, _4, _5, _6, NULL) | |
563 | |
564 #define RX_CHECK_MSG_8(condition, msg, \ | |
565 _0, _1, _2, _3, _4, _5, _6, _7) \ | |
566 RX__DEFINE_TEST(RX_NONFATAL, RX__TRUE, condition, msg, \ | |
567 _0, _1, _2, _3, _4, _5, _6, _7) | |
568 | |
569 | |
570 /* Boolean Assertions O-(''Q) | |
571 -------------------------------------------------------------------------- */ | |
572 | |
573 #if RX__HAS_VARIADIC_MACROS | |
574 #define RX__BOOL_DEFINE_TEST(severity, expected, condition, ...) \ | |
575 rx__bool_assess_value(RX_PARAM_CONTEXT, \ | |
576 !!(condition), \ | |
577 expected, \ | |
578 #condition, \ | |
579 __FILE__, \ | |
580 __LINE__, \ | |
581 severity, \ | |
582 __VA_ARGS__) | |
583 #else | |
584 #define RX__BOOL_DEFINE_TEST(severity, expected, condition, msg, \ | |
585 _0, _1, _2, _3, _4, _5, _6, _7) \ | |
586 rx__bool_assess_value(RX_PARAM_CONTEXT, \ | |
587 !!(condition), \ | |
588 expected, \ | |
589 #condition, \ | |
590 __FILE__, \ | |
591 __LINE__, \ | |
592 severity, \ | |
593 msg, \ | |
594 _0, _1, _2, _3, _4, _5, _6, _7) | |
595 #endif | |
596 | |
597 #define RX_BOOL_REQUIRE_TRUE(condition) \ | |
598 RX_BOOL_REQUIRE_TRUE_MSG(condition, NULL) | |
599 | |
600 #if RX__HAS_VARIADIC_MACROS | |
601 #define RX_BOOL_REQUIRE_TRUE_MSG(condition, ...) \ | |
602 RX__BOOL_DEFINE_TEST(RX_FATAL, RX__TRUE, condition, __VA_ARGS__) | |
603 #else | |
604 #define RX_BOOL_REQUIRE_TRUE_MSG(condition, msg) \ | |
605 RX__BOOL_DEFINE_TEST(RX_FATAL, RX__TRUE, condition, msg, \ | |
606 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) | |
607 #endif | |
608 | |
609 #define RX_BOOL_REQUIRE_TRUE_MSG_1(condition, msg, \ | |
610 _0) \ | |
611 RX__BOOL_DEFINE_TEST(RX_FATAL, RX__TRUE, condition, msg, \ | |
612 _0, NULL, NULL, NULL, NULL, NULL, NULL, NULL) | |
613 | |
614 #define RX_BOOL_REQUIRE_TRUE_MSG_2(condition, msg, \ | |
615 _0, _1) \ | |
616 RX__BOOL_DEFINE_TEST(RX_FATAL, RX__TRUE, condition, msg, \ | |
617 _0, _1, NULL, NULL, NULL, NULL, NULL, NULL) | |
618 | |
619 #define RX_BOOL_REQUIRE_TRUE_MSG_3(condition, msg, \ | |
620 _0, _1, _2) \ | |
621 RX__BOOL_DEFINE_TEST(RX_FATAL, RX__TRUE, condition, msg, \ | |
622 _0, _1, _2, NULL, NULL, NULL, NULL, NULL) | |
623 | |
624 #define RX_BOOL_REQUIRE_TRUE_MSG_4(condition, msg, \ | |
625 _0, _1, _2, _3) \ | |
626 RX__BOOL_DEFINE_TEST(RX_FATAL, RX__TRUE, condition, msg, \ | |
627 _0, _1, _2, _3, NULL, NULL, NULL, NULL) | |
628 | |
629 #define RX_BOOL_REQUIRE_TRUE_MSG_5(condition, msg, \ | |
630 _0, _1, _2, _3, _4) \ | |
631 RX__BOOL_DEFINE_TEST(RX_FATAL, RX__TRUE, condition, msg, \ | |
632 _0, _1, _2, _3, _4, NULL, NULL, NULL) | |
633 | |
634 #define RX_BOOL_REQUIRE_TRUE_MSG_6(condition, msg, \ | |
635 _0, _1, _2, _3, _4, _5) \ | |
636 RX__BOOL_DEFINE_TEST(RX_FATAL, RX__TRUE, condition, msg, \ | |
637 _0, _1, _2, _3, _4, _5, NULL, NULL) | |
638 | |
639 #define RX_BOOL_REQUIRE_TRUE_MSG_7(condition, msg, \ | |
640 _0, _1, _2, _3, _4, _5, _6) \ | |
641 RX__BOOL_DEFINE_TEST(RX_FATAL, RX__TRUE, condition, msg, \ | |
642 _0, _1, _2, _3, _4, _5, _6, NULL) | |
643 | |
644 #define RX_BOOL_REQUIRE_TRUE_MSG_8(condition, msg, \ | |
645 _0, _1, _2, _3, _4, _5, _6, _7) \ | |
646 RX__BOOL_DEFINE_TEST(RX_FATAL, RX__TRUE, condition, msg, \ | |
647 _0, _1, _2, _3, _4, _5, _6, _7) | |
648 | |
649 #define RX_BOOL_CHECK_TRUE(condition) \ | |
650 RX_BOOL_CHECK_TRUE_MSG(condition, NULL) | |
651 | |
652 #if RX__HAS_VARIADIC_MACROS | |
653 #define RX_BOOL_CHECK_TRUE_MSG(condition, ...) \ | |
654 RX__BOOL_DEFINE_TEST(RX_NONFATAL, RX__TRUE, condition, __VA_ARGS__) | |
655 #else | |
656 #define RX_BOOL_CHECK_TRUE_MSG(condition, msg) \ | |
657 RX__BOOL_DEFINE_TEST(RX_NONFATAL, RX__TRUE, condition, msg, \ | |
658 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) | |
659 #endif | |
660 | |
661 #define RX_BOOL_CHECK_TRUE_MSG_1(condition, msg, \ | |
662 _0) \ | |
663 RX__BOOL_DEFINE_TEST(RX_NONFATAL, RX__TRUE, condition, msg, \ | |
664 _0, NULL, NULL, NULL, NULL, NULL, NULL, NULL) | |
665 | |
666 #define RX_BOOL_CHECK_TRUE_MSG_2(condition, msg, \ | |
667 _0, _1) \ | |
668 RX__BOOL_DEFINE_TEST(RX_NONFATAL, RX__TRUE, condition, msg, \ | |
669 _0, _1, NULL, NULL, NULL, NULL, NULL, NULL) | |
670 | |
671 #define RX_BOOL_CHECK_TRUE_MSG_3(condition, msg, \ | |
672 _0, _1, _2) \ | |
673 RX__BOOL_DEFINE_TEST(RX_NONFATAL, RX__TRUE, condition, msg, \ | |
674 _0, _1, _2, NULL, NULL, NULL, NULL, NULL) | |
675 | |
676 #define RX_BOOL_CHECK_TRUE_MSG_4(condition, msg, \ | |
677 _0, _1, _2, _3) \ | |
678 RX__BOOL_DEFINE_TEST(RX_NONFATAL, RX__TRUE, condition, msg, \ | |
679 _0, _1, _2, _3, NULL, NULL, NULL, NULL) | |
680 | |
681 #define RX_BOOL_CHECK_TRUE_MSG_5(condition, msg, \ | |
682 _0, _1, _2, _3, _4) \ | |
683 RX__BOOL_DEFINE_TEST(RX_NONFATAL, RX__TRUE, condition, msg, \ | |
684 _0, _1, _2, _3, _4, NULL, NULL, NULL) | |
685 | |
686 #define RX_BOOL_CHECK_TRUE_MSG_6(condition, msg, \ | |
687 _0, _1, _2, _3, _4, _5) \ | |
688 RX__BOOL_DEFINE_TEST(RX_NONFATAL, RX__TRUE, condition, msg, \ | |
689 _0, _1, _2, _3, _4, _5, NULL, NULL) | |
690 | |
691 #define RX_BOOL_CHECK_TRUE_MSG_7(condition, msg, \ | |
692 _0, _1, _2, _3, _4, _5, _6) \ | |
693 RX__BOOL_DEFINE_TEST(RX_NONFATAL, RX__TRUE, condition, msg, \ | |
694 _0, _1, _2, _3, _4, _5, _6, NULL) | |
695 | |
696 #define RX_BOOL_CHECK_TRUE_MSG_8(condition, msg, \ | |
697 _0, _1, _2, _3, _4, _5, _6, _7) \ | |
698 RX__BOOL_DEFINE_TEST(RX_NONFATAL, RX__TRUE, condition, msg, \ | |
699 _0, _1, _2, _3, _4, _5, _6, _7) | |
700 | |
701 #define RX_BOOL_REQUIRE_FALSE(condition) \ | |
702 RX_BOOL_REQUIRE_FALSE_MSG(condition, NULL) | |
703 | |
704 #if RX__HAS_VARIADIC_MACROS | |
705 #define RX_BOOL_REQUIRE_FALSE_MSG(condition, ...) \ | |
706 RX__BOOL_DEFINE_TEST(RX_FATAL, RX__FALSE, condition, __VA_ARGS__) | |
707 #else | |
708 #define RX_BOOL_REQUIRE_FALSE_MSG(condition, msg) \ | |
709 RX__BOOL_DEFINE_TEST(RX_FATAL, RX__FALSE, condition, msg, \ | |
710 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) | |
711 #endif | |
712 | |
713 #define RX_BOOL_REQUIRE_FALSE_MSG_1(condition, msg, \ | |
714 _0) \ | |
715 RX__BOOL_DEFINE_TEST(RX_FATAL, RX__FALSE, condition, msg, \ | |
716 _0, NULL, NULL, NULL, NULL, NULL, NULL, NULL) | |
717 | |
718 #define RX_BOOL_REQUIRE_FALSE_MSG_2(condition, msg, \ | |
719 _0, _1) \ | |
720 RX__BOOL_DEFINE_TEST(RX_FATAL, RX__FALSE, condition, msg, \ | |
721 _0, _1, NULL, NULL, NULL, NULL, NULL, NULL) | |
722 | |
723 #define RX_BOOL_REQUIRE_FALSE_MSG_3(condition, msg, \ | |
724 _0, _1, _2) \ | |
725 RX__BOOL_DEFINE_TEST(RX_FATAL, RX__FALSE, condition, msg, \ | |
726 _0, _1, _2, NULL, NULL, NULL, NULL, NULL) | |
727 | |
728 #define RX_BOOL_REQUIRE_FALSE_MSG_4(condition, msg, \ | |
729 _0, _1, _2, _3) \ | |
730 RX__BOOL_DEFINE_TEST(RX_FATAL, RX__FALSE, condition, msg, \ | |
731 _0, _1, _2, _3, NULL, NULL, NULL, NULL) | |
732 | |
733 #define RX_BOOL_REQUIRE_FALSE_MSG_5(condition, msg, \ | |
734 _0, _1, _2, _3, _4) \ | |
735 RX__BOOL_DEFINE_TEST(RX_FATAL, RX__FALSE, condition, msg, \ | |
736 _0, _1, _2, _3, _4, NULL, NULL, NULL) | |
737 | |
738 #define RX_BOOL_REQUIRE_FALSE_MSG_6(condition, msg, \ | |
739 _0, _1, _2, _3, _4, _5) \ | |
740 RX__BOOL_DEFINE_TEST(RX_FATAL, RX__FALSE, condition, msg, \ | |
741 _0, _1, _2, _3, _4, _5, NULL, NULL) | |
742 | |
743 #define RX_BOOL_REQUIRE_FALSE_MSG_7(condition, msg, \ | |
744 _0, _1, _2, _3, _4, _5, _6) \ | |
745 RX__BOOL_DEFINE_TEST(RX_FATAL, RX__FALSE, condition, msg, \ | |
746 _0, _1, _2, _3, _4, _5, _6, NULL) | |
747 | |
748 #define RX_BOOL_REQUIRE_FALSE_MSG_8(condition, msg, \ | |
749 _0, _1, _2, _3, _4, _5, _6, _7) \ | |
750 RX__BOOL_DEFINE_TEST(RX_FATAL, RX__FALSE, condition, msg, \ | |
751 _0, _1, _2, _3, _4, _5, _6, _7) | |
752 | |
753 #define RX_BOOL_CHECK_FALSE(condition) \ | |
754 RX_BOOL_CHECK_FALSE_MSG(condition, NULL) | |
755 | |
756 #if RX__HAS_VARIADIC_MACROS | |
757 #define RX_BOOL_CHECK_FALSE_MSG(condition, ...) \ | |
758 RX__BOOL_DEFINE_TEST(RX_NONFATAL, RX__FALSE, condition, __VA_ARGS__) | |
759 #else | |
760 #define RX_BOOL_CHECK_FALSE_MSG(condition, msg) \ | |
761 RX__BOOL_DEFINE_TEST(RX_NONFATAL, RX__FALSE, condition, msg, \ | |
762 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) | |
763 #endif | |
764 | |
765 #define RX_BOOL_CHECK_FALSE_MSG_1(condition, msg, \ | |
766 _0) \ | |
767 RX__BOOL_DEFINE_TEST(RX_NONFATAL, RX__FALSE, condition, msg, \ | |
768 _0, NULL, NULL, NULL, NULL, NULL, NULL, NULL) | |
769 | |
770 #define RX_BOOL_CHECK_FALSE_MSG_2(condition, msg, \ | |
771 _0, _1) \ | |
772 RX__BOOL_DEFINE_TEST(RX_NONFATAL, RX__FALSE, condition, msg, \ | |
773 _0, _1, NULL, NULL, NULL, NULL, NULL, NULL) | |
774 | |
775 #define RX_BOOL_CHECK_FALSE_MSG_3(condition, msg, \ | |
776 _0, _1, _2) \ | |
777 RX__BOOL_DEFINE_TEST(RX_NONFATAL, RX__FALSE, condition, msg, \ | |
778 _0, _1, _2, NULL, NULL, NULL, NULL, NULL) | |
779 | |
780 #define RX_BOOL_CHECK_FALSE_MSG_4(condition, msg, \ | |
781 _0, _1, _2, _3) \ | |
782 RX__BOOL_DEFINE_TEST(RX_NONFATAL, RX__FALSE, condition, msg, \ | |
783 _0, _1, _2, _3, NULL, NULL, NULL, NULL) | |
784 | |
785 #define RX_BOOL_CHECK_FALSE_MSG_5(condition, msg, \ | |
786 _0, _1, _2, _3, _4) \ | |
787 RX__BOOL_DEFINE_TEST(RX_NONFATAL, RX__FALSE, condition, msg, \ | |
788 _0, _1, _2, _3, _4, NULL, NULL, NULL) | |
789 | |
790 #define RX_BOOL_CHECK_FALSE_MSG_6(condition, msg, \ | |
791 _0, _1, _2, _3, _4, _5) \ | |
792 RX__BOOL_DEFINE_TEST(RX_NONFATAL, RX__FALSE, condition, msg, \ | |
793 _0, _1, _2, _3, _4, _5, NULL, NULL) | |
794 | |
795 #define RX_BOOL_CHECK_FALSE_MSG_7(condition, msg, \ | |
796 _0, _1, _2, _3, _4, _5, _6) \ | |
797 RX__BOOL_DEFINE_TEST(RX_NONFATAL, RX__FALSE, condition, msg, \ | |
798 _0, _1, _2, _3, _4, _5, _6, NULL) | |
799 | |
800 #define RX_BOOL_CHECK_FALSE_MSG_8(condition, msg, \ | |
801 _0, _1, _2, _3, _4, _5, _6, _7) \ | |
802 RX__BOOL_DEFINE_TEST(RX_NONFATAL, RX__FALSE, condition, msg, \ | |
803 _0, _1, _2, _3, _4, _5, _6, _7) | |
804 | |
805 /* Integer Assertions O-(''Q) | |
806 -------------------------------------------------------------------------- */ | |
807 | |
808 #if RX__HAS_VARIADIC_MACROS | |
809 #define RX__INT_DEFINE_TEST(severity, op, x1, x2, ...) \ | |
810 rx__int_assess_comparison(RX_PARAM_CONTEXT, \ | |
811 (x1), \ | |
812 (x2), \ | |
813 op, \ | |
814 #x1, \ | |
815 #x2, \ | |
816 __FILE__, \ | |
817 __LINE__, \ | |
818 severity, \ | |
819 __VA_ARGS__) | |
820 #else | |
821 #define RX__INT_DEFINE_TEST(severity, op, x1, x2, msg, \ | |
822 _0, _1, _2, _3, _4, _5, _6, _7) \ | |
823 rx__int_assess_comparison(RX_PARAM_CONTEXT, \ | |
824 (x1), \ | |
825 (x2), \ | |
826 op, \ | |
827 #x1, \ | |
828 #x2, \ | |
829 __FILE__, \ | |
830 __LINE__, \ | |
831 severity, \ | |
832 msg, \ | |
833 _0, _1, _2, _3, _4, _5, _6, _7) | |
834 #endif | |
835 | |
836 #define RX_INT_REQUIRE_EQUAL(x1, x2) \ | |
837 RX_INT_REQUIRE_EQUAL_MSG(x1, x2, NULL) | |
838 | |
839 #if RX__HAS_VARIADIC_MACROS | |
840 #define RX_INT_REQUIRE_EQUAL_MSG(x1, x2, ...) \ | |
841 RX__INT_DEFINE_TEST(RX_FATAL, RX__OP_EQUAL, x1, x2, __VA_ARGS__) | |
842 #else | |
843 #define RX_INT_REQUIRE_EQUAL_MSG(x1, x2, msg) \ | |
844 RX__INT_DEFINE_TEST(RX_FATAL, RX__OP_EQUAL, x1, x2, msg, \ | |
845 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) | |
846 #endif | |
847 | |
848 #define RX_INT_REQUIRE_EQUAL_MSG_1(x1, x2, msg, \ | |
849 _0) \ | |
850 RX__INT_DEFINE_TEST(RX_FATAL, RX__OP_EQUAL, x1, x2, msg, \ | |
851 _0, NULL, NULL, NULL, NULL, NULL, NULL, NULL) | |
852 | |
853 #define RX_INT_REQUIRE_EQUAL_MSG_2(x1, x2, msg, \ | |
854 _0, _1) \ | |
855 RX__INT_DEFINE_TEST(RX_FATAL, RX__OP_EQUAL, x1, x2, msg, \ | |
856 _0, _1, NULL, NULL, NULL, NULL, NULL, NULL) | |
857 | |
858 #define RX_INT_REQUIRE_EQUAL_MSG_3(x1, x2, msg, \ | |
859 _0, _1, _2) \ | |
860 RX__INT_DEFINE_TEST(RX_FATAL, RX__OP_EQUAL, x1, x2, msg, \ | |
861 _0, _1, _2, NULL, NULL, NULL, NULL, NULL) | |
862 | |
863 #define RX_INT_REQUIRE_EQUAL_MSG_4(x1, x2, msg, \ | |
864 _0, _1, _2, _3) \ | |
865 RX__INT_DEFINE_TEST(RX_FATAL, RX__OP_EQUAL, x1, x2, msg, \ | |
866 _0, _1, _2, _3, NULL, NULL, NULL, NULL) | |
867 | |
868 #define RX_INT_REQUIRE_EQUAL_MSG_5(x1, x2, msg, \ | |
869 _0, _1, _2, _3, _4) \ | |
870 RX__INT_DEFINE_TEST(RX_FATAL, RX__OP_EQUAL, x1, x2, msg, \ | |
871 _0, _1, _2, _3, _4, NULL, NULL, NULL) | |
872 | |
873 #define RX_INT_REQUIRE_EQUAL_MSG_6(x1, x2, msg, \ | |
874 _0, _1, _2, _3, _4, _5) \ | |
875 RX__INT_DEFINE_TEST(RX_FATAL, RX__OP_EQUAL, x1, x2, msg, \ | |
876 _0, _1, _2, _3, _4, _5, NULL, NULL) | |
877 | |
878 #define RX_INT_REQUIRE_EQUAL_MSG_7(x1, x2, msg, \ | |
879 _0, _1, _2, _3, _4, _5, _6) \ | |
880 RX__INT_DEFINE_TEST(RX_FATAL, RX__OP_EQUAL, x1, x2, msg, \ | |
881 _0, _1, _2, _3, _4, _5, _6, NULL) | |
882 | |
883 #define RX_INT_REQUIRE_EQUAL_MSG_8(x1, x2, msg, \ | |
884 _0, _1, _2, _3, _4, _5, _6, _7) \ | |
885 RX__INT_DEFINE_TEST(RX_FATAL, RX__OP_EQUAL, x1, x2, msg, \ | |
886 _0, _1, _2, _3, _4, _5, _6, _7) | |
887 | |
888 #define RX_INT_CHECK_EQUAL(x1, x2) \ | |
889 RX_INT_CHECK_EQUAL_MSG(x1, x2, NULL) | |
890 | |
891 #if RX__HAS_VARIADIC_MACROS | |
892 #define RX_INT_CHECK_EQUAL_MSG(x1, x2, ...) \ | |
893 RX__INT_DEFINE_TEST(RX_NONFATAL, RX__OP_EQUAL, x1, x2, __VA_ARGS__) | |
894 #else | |
895 #define RX_INT_CHECK_EQUAL_MSG(x1, x2, msg) \ | |
896 RX__INT_DEFINE_TEST(RX_NONFATAL, RX__OP_EQUAL, x1, x2, msg, \ | |
897 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) | |
898 #endif | |
899 | |
900 #define RX_INT_CHECK_EQUAL_MSG_1(x1, x2, msg, \ | |
901 _0) \ | |
902 RX__INT_DEFINE_TEST(RX_NONFATAL, RX__OP_EQUAL, x1, x2, msg, \ | |
903 _0, NULL, NULL, NULL, NULL, NULL, NULL, NULL) | |
904 | |
905 #define RX_INT_CHECK_EQUAL_MSG_2(x1, x2, msg, \ | |
906 _0, _1) \ | |
907 RX__INT_DEFINE_TEST(RX_NONFATAL, RX__OP_EQUAL, x1, x2, msg, \ | |
908 _0, _1, NULL, NULL, NULL, NULL, NULL, NULL) | |
909 | |
910 #define RX_INT_CHECK_EQUAL_MSG_3(x1, x2, msg, \ | |
911 _0, _1, _2) \ | |
912 RX__INT_DEFINE_TEST(RX_NONFATAL, RX__OP_EQUAL, x1, x2, msg, \ | |
913 _0, _1, _2, NULL, NULL, NULL, NULL, NULL) | |
914 | |
915 #define RX_INT_CHECK_EQUAL_MSG_4(x1, x2, msg, \ | |
916 _0, _1, _2, _3) \ | |
917 RX__INT_DEFINE_TEST(RX_NONFATAL, RX__OP_EQUAL, x1, x2, msg, \ | |
918 _0, _1, _2, _3, NULL, NULL, NULL, NULL) | |
919 | |
920 #define RX_INT_CHECK_EQUAL_MSG_5(x1, x2, msg, \ | |
921 _0, _1, _2, _3, _4) \ | |
922 RX__INT_DEFINE_TEST(RX_NONFATAL, RX__OP_EQUAL, x1, x2, msg, \ | |
923 _0, _1, _2, _3, _4, NULL, NULL, NULL) | |
924 | |
925 #define RX_INT_CHECK_EQUAL_MSG_6(x1, x2, msg, \ | |
926 _0, _1, _2, _3, _4, _5) \ | |
927 RX__INT_DEFINE_TEST(RX_NONFATAL, RX__OP_EQUAL, x1, x2, msg, \ | |
928 _0, _1, _2, _3, _4, _5, NULL, NULL) | |
929 | |
930 #define RX_INT_CHECK_EQUAL_MSG_7(x1, x2, msg, \ | |
931 _0, _1, _2, _3, _4, _5, _6) \ | |
932 RX__INT_DEFINE_TEST(RX_NONFATAL, RX__OP_EQUAL, x1, x2, msg, \ | |
933 _0, _1, _2, _3, _4, _5, _6, NULL) | |
934 | |
935 #define RX_INT_CHECK_EQUAL_MSG_8(x1, x2, msg, \ | |
936 _0, _1, _2, _3, _4, _5, _6, _7) \ | |
937 RX__INT_DEFINE_TEST(RX_NONFATAL, RX__OP_EQUAL, x1, x2, msg, \ | |
938 _0, _1, _2, _3, _4, _5, _6, _7) | |
939 | |
940 #define RX_INT_REQUIRE_NOT_EQUAL(x1, x2) \ | |
941 RX_INT_REQUIRE_NOT_EQUAL_MSG(x1, x2, NULL) | |
942 | |
943 #if RX__HAS_VARIADIC_MACROS | |
944 #define RX_INT_REQUIRE_NOT_EQUAL_MSG(x1, x2, ...) \ | |
945 RX__INT_DEFINE_TEST(RX_FATAL, RX__OP_NOT_EQUAL, x1, x2, __VA_ARGS__) | |
946 #else | |
947 #define RX_INT_REQUIRE_NOT_EQUAL_MSG(x1, x2, msg) \ | |
948 RX__INT_DEFINE_TEST(RX_FATAL, RX__OP_NOT_EQUAL, x1, x2, msg, \ | |
949 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) | |
950 #endif | |
951 | |
952 #define RX_INT_REQUIRE_NOT_EQUAL_MSG_1(x1, x2, msg, \ | |
953 _0) \ | |
954 RX__INT_DEFINE_TEST(RX_FATAL, RX__OP_NOT_EQUAL, x1, x2, msg, \ | |
955 _0, NULL, NULL, NULL, NULL, NULL, NULL, NULL) | |
956 | |
957 #define RX_INT_REQUIRE_NOT_EQUAL_MSG_2(x1, x2, msg, \ | |
958 _0, _1) \ | |
959 RX__INT_DEFINE_TEST(RX_FATAL, RX__OP_NOT_EQUAL, x1, x2, msg, \ | |
960 _0, _1, NULL, NULL, NULL, NULL, NULL, NULL) | |
961 | |
962 #define RX_INT_REQUIRE_NOT_EQUAL_MSG_3(x1, x2, msg, \ | |
963 _0, _1, _2) \ | |
964 RX__INT_DEFINE_TEST(RX_FATAL, RX__OP_NOT_EQUAL, x1, x2, msg, \ | |
965 _0, _1, _2, NULL, NULL, NULL, NULL, NULL) | |
966 | |
967 #define RX_INT_REQUIRE_NOT_EQUAL_MSG_4(x1, x2, msg, \ | |
968 _0, _1, _2, _3) \ | |
969 RX__INT_DEFINE_TEST(RX_FATAL, RX__OP_NOT_EQUAL, x1, x2, msg, \ | |
970 _0, _1, _2, _3, NULL, NULL, NULL, NULL) | |
971 | |
972 #define RX_INT_REQUIRE_NOT_EQUAL_MSG_5(x1, x2, msg, \ | |
973 _0, _1, _2, _3, _4) \ | |
974 RX__INT_DEFINE_TEST(RX_FATAL, RX__OP_NOT_EQUAL, x1, x2, msg, \ | |
975 _0, _1, _2, _3, _4, NULL, NULL, NULL) | |
976 | |
977 #define RX_INT_REQUIRE_NOT_EQUAL_MSG_6(x1, x2, msg, \ | |
978 _0, _1, _2, _3, _4, _5) \ | |
979 RX__INT_DEFINE_TEST(RX_FATAL, RX__OP_NOT_EQUAL, x1, x2, msg, \ | |
980 _0, _1, _2, _3, _4, _5, NULL, NULL) | |
981 | |
982 #define RX_INT_REQUIRE_NOT_EQUAL_MSG_7(x1, x2, msg, \ | |
983 _0, _1, _2, _3, _4, _5, _6) \ | |
984 RX__INT_DEFINE_TEST(RX_FATAL, RX__OP_NOT_EQUAL, x1, x2, msg, \ | |
985 _0, _1, _2, _3, _4, _5, _6, NULL) | |
986 | |
987 #define RX_INT_REQUIRE_NOT_EQUAL_MSG_8(x1, x2, msg, \ | |
988 _0, _1, _2, _3, _4, _5, _6, _7) \ | |
989 RX__INT_DEFINE_TEST(RX_FATAL, RX__OP_NOT_EQUAL, x1, x2, msg, \ | |
990 _0, _1, _2, _3, _4, _5, _6, _7) | |
991 | |
992 #define RX_INT_CHECK_NOT_EQUAL(x1, x2) \ | |
993 RX_INT_CHECK_NOT_EQUAL_MSG(x1, x2, NULL) | |
994 | |
995 #if RX__HAS_VARIADIC_MACROS | |
996 #define RX_INT_CHECK_NOT_EQUAL_MSG(x1, x2, ...) \ | |
997 RX__INT_DEFINE_TEST(RX_NONFATAL, RX__OP_NOT_EQUAL, x1, x2, __VA_ARGS__) | |
998 #else | |
999 #define RX_INT_CHECK_NOT_EQUAL_MSG(x1, x2, msg) \ | |
1000 RX__INT_DEFINE_TEST(RX_NONFATAL, RX__OP_NOT_EQUAL, x1, x2, msg, \ | |
1001 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) | |
1002 #endif | |
1003 | |
1004 #define RX_INT_CHECK_NOT_EQUAL_MSG_1(x1, x2, msg, \ | |
1005 _0) \ | |
1006 RX__INT_DEFINE_TEST(RX_NONFATAL, RX__OP_NOT_EQUAL, x1, x2, msg, \ | |
1007 _0, NULL, NULL, NULL, NULL, NULL, NULL, NULL) | |
1008 | |
1009 #define RX_INT_CHECK_NOT_EQUAL_MSG_2(x1, x2, msg, \ | |
1010 _0, _1) \ | |
1011 RX__INT_DEFINE_TEST(RX_NONFATAL, RX__OP_NOT_EQUAL, x1, x2, msg, \ | |
1012 _0, _1, NULL, NULL, NULL, NULL, NULL, NULL) | |
1013 | |
1014 #define RX_INT_CHECK_NOT_EQUAL_MSG_3(x1, x2, msg, \ | |
1015 _0, _1, _2) \ | |
1016 RX__INT_DEFINE_TEST(RX_NONFATAL, RX__OP_NOT_EQUAL, x1, x2, msg, \ | |
1017 _0, _1, _2, NULL, NULL, NULL, NULL, NULL) | |
1018 | |
1019 #define RX_INT_CHECK_NOT_EQUAL_MSG_4(x1, x2, msg, \ | |
1020 _0, _1, _2, _3) \ | |
1021 RX__INT_DEFINE_TEST(RX_NONFATAL, RX__OP_NOT_EQUAL, x1, x2, msg, \ | |
1022 _0, _1, _2, _3, NULL, NULL, NULL, NULL) | |
1023 | |
1024 #define RX_INT_CHECK_NOT_EQUAL_MSG_5(x1, x2, msg, \ | |
1025 _0, _1, _2, _3, _4) \ | |
1026 RX__INT_DEFINE_TEST(RX_NONFATAL, RX__OP_NOT_EQUAL, x1, x2, msg, \ | |
1027 _0, _1, _2, _3, _4, NULL, NULL, NULL) | |
1028 | |
1029 #define RX_INT_CHECK_NOT_EQUAL_MSG_6(x1, x2, msg, \ | |
1030 _0, _1, _2, _3, _4, _5) \ | |
1031 RX__INT_DEFINE_TEST(RX_NONFATAL, RX__OP_NOT_EQUAL, x1, x2, msg, \ | |
1032 _0, _1, _2, _3, _4, _5, NULL, NULL) | |
1033 | |
1034 #define RX_INT_CHECK_NOT_EQUAL_MSG_7(x1, x2, msg, \ | |
1035 _0, _1, _2, _3, _4, _5, _6) \ | |
1036 RX__INT_DEFINE_TEST(RX_NONFATAL, RX__OP_NOT_EQUAL, x1, x2, msg, \ | |
1037 _0, _1, _2, _3, _4, _5, _6, NULL) | |
1038 | |
1039 #define RX_INT_CHECK_NOT_EQUAL_MSG_8(x1, x2, msg, \ | |
1040 _0, _1, _2, _3, _4, _5, _6, _7) \ | |
1041 RX__INT_DEFINE_TEST(RX_NONFATAL, RX__OP_NOT_EQUAL, x1, x2, msg, \ | |
1042 _0, _1, _2, _3, _4, _5, _6, _7) | |
1043 | |
1044 #define RX_INT_REQUIRE_GREATER(x1, x2) \ | |
1045 RX_INT_REQUIRE_GREATER_MSG(x1, x2, NULL) | |
1046 | |
1047 #if RX__HAS_VARIADIC_MACROS | |
1048 #define RX_INT_REQUIRE_GREATER_MSG(x1, x2, ...) \ | |
1049 RX__INT_DEFINE_TEST(RX_FATAL, RX__OP_GREATER, x1, x2, __VA_ARGS__) | |
1050 #else | |
1051 #define RX_INT_REQUIRE_GREATER_MSG(x1, x2, msg) \ | |
1052 RX__INT_DEFINE_TEST(RX_FATAL, RX__OP_GREATER, x1, x2, msg, \ | |
1053 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) | |
1054 #endif | |
1055 | |
1056 #define RX_INT_REQUIRE_GREATER_MSG_1(x1, x2, msg, \ | |
1057 _0) \ | |
1058 RX__INT_DEFINE_TEST(RX_FATAL, RX__OP_GREATER, x1, x2, msg, \ | |
1059 _0, NULL, NULL, NULL, NULL, NULL, NULL, NULL) | |
1060 | |
1061 #define RX_INT_REQUIRE_GREATER_MSG_2(x1, x2, msg, \ | |
1062 _0, _1) \ | |
1063 RX__INT_DEFINE_TEST(RX_FATAL, RX__OP_GREATER, x1, x2, msg, \ | |
1064 _0, _1, NULL, NULL, NULL, NULL, NULL, NULL) | |
1065 | |
1066 #define RX_INT_REQUIRE_GREATER_MSG_3(x1, x2, msg, \ | |
1067 _0, _1, _2) \ | |
1068 RX__INT_DEFINE_TEST(RX_FATAL, RX__OP_GREATER, x1, x2, msg, \ | |
1069 _0, _1, _2, NULL, NULL, NULL, NULL, NULL) | |
1070 | |
1071 #define RX_INT_REQUIRE_GREATER_MSG_4(x1, x2, msg, \ | |
1072 _0, _1, _2, _3) \ | |
1073 RX__INT_DEFINE_TEST(RX_FATAL, RX__OP_GREATER, x1, x2, msg, \ | |
1074 _0, _1, _2, _3, NULL, NULL, NULL, NULL) | |
1075 | |
1076 #define RX_INT_REQUIRE_GREATER_MSG_5(x1, x2, msg, \ | |
1077 _0, _1, _2, _3, _4) \ | |
1078 RX__INT_DEFINE_TEST(RX_FATAL, RX__OP_GREATER, x1, x2, msg, \ | |
1079 _0, _1, _2, _3, _4, NULL, NULL, NULL) | |
1080 | |
1081 #define RX_INT_REQUIRE_GREATER_MSG_6(x1, x2, msg, \ | |
1082 _0, _1, _2, _3, _4, _5) \ | |
1083 RX__INT_DEFINE_TEST(RX_FATAL, RX__OP_GREATER, x1, x2, msg, \ | |
1084 _0, _1, _2, _3, _4, _5, NULL, NULL) | |
1085 | |
1086 #define RX_INT_REQUIRE_GREATER_MSG_7(x1, x2, msg, \ | |
1087 _0, _1, _2, _3, _4, _5, _6) \ | |
1088 RX__INT_DEFINE_TEST(RX_FATAL, RX__OP_GREATER, x1, x2, msg, \ | |
1089 _0, _1, _2, _3, _4, _5, _6, NULL) | |
1090 | |
1091 #define RX_INT_REQUIRE_GREATER_MSG_8(x1, x2, msg, \ | |
1092 _0, _1, _2, _3, _4, _5, _6, _7) \ | |
1093 RX__INT_DEFINE_TEST(RX_FATAL, RX__OP_GREATER, x1, x2, msg, \ | |
1094 _0, _1, _2, _3, _4, _5, _6, _7) | |
1095 | |
1096 #define RX_INT_CHECK_GREATER(x1, x2) \ | |
1097 RX_INT_CHECK_GREATER_MSG(x1, x2, NULL) | |
1098 | |
1099 #if RX__HAS_VARIADIC_MACROS | |
1100 #define RX_INT_CHECK_GREATER_MSG(x1, x2, ...) \ | |
1101 RX__INT_DEFINE_TEST(RX_NONFATAL, RX__OP_GREATER, x1, x2, __VA_ARGS__) | |
1102 #else | |
1103 #define RX_INT_CHECK_GREATER_MSG(x1, x2, msg) \ | |
1104 RX__INT_DEFINE_TEST(RX_NONFATAL, RX__OP_GREATER, x1, x2, msg, \ | |
1105 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) | |
1106 #endif | |
1107 | |
1108 #define RX_INT_CHECK_GREATER_MSG_1(x1, x2, msg, \ | |
1109 _0) \ | |
1110 RX__INT_DEFINE_TEST(RX_NONFATAL, RX__OP_GREATER, x1, x2, msg, \ | |
1111 _0, NULL, NULL, NULL, NULL, NULL, NULL, NULL) | |
1112 | |
1113 #define RX_INT_CHECK_GREATER_MSG_2(x1, x2, msg, \ | |
1114 _0, _1) \ | |
1115 RX__INT_DEFINE_TEST(RX_NONFATAL, RX__OP_GREATER, x1, x2, msg, \ | |
1116 _0, _1, NULL, NULL, NULL, NULL, NULL, NULL) | |
1117 | |
1118 #define RX_INT_CHECK_GREATER_MSG_3(x1, x2, msg, \ | |
1119 _0, _1, _2) \ | |
1120 RX__INT_DEFINE_TEST(RX_NONFATAL, RX__OP_GREATER, x1, x2, msg, \ | |
1121 _0, _1, _2, NULL, NULL, NULL, NULL, NULL) | |
1122 | |
1123 #define RX_INT_CHECK_GREATER_MSG_4(x1, x2, msg, \ | |
1124 _0, _1, _2, _3) \ | |
1125 RX__INT_DEFINE_TEST(RX_NONFATAL, RX__OP_GREATER, x1, x2, msg, \ | |
1126 _0, _1, _2, _3, NULL, NULL, NULL, NULL) | |
1127 | |
1128 #define RX_INT_CHECK_GREATER_MSG_5(x1, x2, msg, \ | |
1129 _0, _1, _2, _3, _4) \ | |
1130 RX__INT_DEFINE_TEST(RX_NONFATAL, RX__OP_GREATER, x1, x2, msg, \ | |
1131 _0, _1, _2, _3, _4, NULL, NULL, NULL) | |
1132 | |
1133 #define RX_INT_CHECK_GREATER_MSG_6(x1, x2, msg, \ | |
1134 _0, _1, _2, _3, _4, _5) \ | |
1135 RX__INT_DEFINE_TEST(RX_NONFATAL, RX__OP_GREATER, x1, x2, msg, \ | |
1136 _0, _1, _2, _3, _4, _5, NULL, NULL) | |
1137 | |
1138 #define RX_INT_CHECK_GREATER_MSG_7(x1, x2, msg, \ | |
1139 _0, _1, _2, _3, _4, _5, _6) \ | |
1140 RX__INT_DEFINE_TEST(RX_NONFATAL, RX__OP_GREATER, x1, x2, msg, \ | |
1141 _0, _1, _2, _3, _4, _5, _6, NULL) | |
1142 | |
1143 #define RX_INT_CHECK_GREATER_MSG_8(x1, x2, msg, \ | |
1144 _0, _1, _2, _3, _4, _5, _6, _7) \ | |
1145 RX__INT_DEFINE_TEST(RX_NONFATAL, RX__OP_GREATER, x1, x2, msg, \ | |
1146 _0, _1, _2, _3, _4, _5, _6, _7) | |
1147 | |
1148 #define RX_INT_REQUIRE_LESSER(x1, x2) \ | |
1149 RX_INT_REQUIRE_LESSER_MSG(x1, x2, NULL) | |
1150 | |
1151 #if RX__HAS_VARIADIC_MACROS | |
1152 #define RX_INT_REQUIRE_LESSER_MSG(x1, x2, ...) \ | |
1153 RX__INT_DEFINE_TEST(RX_FATAL, RX__OP_LESSER, x1, x2, __VA_ARGS__) | |
1154 #else | |
1155 #define RX_INT_REQUIRE_LESSER_MSG(x1, x2, msg) \ | |
1156 RX__INT_DEFINE_TEST(RX_FATAL, RX__OP_LESSER, x1, x2, msg, \ | |
1157 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) | |
1158 #endif | |
1159 | |
1160 #define RX_INT_REQUIRE_LESSER_MSG_1(x1, x2, msg, \ | |
1161 _0) \ | |
1162 RX__INT_DEFINE_TEST(RX_FATAL, RX__OP_LESSER, x1, x2, msg, \ | |
1163 _0, NULL, NULL, NULL, NULL, NULL, NULL, NULL) | |
1164 | |
1165 #define RX_INT_REQUIRE_LESSER_MSG_2(x1, x2, msg, \ | |
1166 _0, _1) \ | |
1167 RX__INT_DEFINE_TEST(RX_FATAL, RX__OP_LESSER, x1, x2, msg, \ | |
1168 _0, _1, NULL, NULL, NULL, NULL, NULL, NULL) | |
1169 | |
1170 #define RX_INT_REQUIRE_LESSER_MSG_3(x1, x2, msg, \ | |
1171 _0, _1, _2) \ | |
1172 RX__INT_DEFINE_TEST(RX_FATAL, RX__OP_LESSER, x1, x2, msg, \ | |
1173 _0, _1, _2, NULL, NULL, NULL, NULL, NULL) | |
1174 | |
1175 #define RX_INT_REQUIRE_LESSER_MSG_4(x1, x2, msg, \ | |
1176 _0, _1, _2, _3) \ | |
1177 RX__INT_DEFINE_TEST(RX_FATAL, RX__OP_LESSER, x1, x2, msg, \ | |
1178 _0, _1, _2, _3, NULL, NULL, NULL, NULL) | |
1179 | |
1180 #define RX_INT_REQUIRE_LESSER_MSG_5(x1, x2, msg, \ | |
1181 _0, _1, _2, _3, _4) \ | |
1182 RX__INT_DEFINE_TEST(RX_FATAL, RX__OP_LESSER, x1, x2, msg, \ | |
1183 _0, _1, _2, _3, _4, NULL, NULL, NULL) | |
1184 | |
1185 #define RX_INT_REQUIRE_LESSER_MSG_6(x1, x2, msg, \ | |
1186 _0, _1, _2, _3, _4, _5) \ | |
1187 RX__INT_DEFINE_TEST(RX_FATAL, RX__OP_LESSER, x1, x2, msg, \ | |
1188 _0, _1, _2, _3, _4, _5, NULL, NULL) | |
1189 | |
1190 #define RX_INT_REQUIRE_LESSER_MSG_7(x1, x2, msg, \ | |
1191 _0, _1, _2, _3, _4, _5, _6) \ | |
1192 RX__INT_DEFINE_TEST(RX_FATAL, RX__OP_LESSER, x1, x2, msg, \ | |
1193 _0, _1, _2, _3, _4, _5, _6, NULL) | |
1194 | |
1195 #define RX_INT_REQUIRE_LESSER_MSG_8(x1, x2, msg, \ | |
1196 _0, _1, _2, _3, _4, _5, _6, _7) \ | |
1197 RX__INT_DEFINE_TEST(RX_FATAL, RX__OP_LESSER, x1, x2, msg, \ | |
1198 _0, _1, _2, _3, _4, _5, _6, _7) | |
1199 | |
1200 #define RX_INT_CHECK_LESSER(x1, x2) \ | |
1201 RX_INT_CHECK_LESSER_MSG(x1, x2, NULL) | |
1202 | |
1203 #if RX__HAS_VARIADIC_MACROS | |
1204 #define RX_INT_CHECK_LESSER_MSG(x1, x2, ...) \ | |
1205 RX__INT_DEFINE_TEST(RX_NONFATAL, RX__OP_LESSER, x1, x2, __VA_ARGS__) | |
1206 #else | |
1207 #define RX_INT_CHECK_LESSER_MSG(x1, x2, msg) \ | |
1208 RX__INT_DEFINE_TEST(RX_NONFATAL, RX__OP_LESSER, x1, x2, msg, \ | |
1209 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) | |
1210 #endif | |
1211 | |
1212 #define RX_INT_CHECK_LESSER_MSG_1(x1, x2, msg, \ | |
1213 _0) \ | |
1214 RX__INT_DEFINE_TEST(RX_NONFATAL, RX__OP_LESSER, x1, x2, msg, \ | |
1215 _0, NULL, NULL, NULL, NULL, NULL, NULL, NULL) | |
1216 | |
1217 #define RX_INT_CHECK_LESSER_MSG_2(x1, x2, msg, \ | |
1218 _0, _1) \ | |
1219 RX__INT_DEFINE_TEST(RX_NONFATAL, RX__OP_LESSER, x1, x2, msg, \ | |
1220 _0, _1, NULL, NULL, NULL, NULL, NULL, NULL) | |
1221 | |
1222 #define RX_INT_CHECK_LESSER_MSG_3(x1, x2, msg, \ | |
1223 _0, _1, _2) \ | |
1224 RX__INT_DEFINE_TEST(RX_NONFATAL, RX__OP_LESSER, x1, x2, msg, \ | |
1225 _0, _1, _2, NULL, NULL, NULL, NULL, NULL) | |
1226 | |
1227 #define RX_INT_CHECK_LESSER_MSG_4(x1, x2, msg, \ | |
1228 _0, _1, _2, _3) \ | |
1229 RX__INT_DEFINE_TEST(RX_NONFATAL, RX__OP_LESSER, x1, x2, msg, \ | |
1230 _0, _1, _2, _3, NULL, NULL, NULL, NULL) | |
1231 | |
1232 #define RX_INT_CHECK_LESSER_MSG_5(x1, x2, msg, \ | |
1233 _0, _1, _2, _3, _4) \ | |
1234 RX__INT_DEFINE_TEST(RX_NONFATAL, RX__OP_LESSER, x1, x2, msg, \ | |
1235 _0, _1, _2, _3, _4, NULL, NULL, NULL) | |
1236 | |
1237 #define RX_INT_CHECK_LESSER_MSG_6(x1, x2, msg, \ | |
1238 _0, _1, _2, _3, _4, _5) \ | |
1239 RX__INT_DEFINE_TEST(RX_NONFATAL, RX__OP_LESSER, x1, x2, msg, \ | |
1240 _0, _1, _2, _3, _4, _5, NULL, NULL) | |
1241 | |
1242 #define RX_INT_CHECK_LESSER_MSG_7(x1, x2, msg, \ | |
1243 _0, _1, _2, _3, _4, _5, _6) \ | |
1244 RX__INT_DEFINE_TEST(RX_NONFATAL, RX__OP_LESSER, x1, x2, msg, \ | |
1245 _0, _1, _2, _3, _4, _5, _6, NULL) | |
1246 | |
1247 #define RX_INT_CHECK_LESSER_MSG_8(x1, x2, msg, \ | |
1248 _0, _1, _2, _3, _4, _5, _6, _7) \ | |
1249 RX__INT_DEFINE_TEST(RX_NONFATAL, RX__OP_LESSER, x1, x2, msg, \ | |
1250 _0, _1, _2, _3, _4, _5, _6, _7) | |
1251 | |
1252 #define RX_INT_REQUIRE_GREATER_OR_EQUAL(x1, x2) \ | |
1253 RX_INT_REQUIRE_GREATER_OR_EQUAL_MSG(x1, x2, NULL) | |
1254 | |
1255 #if RX__HAS_VARIADIC_MACROS | |
1256 #define RX_INT_REQUIRE_GREATER_OR_EQUAL_MSG(x1, x2, ...) \ | |
1257 RX__INT_DEFINE_TEST(RX_FATAL, RX__OP_GREATER_OR_EQUAL, x1, x2, \ | |
1258 __VA_ARGS__) | |
1259 #else | |
1260 #define RX_INT_REQUIRE_GREATER_OR_EQUAL_MSG(x1, x2, msg) \ | |
1261 RX__INT_DEFINE_TEST(RX_FATAL, RX__OP_GREATER_OR_EQUAL, x1, x2, msg, \ | |
1262 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) | |
1263 #endif | |
1264 | |
1265 #define RX_INT_REQUIRE_GREATER_OR_EQUAL_MSG_1(x1, x2, msg, \ | |
1266 _0) \ | |
1267 RX__INT_DEFINE_TEST(RX_FATAL, RX__OP_GREATER_OR_EQUAL, x1, x2, msg, \ | |
1268 _0, NULL, NULL, NULL, NULL, NULL, NULL, NULL) | |
1269 | |
1270 #define RX_INT_REQUIRE_GREATER_OR_EQUAL_MSG_2(x1, x2, msg, \ | |
1271 _0, _1) \ | |
1272 RX__INT_DEFINE_TEST(RX_FATAL, RX__OP_GREATER_OR_EQUAL, x1, x2, msg, \ | |
1273 _0, _1, NULL, NULL, NULL, NULL, NULL, NULL) | |
1274 | |
1275 #define RX_INT_REQUIRE_GREATER_OR_EQUAL_MSG_3(x1, x2, msg, \ | |
1276 _0, _1, _2) \ | |
1277 RX__INT_DEFINE_TEST(RX_FATAL, RX__OP_GREATER_OR_EQUAL, x1, x2, msg, \ | |
1278 _0, _1, _2, NULL, NULL, NULL, NULL, NULL) | |
1279 | |
1280 #define RX_INT_REQUIRE_GREATER_OR_EQUAL_MSG_4(x1, x2, msg, \ | |
1281 _0, _1, _2, _3) \ | |
1282 RX__INT_DEFINE_TEST(RX_FATAL, RX__OP_GREATER_OR_EQUAL, x1, x2, msg, \ | |
1283 _0, _1, _2, _3, NULL, NULL, NULL, NULL) | |
1284 | |
1285 #define RX_INT_REQUIRE_GREATER_OR_EQUAL_MSG_5(x1, x2, msg, \ | |
1286 _0, _1, _2, _3, _4) \ | |
1287 RX__INT_DEFINE_TEST(RX_FATAL, RX__OP_GREATER_OR_EQUAL, x1, x2, msg, \ | |
1288 _0, _1, _2, _3, _4, NULL, NULL, NULL) | |
1289 | |
1290 #define RX_INT_REQUIRE_GREATER_OR_EQUAL_MSG_6(x1, x2, msg, \ | |
1291 _0, _1, _2, _3, _4, _5) \ | |
1292 RX__INT_DEFINE_TEST(RX_FATAL, RX__OP_GREATER_OR_EQUAL, x1, x2, msg, \ | |
1293 _0, _1, _2, _3, _4, _5, NULL, NULL) | |
1294 | |
1295 #define RX_INT_REQUIRE_GREATER_OR_EQUAL_MSG_7(x1, x2, msg, \ | |
1296 _0, _1, _2, _3, _4, _5, _6) \ | |
1297 RX__INT_DEFINE_TEST(RX_FATAL, RX__OP_GREATER_OR_EQUAL, x1, x2, msg, \ | |
1298 _0, _1, _2, _3, _4, _5, _6, NULL) | |
1299 | |
1300 #define RX_INT_REQUIRE_GREATER_OR_EQUAL_MSG_8(x1, x2, msg, \ | |
1301 _0, _1, _2, _3, _4, _5, _6, _7) \ | |
1302 RX__INT_DEFINE_TEST(RX_FATAL, RX__OP_GREATER_OR_EQUAL, x1, x2, msg, \ | |
1303 _0, _1, _2, _3, _4, _5, _6, _7) | |
1304 | |
1305 #define RX_INT_CHECK_GREATER_OR_EQUAL(x1, x2) \ | |
1306 RX_INT_CHECK_GREATER_OR_EQUAL_MSG(x1, x2, NULL) | |
1307 | |
1308 #if RX__HAS_VARIADIC_MACROS | |
1309 #define RX_INT_CHECK_GREATER_OR_EQUAL_MSG(x1, x2, ...) \ | |
1310 RX__INT_DEFINE_TEST(RX_NONFATAL, RX__OP_GREATER_OR_EQUAL, x1, x2, \ | |
1311 __VA_ARGS__) | |
1312 #else | |
1313 #define RX_INT_CHECK_GREATER_OR_EQUAL_MSG(x1, x2, msg) \ | |
1314 RX__INT_DEFINE_TEST(RX_NONFATAL, RX__OP_GREATER_OR_EQUAL, x1, x2, msg, \ | |
1315 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) | |
1316 #endif | |
1317 | |
1318 #define RX_INT_CHECK_GREATER_OR_EQUAL_MSG_1(x1, x2, msg, \ | |
1319 _0) \ | |
1320 RX__INT_DEFINE_TEST(RX_NONFATAL, RX__OP_GREATER_OR_EQUAL, x1, x2, msg, \ | |
1321 _0, NULL, NULL, NULL, NULL, NULL, NULL, NULL) | |
1322 | |
1323 #define RX_INT_CHECK_GREATER_OR_EQUAL_MSG_2(x1, x2, msg, \ | |
1324 _0, _1) \ | |
1325 RX__INT_DEFINE_TEST(RX_NONFATAL, RX__OP_GREATER_OR_EQUAL, x1, x2, msg, \ | |
1326 _0, _1, NULL, NULL, NULL, NULL, NULL, NULL) | |
1327 | |
1328 #define RX_INT_CHECK_GREATER_OR_EQUAL_MSG_3(x1, x2, msg, \ | |
1329 _0, _1, _2) \ | |
1330 RX__INT_DEFINE_TEST(RX_NONFATAL, RX__OP_GREATER_OR_EQUAL, x1, x2, msg, \ | |
1331 _0, _1, _2, NULL, NULL, NULL, NULL, NULL) | |
1332 | |
1333 #define RX_INT_CHECK_GREATER_OR_EQUAL_MSG_4(x1, x2, msg, \ | |
1334 _0, _1, _2, _3) \ | |
1335 RX__INT_DEFINE_TEST(RX_NONFATAL, RX__OP_GREATER_OR_EQUAL, x1, x2, msg, \ | |
1336 _0, _1, _2, _3, NULL, NULL, NULL, NULL) | |
1337 | |
1338 #define RX_INT_CHECK_GREATER_OR_EQUAL_MSG_5(x1, x2, msg, \ | |
1339 _0, _1, _2, _3, _4) \ | |
1340 RX__INT_DEFINE_TEST(RX_NONFATAL, RX__OP_GREATER_OR_EQUAL, x1, x2, msg, \ | |
1341 _0, _1, _2, _3, _4, NULL, NULL, NULL) | |
1342 | |
1343 #define RX_INT_CHECK_GREATER_OR_EQUAL_MSG_6(x1, x2, msg, \ | |
1344 _0, _1, _2, _3, _4, _5) \ | |
1345 RX__INT_DEFINE_TEST(RX_NONFATAL, RX__OP_GREATER_OR_EQUAL, x1, x2, msg, \ | |
1346 _0, _1, _2, _3, _4, _5, NULL, NULL) | |
1347 | |
1348 #define RX_INT_CHECK_GREATER_OR_EQUAL_MSG_7(x1, x2, msg, \ | |
1349 _0, _1, _2, _3, _4, _5, _6) \ | |
1350 RX__INT_DEFINE_TEST(RX_NONFATAL, RX__OP_GREATER_OR_EQUAL, x1, x2, msg, \ | |
1351 _0, _1, _2, _3, _4, _5, _6, NULL) | |
1352 | |
1353 #define RX_INT_CHECK_GREATER_OR_EQUAL_MSG_8(x1, x2, msg, \ | |
1354 _0, _1, _2, _3, _4, _5, _6, _7) \ | |
1355 RX__INT_DEFINE_TEST(RX_NONFATAL, RX__OP_GREATER_OR_EQUAL, x1, x2, msg, \ | |
1356 _0, _1, _2, _3, _4, _5, _6, _7) | |
1357 | |
1358 #define RX_INT_REQUIRE_LESSER_OR_EQUAL(x1, x2) \ | |
1359 RX_INT_REQUIRE_LESSER_OR_EQUAL_MSG(x1, x2, NULL) | |
1360 | |
1361 #if RX__HAS_VARIADIC_MACROS | |
1362 #define RX_INT_REQUIRE_LESSER_OR_EQUAL_MSG(x1, x2, ...) \ | |
1363 RX__INT_DEFINE_TEST(RX_FATAL, RX__OP_LESSER_OR_EQUAL, x1, x2, \ | |
1364 __VA_ARGS__) | |
1365 #else | |
1366 #define RX_INT_REQUIRE_LESSER_OR_EQUAL_MSG(x1, x2, msg) \ | |
1367 RX__INT_DEFINE_TEST(RX_FATAL, RX__OP_LESSER_OR_EQUAL, x1, x2, msg, \ | |
1368 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) | |
1369 #endif | |
1370 | |
1371 #define RX_INT_REQUIRE_LESSER_OR_EQUAL_MSG_1(x1, x2, msg, \ | |
1372 _0) \ | |
1373 RX__INT_DEFINE_TEST(RX_FATAL, RX__OP_LESSER_OR_EQUAL, x1, x2, msg, \ | |
1374 _0, NULL, NULL, NULL, NULL, NULL, NULL, NULL) | |
1375 | |
1376 #define RX_INT_REQUIRE_LESSER_OR_EQUAL_MSG_2(x1, x2, msg, \ | |
1377 _0, _1) \ | |
1378 RX__INT_DEFINE_TEST(RX_FATAL, RX__OP_LESSER_OR_EQUAL, x1, x2, msg, \ | |
1379 _0, _1, NULL, NULL, NULL, NULL, NULL, NULL) | |
1380 | |
1381 #define RX_INT_REQUIRE_LESSER_OR_EQUAL_MSG_3(x1, x2, msg, \ | |
1382 _0, _1, _2) \ | |
1383 RX__INT_DEFINE_TEST(RX_FATAL, RX__OP_LESSER_OR_EQUAL, x1, x2, msg, \ | |
1384 _0, _1, _2, NULL, NULL, NULL, NULL, NULL) | |
1385 | |
1386 #define RX_INT_REQUIRE_LESSER_OR_EQUAL_MSG_4(x1, x2, msg, \ | |
1387 _0, _1, _2, _3) \ | |
1388 RX__INT_DEFINE_TEST(RX_FATAL, RX__OP_LESSER_OR_EQUAL, x1, x2, msg, \ | |
1389 _0, _1, _2, _3, NULL, NULL, NULL, NULL) | |
1390 | |
1391 #define RX_INT_REQUIRE_LESSER_OR_EQUAL_MSG_5(x1, x2, msg, \ | |
1392 _0, _1, _2, _3, _4) \ | |
1393 RX__INT_DEFINE_TEST(RX_FATAL, RX__OP_LESSER_OR_EQUAL, x1, x2, msg, \ | |
1394 _0, _1, _2, _3, _4, NULL, NULL, NULL) | |
1395 | |
1396 #define RX_INT_REQUIRE_LESSER_OR_EQUAL_MSG_6(x1, x2, msg, \ | |
1397 _0, _1, _2, _3, _4, _5) \ | |
1398 RX__INT_DEFINE_TEST(RX_FATAL, RX__OP_LESSER_OR_EQUAL, x1, x2, msg, \ | |
1399 _0, _1, _2, _3, _4, _5, NULL, NULL) | |
1400 | |
1401 #define RX_INT_REQUIRE_LESSER_OR_EQUAL_MSG_7(x1, x2, msg, \ | |
1402 _0, _1, _2, _3, _4, _5, _6) \ | |
1403 RX__INT_DEFINE_TEST(RX_FATAL, RX__OP_LESSER_OR_EQUAL, x1, x2, msg, \ | |
1404 _0, _1, _2, _3, _4, _5, _6, NULL) | |
1405 | |
1406 #define RX_INT_REQUIRE_LESSER_OR_EQUAL_MSG_8(x1, x2, msg, \ | |
1407 _0, _1, _2, _3, _4, _5, _6, _7) \ | |
1408 RX__INT_DEFINE_TEST(RX_FATAL, RX__OP_LESSER_OR_EQUAL, x1, x2, msg, \ | |
1409 _0, _1, _2, _3, _4, _5, _6, _7) | |
1410 | |
1411 #define RX_INT_CHECK_LESSER_OR_EQUAL(x1, x2) \ | |
1412 RX_INT_CHECK_LESSER_OR_EQUAL_MSG(x1, x2, NULL) | |
1413 | |
1414 #if RX__HAS_VARIADIC_MACROS | |
1415 #define RX_INT_CHECK_LESSER_OR_EQUAL_MSG(x1, x2, ...) \ | |
1416 RX__INT_DEFINE_TEST(RX_NONFATAL, RX__OP_LESSER_OR_EQUAL, x1, x2, \ | |
1417 __VA_ARGS__) | |
1418 #else | |
1419 #define RX_INT_CHECK_LESSER_OR_EQUAL_MSG(x1, x2, msg) \ | |
1420 RX__INT_DEFINE_TEST(RX_NONFATAL, RX__OP_LESSER_OR_EQUAL, x1, x2, msg, \ | |
1421 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) | |
1422 #endif | |
1423 | |
1424 #define RX_INT_CHECK_LESSER_OR_EQUAL_MSG_1(x1, x2, msg, \ | |
1425 _0) \ | |
1426 RX__INT_DEFINE_TEST(RX_NONFATAL, RX__OP_LESSER_OR_EQUAL, x1, x2, msg, \ | |
1427 _0, NULL, NULL, NULL, NULL, NULL, NULL, NULL) | |
1428 | |
1429 #define RX_INT_CHECK_LESSER_OR_EQUAL_MSG_2(x1, x2, msg, \ | |
1430 _0, _1) \ | |
1431 RX__INT_DEFINE_TEST(RX_NONFATAL, RX__OP_LESSER_OR_EQUAL, x1, x2, msg, \ | |
1432 _0, _1, NULL, NULL, NULL, NULL, NULL, NULL) | |
1433 | |
1434 #define RX_INT_CHECK_LESSER_OR_EQUAL_MSG_3(x1, x2, msg, \ | |
1435 _0, _1, _2) \ | |
1436 RX__INT_DEFINE_TEST(RX_NONFATAL, RX__OP_LESSER_OR_EQUAL, x1, x2, msg, \ | |
1437 _0, _1, _2, NULL, NULL, NULL, NULL, NULL) | |
1438 | |
1439 #define RX_INT_CHECK_LESSER_OR_EQUAL_MSG_4(x1, x2, msg, \ | |
1440 _0, _1, _2, _3) \ | |
1441 RX__INT_DEFINE_TEST(RX_NONFATAL, RX__OP_LESSER_OR_EQUAL, x1, x2, msg, \ | |
1442 _0, _1, _2, _3, NULL, NULL, NULL, NULL) | |
1443 | |
1444 #define RX_INT_CHECK_LESSER_OR_EQUAL_MSG_5(x1, x2, msg, \ | |
1445 _0, _1, _2, _3, _4) \ | |
1446 RX__INT_DEFINE_TEST(RX_NONFATAL, RX__OP_LESSER_OR_EQUAL, x1, x2, msg, \ | |
1447 _0, _1, _2, _3, _4, NULL, NULL, NULL) | |
1448 | |
1449 #define RX_INT_CHECK_LESSER_OR_EQUAL_MSG_6(x1, x2, msg, \ | |
1450 _0, _1, _2, _3, _4, _5) \ | |
1451 RX__INT_DEFINE_TEST(RX_NONFATAL, RX__OP_LESSER_OR_EQUAL, x1, x2, msg, \ | |
1452 _0, _1, _2, _3, _4, _5, NULL, NULL) | |
1453 | |
1454 #define RX_INT_CHECK_LESSER_OR_EQUAL_MSG_7(x1, x2, msg, \ | |
1455 _0, _1, _2, _3, _4, _5, _6) \ | |
1456 RX__INT_DEFINE_TEST(RX_NONFATAL, RX__OP_LESSER_OR_EQUAL, x1, x2, msg, \ | |
1457 _0, _1, _2, _3, _4, _5, _6, NULL) | |
1458 | |
1459 #define RX_INT_CHECK_LESSER_OR_EQUAL_MSG_8(x1, x2, msg, \ | |
1460 _0, _1, _2, _3, _4, _5, _6, _7) \ | |
1461 RX__INT_DEFINE_TEST(RX_NONFATAL, RX__OP_LESSER_OR_EQUAL, x1, x2, msg, \ | |
1462 _0, _1, _2, _3, _4, _5, _6, _7) | |
1463 | |
1464 /* Unsigned Integer Assertions O-(''Q) | |
1465 -------------------------------------------------------------------------- */ | |
1466 | |
1467 #if RX__HAS_VARIADIC_MACROS | |
1468 #define RX__UINT_DEFINE_TEST(severity, op, x1, x2, ...) \ | |
1469 rx__uint_assess_comparison(RX_PARAM_CONTEXT, \ | |
1470 (x1), \ | |
1471 (x2), \ | |
1472 op, \ | |
1473 #x1, \ | |
1474 #x2, \ | |
1475 __FILE__, \ | |
1476 __LINE__, \ | |
1477 severity, \ | |
1478 __VA_ARGS__) | |
1479 #else | |
1480 #define RX__UINT_DEFINE_TEST(severity, op, x1, x2, msg, \ | |
1481 _0, _1, _2, _3, _4, _5, _6, _7) \ | |
1482 rx__uint_assess_comparison(RX_PARAM_CONTEXT, \ | |
1483 (x1), \ | |
1484 (x2), \ | |
1485 op, \ | |
1486 #x1, \ | |
1487 #x2, \ | |
1488 __FILE__, \ | |
1489 __LINE__, \ | |
1490 severity, \ | |
1491 msg, \ | |
1492 _0, _1, _2, _3, _4, _5, _6, _7) | |
1493 #endif | |
1494 | |
1495 #define RX_UINT_REQUIRE_EQUAL(x1, x2) \ | |
1496 RX_UINT_REQUIRE_EQUAL_MSG(x1, x2, NULL) | |
1497 | |
1498 #if RX__HAS_VARIADIC_MACROS | |
1499 #define RX_UINT_REQUIRE_EQUAL_MSG(x1, x2, ...) \ | |
1500 RX__UINT_DEFINE_TEST(RX_FATAL, RX__OP_EQUAL, x1, x2, __VA_ARGS__) | |
1501 #else | |
1502 #define RX_UINT_REQUIRE_EQUAL_MSG(x1, x2, msg) \ | |
1503 RX__UINT_DEFINE_TEST(RX_FATAL, RX__OP_EQUAL, x1, x2, msg, \ | |
1504 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) | |
1505 #endif | |
1506 | |
1507 #define RX_UINT_REQUIRE_EQUAL_MSG_1(x1, x2, msg, \ | |
1508 _0) \ | |
1509 RX__UINT_DEFINE_TEST(RX_FATAL, RX__OP_EQUAL, x1, x2, msg, \ | |
1510 _0, NULL, NULL, NULL, NULL, NULL, NULL, NULL) | |
1511 | |
1512 #define RX_UINT_REQUIRE_EQUAL_MSG_2(x1, x2, msg, \ | |
1513 _0, _1) \ | |
1514 RX__UINT_DEFINE_TEST(RX_FATAL, RX__OP_EQUAL, x1, x2, msg, \ | |
1515 _0, _1, NULL, NULL, NULL, NULL, NULL, NULL) | |
1516 | |
1517 #define RX_UINT_REQUIRE_EQUAL_MSG_3(x1, x2, msg, \ | |
1518 _0, _1, _2) \ | |
1519 RX__UINT_DEFINE_TEST(RX_FATAL, RX__OP_EQUAL, x1, x2, msg, \ | |
1520 _0, _1, _2, NULL, NULL, NULL, NULL, NULL) | |
1521 | |
1522 #define RX_UINT_REQUIRE_EQUAL_MSG_4(x1, x2, msg, \ | |
1523 _0, _1, _2, _3) \ | |
1524 RX__UINT_DEFINE_TEST(RX_FATAL, RX__OP_EQUAL, x1, x2, msg, \ | |
1525 _0, _1, _2, _3, NULL, NULL, NULL, NULL) | |
1526 | |
1527 #define RX_UINT_REQUIRE_EQUAL_MSG_5(x1, x2, msg, \ | |
1528 _0, _1, _2, _3, _4) \ | |
1529 RX__UINT_DEFINE_TEST(RX_FATAL, RX__OP_EQUAL, x1, x2, msg, \ | |
1530 _0, _1, _2, _3, _4, NULL, NULL, NULL) | |
1531 | |
1532 #define RX_UINT_REQUIRE_EQUAL_MSG_6(x1, x2, msg, \ | |
1533 _0, _1, _2, _3, _4, _5) \ | |
1534 RX__UINT_DEFINE_TEST(RX_FATAL, RX__OP_EQUAL, x1, x2, msg, \ | |
1535 _0, _1, _2, _3, _4, _5, NULL, NULL) | |
1536 | |
1537 #define RX_UINT_REQUIRE_EQUAL_MSG_7(x1, x2, msg, \ | |
1538 _0, _1, _2, _3, _4, _5, _6) \ | |
1539 RX__UINT_DEFINE_TEST(RX_FATAL, RX__OP_EQUAL, x1, x2, msg, \ | |
1540 _0, _1, _2, _3, _4, _5, _6, NULL) | |
1541 | |
1542 #define RX_UINT_REQUIRE_EQUAL_MSG_8(x1, x2, msg, \ | |
1543 _0, _1, _2, _3, _4, _5, _6, _7) \ | |
1544 RX__UINT_DEFINE_TEST(RX_FATAL, RX__OP_EQUAL, x1, x2, msg, \ | |
1545 _0, _1, _2, _3, _4, _5, _6, _7) | |
1546 | |
1547 #define RX_UINT_CHECK_EQUAL(x1, x2) \ | |
1548 RX_UINT_CHECK_EQUAL_MSG(x1, x2, NULL) | |
1549 | |
1550 #if RX__HAS_VARIADIC_MACROS | |
1551 #define RX_UINT_CHECK_EQUAL_MSG(x1, x2, ...) \ | |
1552 RX__UINT_DEFINE_TEST(RX_NONFATAL, RX__OP_EQUAL, x1, x2, __VA_ARGS__) | |
1553 #else | |
1554 #define RX_UINT_CHECK_EQUAL_MSG(x1, x2, msg) \ | |
1555 RX__UINT_DEFINE_TEST(RX_NONFATAL, RX__OP_EQUAL, x1, x2, msg, \ | |
1556 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) | |
1557 #endif | |
1558 | |
1559 #define RX_UINT_CHECK_EQUAL_MSG_1(x1, x2, msg, \ | |
1560 _0) \ | |
1561 RX__UINT_DEFINE_TEST(RX_NONFATAL, RX__OP_EQUAL, x1, x2, msg, \ | |
1562 _0, NULL, NULL, NULL, NULL, NULL, NULL, NULL) | |
1563 | |
1564 #define RX_UINT_CHECK_EQUAL_MSG_2(x1, x2, msg, \ | |
1565 _0, _1) \ | |
1566 RX__UINT_DEFINE_TEST(RX_NONFATAL, RX__OP_EQUAL, x1, x2, msg, \ | |
1567 _0, _1, NULL, NULL, NULL, NULL, NULL, NULL) | |
1568 | |
1569 #define RX_UINT_CHECK_EQUAL_MSG_3(x1, x2, msg, \ | |
1570 _0, _1, _2) \ | |
1571 RX__UINT_DEFINE_TEST(RX_NONFATAL, RX__OP_EQUAL, x1, x2, msg, \ | |
1572 _0, _1, _2, NULL, NULL, NULL, NULL, NULL) | |
1573 | |
1574 #define RX_UINT_CHECK_EQUAL_MSG_4(x1, x2, msg, \ | |
1575 _0, _1, _2, _3) \ | |
1576 RX__UINT_DEFINE_TEST(RX_NONFATAL, RX__OP_EQUAL, x1, x2, msg, \ | |
1577 _0, _1, _2, _3, NULL, NULL, NULL, NULL) | |
1578 | |
1579 #define RX_UINT_CHECK_EQUAL_MSG_5(x1, x2, msg, \ | |
1580 _0, _1, _2, _3, _4) \ | |
1581 RX__UINT_DEFINE_TEST(RX_NONFATAL, RX__OP_EQUAL, x1, x2, msg, \ | |
1582 _0, _1, _2, _3, _4, NULL, NULL, NULL) | |
1583 | |
1584 #define RX_UINT_CHECK_EQUAL_MSG_6(x1, x2, msg, \ | |
1585 _0, _1, _2, _3, _4, _5) \ | |
1586 RX__UINT_DEFINE_TEST(RX_NONFATAL, RX__OP_EQUAL, x1, x2, msg, \ | |
1587 _0, _1, _2, _3, _4, _5, NULL, NULL) | |
1588 | |
1589 #define RX_UINT_CHECK_EQUAL_MSG_7(x1, x2, msg, \ | |
1590 _0, _1, _2, _3, _4, _5, _6) \ | |
1591 RX__UINT_DEFINE_TEST(RX_NONFATAL, RX__OP_EQUAL, x1, x2, msg, \ | |
1592 _0, _1, _2, _3, _4, _5, _6, NULL) | |
1593 | |
1594 #define RX_UINT_CHECK_EQUAL_MSG_8(x1, x2, msg, \ | |
1595 _0, _1, _2, _3, _4, _5, _6, _7) \ | |
1596 RX__UINT_DEFINE_TEST(RX_NONFATAL, RX__OP_EQUAL, x1, x2, msg, \ | |
1597 _0, _1, _2, _3, _4, _5, _6, _7) | |
1598 | |
1599 #define RX_UINT_REQUIRE_NOT_EQUAL(x1, x2) \ | |
1600 RX_UINT_REQUIRE_NOT_EQUAL_MSG(x1, x2, NULL) | |
1601 | |
1602 #if RX__HAS_VARIADIC_MACROS | |
1603 #define RX_UINT_REQUIRE_NOT_EQUAL_MSG(x1, x2, ...) \ | |
1604 RX__UINT_DEFINE_TEST(RX_FATAL, RX__OP_NOT_EQUAL, x1, x2, __VA_ARGS__) | |
1605 #else | |
1606 #define RX_UINT_REQUIRE_NOT_EQUAL_MSG(x1, x2, msg) \ | |
1607 RX__UINT_DEFINE_TEST(RX_FATAL, RX__OP_NOT_EQUAL, x1, x2, msg, \ | |
1608 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) | |
1609 #endif | |
1610 | |
1611 #define RX_UINT_REQUIRE_NOT_EQUAL_MSG_1(x1, x2, msg, \ | |
1612 _0) \ | |
1613 RX__UINT_DEFINE_TEST(RX_FATAL, RX__OP_NOT_EQUAL, x1, x2, msg, \ | |
1614 _0, NULL, NULL, NULL, NULL, NULL, NULL, NULL) | |
1615 | |
1616 #define RX_UINT_REQUIRE_NOT_EQUAL_MSG_2(x1, x2, msg, \ | |
1617 _0, _1) \ | |
1618 RX__UINT_DEFINE_TEST(RX_FATAL, RX__OP_NOT_EQUAL, x1, x2, msg, \ | |
1619 _0, _1, NULL, NULL, NULL, NULL, NULL, NULL) | |
1620 | |
1621 #define RX_UINT_REQUIRE_NOT_EQUAL_MSG_3(x1, x2, msg, \ | |
1622 _0, _1, _2) \ | |
1623 RX__UINT_DEFINE_TEST(RX_FATAL, RX__OP_NOT_EQUAL, x1, x2, msg, \ | |
1624 _0, _1, _2, NULL, NULL, NULL, NULL, NULL) | |
1625 | |
1626 #define RX_UINT_REQUIRE_NOT_EQUAL_MSG_4(x1, x2, msg, \ | |
1627 _0, _1, _2, _3) \ | |
1628 RX__UINT_DEFINE_TEST(RX_FATAL, RX__OP_NOT_EQUAL, x1, x2, msg, \ | |
1629 _0, _1, _2, _3, NULL, NULL, NULL, NULL) | |
1630 | |
1631 #define RX_UINT_REQUIRE_NOT_EQUAL_MSG_5(x1, x2, msg, \ | |
1632 _0, _1, _2, _3, _4) \ | |
1633 RX__UINT_DEFINE_TEST(RX_FATAL, RX__OP_NOT_EQUAL, x1, x2, msg, \ | |
1634 _0, _1, _2, _3, _4, NULL, NULL, NULL) | |
1635 | |
1636 #define RX_UINT_REQUIRE_NOT_EQUAL_MSG_6(x1, x2, msg, \ | |
1637 _0, _1, _2, _3, _4, _5) \ | |
1638 RX__UINT_DEFINE_TEST(RX_FATAL, RX__OP_NOT_EQUAL, x1, x2, msg, \ | |
1639 _0, _1, _2, _3, _4, _5, NULL, NULL) | |
1640 | |
1641 #define RX_UINT_REQUIRE_NOT_EQUAL_MSG_7(x1, x2, msg, \ | |
1642 _0, _1, _2, _3, _4, _5, _6) \ | |
1643 RX__UINT_DEFINE_TEST(RX_FATAL, RX__OP_NOT_EQUAL, x1, x2, msg, \ | |
1644 _0, _1, _2, _3, _4, _5, _6, NULL) | |
1645 | |
1646 #define RX_UINT_REQUIRE_NOT_EQUAL_MSG_8(x1, x2, msg, \ | |
1647 _0, _1, _2, _3, _4, _5, _6, _7) \ | |
1648 RX__UINT_DEFINE_TEST(RX_FATAL, RX__OP_NOT_EQUAL, x1, x2, msg, \ | |
1649 _0, _1, _2, _3, _4, _5, _6, _7) | |
1650 | |
1651 #define RX_UINT_CHECK_NOT_EQUAL(x1, x2) \ | |
1652 RX_UINT_CHECK_NOT_EQUAL_MSG(x1, x2, NULL) | |
1653 | |
1654 #if RX__HAS_VARIADIC_MACROS | |
1655 #define RX_UINT_CHECK_NOT_EQUAL_MSG(x1, x2, ...) \ | |
1656 RX__UINT_DEFINE_TEST(RX_NONFATAL, RX__OP_NOT_EQUAL, x1, x2, __VA_ARGS__) | |
1657 #else | |
1658 #define RX_UINT_CHECK_NOT_EQUAL_MSG(x1, x2, msg) \ | |
1659 RX__UINT_DEFINE_TEST(RX_NONFATAL, RX__OP_NOT_EQUAL, x1, x2, msg, \ | |
1660 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) | |
1661 #endif | |
1662 | |
1663 #define RX_UINT_CHECK_NOT_EQUAL_MSG_1(x1, x2, msg, \ | |
1664 _0) \ | |
1665 RX__UINT_DEFINE_TEST(RX_NONFATAL, RX__OP_NOT_EQUAL, x1, x2, msg, \ | |
1666 _0, NULL, NULL, NULL, NULL, NULL, NULL, NULL) | |
1667 | |
1668 #define RX_UINT_CHECK_NOT_EQUAL_MSG_2(x1, x2, msg, \ | |
1669 _0, _1) \ | |
1670 RX__UINT_DEFINE_TEST(RX_NONFATAL, RX__OP_NOT_EQUAL, x1, x2, msg, \ | |
1671 _0, _1, NULL, NULL, NULL, NULL, NULL, NULL) | |
1672 | |
1673 #define RX_UINT_CHECK_NOT_EQUAL_MSG_3(x1, x2, msg, \ | |
1674 _0, _1, _2) \ | |
1675 RX__UINT_DEFINE_TEST(RX_NONFATAL, RX__OP_NOT_EQUAL, x1, x2, msg, \ | |
1676 _0, _1, _2, NULL, NULL, NULL, NULL, NULL) | |
1677 | |
1678 #define RX_UINT_CHECK_NOT_EQUAL_MSG_4(x1, x2, msg, \ | |
1679 _0, _1, _2, _3) \ | |
1680 RX__UINT_DEFINE_TEST(RX_NONFATAL, RX__OP_NOT_EQUAL, x1, x2, msg, \ | |
1681 _0, _1, _2, _3, NULL, NULL, NULL, NULL) | |
1682 | |
1683 #define RX_UINT_CHECK_NOT_EQUAL_MSG_5(x1, x2, msg, \ | |
1684 _0, _1, _2, _3, _4) \ | |
1685 RX__UINT_DEFINE_TEST(RX_NONFATAL, RX__OP_NOT_EQUAL, x1, x2, msg, \ | |
1686 _0, _1, _2, _3, _4, NULL, NULL, NULL) | |
1687 | |
1688 #define RX_UINT_CHECK_NOT_EQUAL_MSG_6(x1, x2, msg, \ | |
1689 _0, _1, _2, _3, _4, _5) \ | |
1690 RX__UINT_DEFINE_TEST(RX_NONFATAL, RX__OP_NOT_EQUAL, x1, x2, msg, \ | |
1691 _0, _1, _2, _3, _4, _5, NULL, NULL) | |
1692 | |
1693 #define RX_UINT_CHECK_NOT_EQUAL_MSG_7(x1, x2, msg, \ | |
1694 _0, _1, _2, _3, _4, _5, _6) \ | |
1695 RX__UINT_DEFINE_TEST(RX_NONFATAL, RX__OP_NOT_EQUAL, x1, x2, msg, \ | |
1696 _0, _1, _2, _3, _4, _5, _6, NULL) | |
1697 | |
1698 #define RX_UINT_CHECK_NOT_EQUAL_MSG_8(x1, x2, msg, \ | |
1699 _0, _1, _2, _3, _4, _5, _6, _7) \ | |
1700 RX__UINT_DEFINE_TEST(RX_NONFATAL, RX__OP_NOT_EQUAL, x1, x2, msg, \ | |
1701 _0, _1, _2, _3, _4, _5, _6, _7) | |
1702 | |
1703 #define RX_UINT_REQUIRE_GREATER(x1, x2) \ | |
1704 RX_UINT_REQUIRE_GREATER_MSG(x1, x2, NULL) | |
1705 | |
1706 #if RX__HAS_VARIADIC_MACROS | |
1707 #define RX_UINT_REQUIRE_GREATER_MSG(x1, x2, ...) \ | |
1708 RX__UINT_DEFINE_TEST(RX_FATAL, RX__OP_GREATER, x1, x2, __VA_ARGS__) | |
1709 #else | |
1710 #define RX_UINT_REQUIRE_GREATER_MSG(x1, x2, msg) \ | |
1711 RX__UINT_DEFINE_TEST(RX_FATAL, RX__OP_GREATER, x1, x2, msg, \ | |
1712 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) | |
1713 #endif | |
1714 | |
1715 #define RX_UINT_REQUIRE_GREATER_MSG_1(x1, x2, msg, \ | |
1716 _0) \ | |
1717 RX__UINT_DEFINE_TEST(RX_FATAL, RX__OP_GREATER, x1, x2, msg, \ | |
1718 _0, NULL, NULL, NULL, NULL, NULL, NULL, NULL) | |
1719 | |
1720 #define RX_UINT_REQUIRE_GREATER_MSG_2(x1, x2, msg, \ | |
1721 _0, _1) \ | |
1722 RX__UINT_DEFINE_TEST(RX_FATAL, RX__OP_GREATER, x1, x2, msg, \ | |
1723 _0, _1, NULL, NULL, NULL, NULL, NULL, NULL) | |
1724 | |
1725 #define RX_UINT_REQUIRE_GREATER_MSG_3(x1, x2, msg, \ | |
1726 _0, _1, _2) \ | |
1727 RX__UINT_DEFINE_TEST(RX_FATAL, RX__OP_GREATER, x1, x2, msg, \ | |
1728 _0, _1, _2, NULL, NULL, NULL, NULL, NULL) | |
1729 | |
1730 #define RX_UINT_REQUIRE_GREATER_MSG_4(x1, x2, msg, \ | |
1731 _0, _1, _2, _3) \ | |
1732 RX__UINT_DEFINE_TEST(RX_FATAL, RX__OP_GREATER, x1, x2, msg, \ | |
1733 _0, _1, _2, _3, NULL, NULL, NULL, NULL) | |
1734 | |
1735 #define RX_UINT_REQUIRE_GREATER_MSG_5(x1, x2, msg, \ | |
1736 _0, _1, _2, _3, _4) \ | |
1737 RX__UINT_DEFINE_TEST(RX_FATAL, RX__OP_GREATER, x1, x2, msg, \ | |
1738 _0, _1, _2, _3, _4, NULL, NULL, NULL) | |
1739 | |
1740 #define RX_UINT_REQUIRE_GREATER_MSG_6(x1, x2, msg, \ | |
1741 _0, _1, _2, _3, _4, _5) \ | |
1742 RX__UINT_DEFINE_TEST(RX_FATAL, RX__OP_GREATER, x1, x2, msg, \ | |
1743 _0, _1, _2, _3, _4, _5, NULL, NULL) | |
1744 | |
1745 #define RX_UINT_REQUIRE_GREATER_MSG_7(x1, x2, msg, \ | |
1746 _0, _1, _2, _3, _4, _5, _6) \ | |
1747 RX__UINT_DEFINE_TEST(RX_FATAL, RX__OP_GREATER, x1, x2, msg, \ | |
1748 _0, _1, _2, _3, _4, _5, _6, NULL) | |
1749 | |
1750 #define RX_UINT_REQUIRE_GREATER_MSG_8(x1, x2, msg, \ | |
1751 _0, _1, _2, _3, _4, _5, _6, _7) \ | |
1752 RX__UINT_DEFINE_TEST(RX_FATAL, RX__OP_GREATER, x1, x2, msg, \ | |
1753 _0, _1, _2, _3, _4, _5, _6, _7) | |
1754 | |
1755 #define RX_UINT_CHECK_GREATER(x1, x2) \ | |
1756 RX_UINT_CHECK_GREATER_MSG(x1, x2, NULL) | |
1757 | |
1758 #if RX__HAS_VARIADIC_MACROS | |
1759 #define RX_UINT_CHECK_GREATER_MSG(x1, x2, ...) \ | |
1760 RX__UINT_DEFINE_TEST(RX_NONFATAL, RX__OP_GREATER, x1, x2, __VA_ARGS__) | |
1761 #else | |
1762 #define RX_UINT_CHECK_GREATER_MSG(x1, x2, msg) \ | |
1763 RX__UINT_DEFINE_TEST(RX_NONFATAL, RX__OP_GREATER, x1, x2, msg, \ | |
1764 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) | |
1765 #endif | |
1766 | |
1767 #define RX_UINT_CHECK_GREATER_MSG_1(x1, x2, msg, \ | |
1768 _0) \ | |
1769 RX__UINT_DEFINE_TEST(RX_NONFATAL, RX__OP_GREATER, x1, x2, msg, \ | |
1770 _0, NULL, NULL, NULL, NULL, NULL, NULL, NULL) | |
1771 | |
1772 #define RX_UINT_CHECK_GREATER_MSG_2(x1, x2, msg, \ | |
1773 _0, _1) \ | |
1774 RX__UINT_DEFINE_TEST(RX_NONFATAL, RX__OP_GREATER, x1, x2, msg, \ | |
1775 _0, _1, NULL, NULL, NULL, NULL, NULL, NULL) | |
1776 | |
1777 #define RX_UINT_CHECK_GREATER_MSG_3(x1, x2, msg, \ | |
1778 _0, _1, _2) \ | |
1779 RX__UINT_DEFINE_TEST(RX_NONFATAL, RX__OP_GREATER, x1, x2, msg, \ | |
1780 _0, _1, _2, NULL, NULL, NULL, NULL, NULL) | |
1781 | |
1782 #define RX_UINT_CHECK_GREATER_MSG_4(x1, x2, msg, \ | |
1783 _0, _1, _2, _3) \ | |
1784 RX__UINT_DEFINE_TEST(RX_NONFATAL, RX__OP_GREATER, x1, x2, msg, \ | |
1785 _0, _1, _2, _3, NULL, NULL, NULL, NULL) | |
1786 | |
1787 #define RX_UINT_CHECK_GREATER_MSG_5(x1, x2, msg, \ | |
1788 _0, _1, _2, _3, _4) \ | |
1789 RX__UINT_DEFINE_TEST(RX_NONFATAL, RX__OP_GREATER, x1, x2, msg, \ | |
1790 _0, _1, _2, _3, _4, NULL, NULL, NULL) | |
1791 | |
1792 #define RX_UINT_CHECK_GREATER_MSG_6(x1, x2, msg, \ | |
1793 _0, _1, _2, _3, _4, _5) \ | |
1794 RX__UINT_DEFINE_TEST(RX_NONFATAL, RX__OP_GREATER, x1, x2, msg, \ | |
1795 _0, _1, _2, _3, _4, _5, NULL, NULL) | |
1796 | |
1797 #define RX_UINT_CHECK_GREATER_MSG_7(x1, x2, msg, \ | |
1798 _0, _1, _2, _3, _4, _5, _6) \ | |
1799 RX__UINT_DEFINE_TEST(RX_NONFATAL, RX__OP_GREATER, x1, x2, msg, \ | |
1800 _0, _1, _2, _3, _4, _5, _6, NULL) | |
1801 | |
1802 #define RX_UINT_CHECK_GREATER_MSG_8(x1, x2, msg, \ | |
1803 _0, _1, _2, _3, _4, _5, _6, _7) \ | |
1804 RX__UINT_DEFINE_TEST(RX_NONFATAL, RX__OP_GREATER, x1, x2, msg, \ | |
1805 _0, _1, _2, _3, _4, _5, _6, _7) | |
1806 | |
1807 #define RX_UINT_REQUIRE_LESSER(x1, x2) \ | |
1808 RX_UINT_REQUIRE_LESSER_MSG(x1, x2, NULL) | |
1809 | |
1810 #if RX__HAS_VARIADIC_MACROS | |
1811 #define RX_UINT_REQUIRE_LESSER_MSG(x1, x2, ...) \ | |
1812 RX__UINT_DEFINE_TEST(RX_FATAL, RX__OP_LESSER, x1, x2, __VA_ARGS__) | |
1813 #else | |
1814 #define RX_UINT_REQUIRE_LESSER_MSG(x1, x2, msg) \ | |
1815 RX__UINT_DEFINE_TEST(RX_FATAL, RX__OP_LESSER, x1, x2, msg, \ | |
1816 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) | |
1817 #endif | |
1818 | |
1819 #define RX_UINT_REQUIRE_LESSER_MSG_1(x1, x2, msg, \ | |
1820 _0) \ | |
1821 RX__UINT_DEFINE_TEST(RX_FATAL, RX__OP_LESSER, x1, x2, msg, \ | |
1822 _0, NULL, NULL, NULL, NULL, NULL, NULL, NULL) | |
1823 | |
1824 #define RX_UINT_REQUIRE_LESSER_MSG_2(x1, x2, msg, \ | |
1825 _0, _1) \ | |
1826 RX__UINT_DEFINE_TEST(RX_FATAL, RX__OP_LESSER, x1, x2, msg, \ | |
1827 _0, _1, NULL, NULL, NULL, NULL, NULL, NULL) | |
1828 | |
1829 #define RX_UINT_REQUIRE_LESSER_MSG_3(x1, x2, msg, \ | |
1830 _0, _1, _2) \ | |
1831 RX__UINT_DEFINE_TEST(RX_FATAL, RX__OP_LESSER, x1, x2, msg, \ | |
1832 _0, _1, _2, NULL, NULL, NULL, NULL, NULL) | |
1833 | |
1834 #define RX_UINT_REQUIRE_LESSER_MSG_4(x1, x2, msg, \ | |
1835 _0, _1, _2, _3) \ | |
1836 RX__UINT_DEFINE_TEST(RX_FATAL, RX__OP_LESSER, x1, x2, msg, \ | |
1837 _0, _1, _2, _3, NULL, NULL, NULL, NULL) | |
1838 | |
1839 #define RX_UINT_REQUIRE_LESSER_MSG_5(x1, x2, msg, \ | |
1840 _0, _1, _2, _3, _4) \ | |
1841 RX__UINT_DEFINE_TEST(RX_FATAL, RX__OP_LESSER, x1, x2, msg, \ | |
1842 _0, _1, _2, _3, _4, NULL, NULL, NULL) | |
1843 | |
1844 #define RX_UINT_REQUIRE_LESSER_MSG_6(x1, x2, msg, \ | |
1845 _0, _1, _2, _3, _4, _5) \ | |
1846 RX__UINT_DEFINE_TEST(RX_FATAL, RX__OP_LESSER, x1, x2, msg, \ | |
1847 _0, _1, _2, _3, _4, _5, NULL, NULL) | |
1848 | |
1849 #define RX_UINT_REQUIRE_LESSER_MSG_7(x1, x2, msg, \ | |
1850 _0, _1, _2, _3, _4, _5, _6) \ | |
1851 RX__UINT_DEFINE_TEST(RX_FATAL, RX__OP_LESSER, x1, x2, msg, \ | |
1852 _0, _1, _2, _3, _4, _5, _6, NULL) | |
1853 | |
1854 #define RX_UINT_REQUIRE_LESSER_MSG_8(x1, x2, msg, \ | |
1855 _0, _1, _2, _3, _4, _5, _6, _7) \ | |
1856 RX__UINT_DEFINE_TEST(RX_FATAL, RX__OP_LESSER, x1, x2, msg, \ | |
1857 _0, _1, _2, _3, _4, _5, _6, _7) | |
1858 | |
1859 #define RX_UINT_CHECK_LESSER(x1, x2) \ | |
1860 RX_UINT_CHECK_LESSER_MSG(x1, x2, NULL) | |
1861 | |
1862 #if RX__HAS_VARIADIC_MACROS | |
1863 #define RX_UINT_CHECK_LESSER_MSG(x1, x2, ...) \ | |
1864 RX__UINT_DEFINE_TEST(RX_NONFATAL, RX__OP_LESSER, x1, x2, __VA_ARGS__) | |
1865 #else | |
1866 #define RX_UINT_CHECK_LESSER_MSG(x1, x2, msg) \ | |
1867 RX__UINT_DEFINE_TEST(RX_NONFATAL, RX__OP_LESSER, x1, x2, msg, \ | |
1868 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) | |
1869 #endif | |
1870 | |
1871 #define RX_UINT_CHECK_LESSER_MSG_1(x1, x2, msg, \ | |
1872 _0) \ | |
1873 RX__UINT_DEFINE_TEST(RX_NONFATAL, RX__OP_LESSER, x1, x2, msg, \ | |
1874 _0, NULL, NULL, NULL, NULL, NULL, NULL, NULL) | |
1875 | |
1876 #define RX_UINT_CHECK_LESSER_MSG_2(x1, x2, msg, \ | |
1877 _0, _1) \ | |
1878 RX__UINT_DEFINE_TEST(RX_NONFATAL, RX__OP_LESSER, x1, x2, msg, \ | |
1879 _0, _1, NULL, NULL, NULL, NULL, NULL, NULL) | |
1880 | |
1881 #define RX_UINT_CHECK_LESSER_MSG_3(x1, x2, msg, \ | |
1882 _0, _1, _2) \ | |
1883 RX__UINT_DEFINE_TEST(RX_NONFATAL, RX__OP_LESSER, x1, x2, msg, \ | |
1884 _0, _1, _2, NULL, NULL, NULL, NULL, NULL) | |
1885 | |
1886 #define RX_UINT_CHECK_LESSER_MSG_4(x1, x2, msg, \ | |
1887 _0, _1, _2, _3) \ | |
1888 RX__UINT_DEFINE_TEST(RX_NONFATAL, RX__OP_LESSER, x1, x2, msg, \ | |
1889 _0, _1, _2, _3, NULL, NULL, NULL, NULL) | |
1890 | |
1891 #define RX_UINT_CHECK_LESSER_MSG_5(x1, x2, msg, \ | |
1892 _0, _1, _2, _3, _4) \ | |
1893 RX__UINT_DEFINE_TEST(RX_NONFATAL, RX__OP_LESSER, x1, x2, msg, \ | |
1894 _0, _1, _2, _3, _4, NULL, NULL, NULL) | |
1895 | |
1896 #define RX_UINT_CHECK_LESSER_MSG_6(x1, x2, msg, \ | |
1897 _0, _1, _2, _3, _4, _5) \ | |
1898 RX__UINT_DEFINE_TEST(RX_NONFATAL, RX__OP_LESSER, x1, x2, msg, \ | |
1899 _0, _1, _2, _3, _4, _5, NULL, NULL) | |
1900 | |
1901 #define RX_UINT_CHECK_LESSER_MSG_7(x1, x2, msg, \ | |
1902 _0, _1, _2, _3, _4, _5, _6) \ | |
1903 RX__UINT_DEFINE_TEST(RX_NONFATAL, RX__OP_LESSER, x1, x2, msg, \ | |
1904 _0, _1, _2, _3, _4, _5, _6, NULL) | |
1905 | |
1906 #define RX_UINT_CHECK_LESSER_MSG_8(x1, x2, msg, \ | |
1907 _0, _1, _2, _3, _4, _5, _6, _7) \ | |
1908 RX__UINT_DEFINE_TEST(RX_NONFATAL, RX__OP_LESSER, x1, x2, msg, \ | |
1909 _0, _1, _2, _3, _4, _5, _6, _7) | |
1910 | |
1911 #define RX_UINT_REQUIRE_GREATER_OR_EQUAL(x1, x2) \ | |
1912 RX_UINT_REQUIRE_GREATER_OR_EQUAL_MSG(x1, x2, NULL) | |
1913 | |
1914 #if RX__HAS_VARIADIC_MACROS | |
1915 #define RX_UINT_REQUIRE_GREATER_OR_EQUAL_MSG(x1, x2, ...) \ | |
1916 RX__UINT_DEFINE_TEST(RX_FATAL, RX__OP_GREATER_OR_EQUAL, x1, x2, \ | |
1917 __VA_ARGS__) | |
1918 #else | |
1919 #define RX_UINT_REQUIRE_GREATER_OR_EQUAL_MSG(x1, x2, msg) \ | |
1920 RX__UINT_DEFINE_TEST(RX_FATAL, RX__OP_GREATER_OR_EQUAL, x1, x2, msg, \ | |
1921 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) | |
1922 #endif | |
1923 | |
1924 #define RX_UINT_REQUIRE_GREATER_OR_EQUAL_MSG_1(x1, x2, msg, \ | |
1925 _0) \ | |
1926 RX__UINT_DEFINE_TEST(RX_FATAL, RX__OP_GREATER_OR_EQUAL, x1, x2, msg, \ | |
1927 _0, NULL, NULL, NULL, NULL, NULL, NULL, NULL) | |
1928 | |
1929 #define RX_UINT_REQUIRE_GREATER_OR_EQUAL_MSG_2(x1, x2, msg, \ | |
1930 _0, _1) \ | |
1931 RX__UINT_DEFINE_TEST(RX_FATAL, RX__OP_GREATER_OR_EQUAL, x1, x2, msg, \ | |
1932 _0, _1, NULL, NULL, NULL, NULL, NULL, NULL) | |
1933 | |
1934 #define RX_UINT_REQUIRE_GREATER_OR_EQUAL_MSG_3(x1, x2, msg, \ | |
1935 _0, _1, _2) \ | |
1936 RX__UINT_DEFINE_TEST(RX_FATAL, RX__OP_GREATER_OR_EQUAL, x1, x2, msg, \ | |
1937 _0, _1, _2, NULL, NULL, NULL, NULL, NULL) | |
1938 | |
1939 #define RX_UINT_REQUIRE_GREATER_OR_EQUAL_MSG_4(x1, x2, msg, \ | |
1940 _0, _1, _2, _3) \ | |
1941 RX__UINT_DEFINE_TEST(RX_FATAL, RX__OP_GREATER_OR_EQUAL, x1, x2, msg, \ | |
1942 _0, _1, _2, _3, NULL, NULL, NULL, NULL) | |
1943 | |
1944 #define RX_UINT_REQUIRE_GREATER_OR_EQUAL_MSG_5(x1, x2, msg, \ | |
1945 _0, _1, _2, _3, _4) \ | |
1946 RX__UINT_DEFINE_TEST(RX_FATAL, RX__OP_GREATER_OR_EQUAL, x1, x2, msg, \ | |
1947 _0, _1, _2, _3, _4, NULL, NULL, NULL) | |
1948 | |
1949 #define RX_UINT_REQUIRE_GREATER_OR_EQUAL_MSG_6(x1, x2, msg, \ | |
1950 _0, _1, _2, _3, _4, _5) \ | |
1951 RX__UINT_DEFINE_TEST(RX_FATAL, RX__OP_GREATER_OR_EQUAL, x1, x2, msg, \ | |
1952 _0, _1, _2, _3, _4, _5, NULL, NULL) | |
1953 | |
1954 #define RX_UINT_REQUIRE_GREATER_OR_EQUAL_MSG_7(x1, x2, msg, \ | |
1955 _0, _1, _2, _3, _4, _5, _6) \ | |
1956 RX__UINT_DEFINE_TEST(RX_FATAL, RX__OP_GREATER_OR_EQUAL, x1, x2, msg, \ | |
1957 _0, _1, _2, _3, _4, _5, _6, NULL) | |
1958 | |
1959 #define RX_UINT_REQUIRE_GREATER_OR_EQUAL_MSG_8(x1, x2, msg, \ | |
1960 _0, _1, _2, _3, _4, _5, _6, _7) \ | |
1961 RX__UINT_DEFINE_TEST(RX_FATAL, RX__OP_GREATER_OR_EQUAL, x1, x2, msg, \ | |
1962 _0, _1, _2, _3, _4, _5, _6, _7) | |
1963 | |
1964 #define RX_UINT_CHECK_GREATER_OR_EQUAL(x1, x2) \ | |
1965 RX_UINT_CHECK_GREATER_OR_EQUAL_MSG(x1, x2, NULL) | |
1966 | |
1967 #if RX__HAS_VARIADIC_MACROS | |
1968 #define RX_UINT_CHECK_GREATER_OR_EQUAL_MSG(x1, x2, ...) \ | |
1969 RX__UINT_DEFINE_TEST(RX_NONFATAL, RX__OP_GREATER_OR_EQUAL, x1, x2, \ | |
1970 __VA_ARGS__) | |
1971 #else | |
1972 #define RX_UINT_CHECK_GREATER_OR_EQUAL_MSG(x1, x2, msg) \ | |
1973 RX__UINT_DEFINE_TEST(RX_NONFATAL, RX__OP_GREATER_OR_EQUAL, x1, x2, msg,\ | |
1974 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) | |
1975 #endif | |
1976 | |
1977 #define RX_UINT_CHECK_GREATER_OR_EQUAL_MSG_1(x1, x2, msg, \ | |
1978 _0) \ | |
1979 RX__UINT_DEFINE_TEST(RX_NONFATAL, RX__OP_GREATER_OR_EQUAL, x1, x2, msg, \ | |
1980 _0, NULL, NULL, NULL, NULL, NULL, NULL, NULL) | |
1981 | |
1982 #define RX_UINT_CHECK_GREATER_OR_EQUAL_MSG_2(x1, x2, msg, \ | |
1983 _0, _1) \ | |
1984 RX__UINT_DEFINE_TEST(RX_NONFATAL, RX__OP_GREATER_OR_EQUAL, x1, x2, msg, \ | |
1985 _0, _1, NULL, NULL, NULL, NULL, NULL, NULL) | |
1986 | |
1987 #define RX_UINT_CHECK_GREATER_OR_EQUAL_MSG_3(x1, x2, msg, \ | |
1988 _0, _1, _2) \ | |
1989 RX__UINT_DEFINE_TEST(RX_NONFATAL, RX__OP_GREATER_OR_EQUAL, x1, x2, msg, \ | |
1990 _0, _1, _2, NULL, NULL, NULL, NULL, NULL) | |
1991 | |
1992 #define RX_UINT_CHECK_GREATER_OR_EQUAL_MSG_4(x1, x2, msg, \ | |
1993 _0, _1, _2, _3) \ | |
1994 RX__UINT_DEFINE_TEST(RX_NONFATAL, RX__OP_GREATER_OR_EQUAL, x1, x2, msg, \ | |
1995 _0, _1, _2, _3, NULL, NULL, NULL, NULL) | |
1996 | |
1997 #define RX_UINT_CHECK_GREATER_OR_EQUAL_MSG_5(x1, x2, msg, \ | |
1998 _0, _1, _2, _3, _4) \ | |
1999 RX__UINT_DEFINE_TEST(RX_NONFATAL, RX__OP_GREATER_OR_EQUAL, x1, x2, msg, \ | |
2000 _0, _1, _2, _3, _4, NULL, NULL, NULL) | |
2001 | |
2002 #define RX_UINT_CHECK_GREATER_OR_EQUAL_MSG_6(x1, x2, msg, \ | |
2003 _0, _1, _2, _3, _4, _5) \ | |
2004 RX__UINT_DEFINE_TEST(RX_NONFATAL, RX__OP_GREATER_OR_EQUAL, x1, x2, msg, \ | |
2005 _0, _1, _2, _3, _4, _5, NULL, NULL) | |
2006 | |
2007 #define RX_UINT_CHECK_GREATER_OR_EQUAL_MSG_7(x1, x2, msg, \ | |
2008 _0, _1, _2, _3, _4, _5, _6) \ | |
2009 RX__UINT_DEFINE_TEST(RX_NONFATAL, RX__OP_GREATER_OR_EQUAL, x1, x2, msg, \ | |
2010 _0, _1, _2, _3, _4, _5, _6, NULL) | |
2011 | |
2012 #define RX_UINT_CHECK_GREATER_OR_EQUAL_MSG_8(x1, x2, msg, \ | |
2013 _0, _1, _2, _3, _4, _5, _6, _7) \ | |
2014 RX__UINT_DEFINE_TEST(RX_NONFATAL, RX__OP_GREATER_OR_EQUAL, x1, x2, msg, \ | |
2015 _0, _1, _2, _3, _4, _5, _6, _7) | |
2016 | |
2017 #define RX_UINT_REQUIRE_LESSER_OR_EQUAL(x1, x2) \ | |
2018 RX_UINT_REQUIRE_LESSER_OR_EQUAL_MSG(x1, x2, NULL) | |
2019 | |
2020 #if RX__HAS_VARIADIC_MACROS | |
2021 #define RX_UINT_REQUIRE_LESSER_OR_EQUAL_MSG(x1, x2, ...) \ | |
2022 RX__UINT_DEFINE_TEST(RX_FATAL, RX__OP_LESSER_OR_EQUAL, x1, x2, \ | |
2023 __VA_ARGS__) | |
2024 #else | |
2025 #define RX_UINT_REQUIRE_LESSER_OR_EQUAL_MSG(x1, x2, msg) \ | |
2026 RX__UINT_DEFINE_TEST(RX_FATAL, RX__OP_LESSER_OR_EQUAL, x1, x2, msg, \ | |
2027 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) | |
2028 #endif | |
2029 | |
2030 #define RX_UINT_REQUIRE_LESSER_OR_EQUAL_MSG_1(x1, x2, msg, \ | |
2031 _0) \ | |
2032 RX__UINT_DEFINE_TEST(RX_FATAL, RX__OP_LESSER_OR_EQUAL, x1, x2, msg, \ | |
2033 _0, NULL, NULL, NULL, NULL, NULL, NULL, NULL) | |
2034 | |
2035 #define RX_UINT_REQUIRE_LESSER_OR_EQUAL_MSG_2(x1, x2, msg, \ | |
2036 _0, _1) \ | |
2037 RX__UINT_DEFINE_TEST(RX_FATAL, RX__OP_LESSER_OR_EQUAL, x1, x2, msg, \ | |
2038 _0, _1, NULL, NULL, NULL, NULL, NULL, NULL) | |
2039 | |
2040 #define RX_UINT_REQUIRE_LESSER_OR_EQUAL_MSG_3(x1, x2, msg, \ | |
2041 _0, _1, _2) \ | |
2042 RX__UINT_DEFINE_TEST(RX_FATAL, RX__OP_LESSER_OR_EQUAL, x1, x2, msg, \ | |
2043 _0, _1, _2, NULL, NULL, NULL, NULL, NULL) | |
2044 | |
2045 #define RX_UINT_REQUIRE_LESSER_OR_EQUAL_MSG_4(x1, x2, msg, \ | |
2046 _0, _1, _2, _3) \ | |
2047 RX__UINT_DEFINE_TEST(RX_FATAL, RX__OP_LESSER_OR_EQUAL, x1, x2, msg, \ | |
2048 _0, _1, _2, _3, NULL, NULL, NULL, NULL) | |
2049 | |
2050 #define RX_UINT_REQUIRE_LESSER_OR_EQUAL_MSG_5(x1, x2, msg, \ | |
2051 _0, _1, _2, _3, _4) \ | |
2052 RX__UINT_DEFINE_TEST(RX_FATAL, RX__OP_LESSER_OR_EQUAL, x1, x2, msg, \ | |
2053 _0, _1, _2, _3, _4, NULL, NULL, NULL) | |
2054 | |
2055 #define RX_UINT_REQUIRE_LESSER_OR_EQUAL_MSG_6(x1, x2, msg, \ | |
2056 _0, _1, _2, _3, _4, _5) \ | |
2057 RX__UINT_DEFINE_TEST(RX_FATAL, RX__OP_LESSER_OR_EQUAL, x1, x2, msg, \ | |
2058 _0, _1, _2, _3, _4, _5, NULL, NULL) | |
2059 | |
2060 #define RX_UINT_REQUIRE_LESSER_OR_EQUAL_MSG_7(x1, x2, msg, \ | |
2061 _0, _1, _2, _3, _4, _5, _6) \ | |
2062 RX__UINT_DEFINE_TEST(RX_FATAL, RX__OP_LESSER_OR_EQUAL, x1, x2, msg, \ | |
2063 _0, _1, _2, _3, _4, _5, _6, NULL) | |
2064 | |
2065 #define RX_UINT_REQUIRE_LESSER_OR_EQUAL_MSG_8(x1, x2, msg, \ | |
2066 _0, _1, _2, _3, _4, _5, _6, _7) \ | |
2067 RX__UINT_DEFINE_TEST(RX_FATAL, RX__OP_LESSER_OR_EQUAL, x1, x2, msg, \ | |
2068 _0, _1, _2, _3, _4, _5, _6, _7) | |
2069 | |
2070 #define RX_UINT_CHECK_LESSER_OR_EQUAL(x1, x2) \ | |
2071 RX_UINT_CHECK_LESSER_OR_EQUAL_MSG(x1, x2, NULL) | |
2072 | |
2073 #if RX__HAS_VARIADIC_MACROS | |
2074 #define RX_UINT_CHECK_LESSER_OR_EQUAL_MSG(x1, x2, ...) \ | |
2075 RX__UINT_DEFINE_TEST(RX_NONFATAL, RX__OP_LESSER_OR_EQUAL, x1, x2, \ | |
2076 __VA_ARGS__) | |
2077 #else | |
2078 #define RX_UINT_CHECK_LESSER_OR_EQUAL_MSG(x1, x2, msg) \ | |
2079 RX__UINT_DEFINE_TEST(RX_NONFATAL, RX__OP_LESSER_OR_EQUAL, x1, x2, msg, \ | |
2080 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) | |
2081 #endif | |
2082 | |
2083 #define RX_UINT_CHECK_LESSER_OR_EQUAL_MSG_1(x1, x2, msg, \ | |
2084 _0) \ | |
2085 RX__UINT_DEFINE_TEST(RX_NONFATAL, RX__OP_LESSER_OR_EQUAL, x1, x2, msg, \ | |
2086 _0, NULL, NULL, NULL, NULL, NULL, NULL, NULL) | |
2087 | |
2088 #define RX_UINT_CHECK_LESSER_OR_EQUAL_MSG_2(x1, x2, msg, \ | |
2089 _0, _1) \ | |
2090 RX__UINT_DEFINE_TEST(RX_NONFATAL, RX__OP_LESSER_OR_EQUAL, x1, x2, msg, \ | |
2091 _0, _1, NULL, NULL, NULL, NULL, NULL, NULL) | |
2092 | |
2093 #define RX_UINT_CHECK_LESSER_OR_EQUAL_MSG_3(x1, x2, msg, \ | |
2094 _0, _1, _2) \ | |
2095 RX__UINT_DEFINE_TEST(RX_NONFATAL, RX__OP_LESSER_OR_EQUAL, x1, x2, msg, \ | |
2096 _0, _1, _2, NULL, NULL, NULL, NULL, NULL) | |
2097 | |
2098 #define RX_UINT_CHECK_LESSER_OR_EQUAL_MSG_4(x1, x2, msg, \ | |
2099 _0, _1, _2, _3) \ | |
2100 RX__UINT_DEFINE_TEST(RX_NONFATAL, RX__OP_LESSER_OR_EQUAL, x1, x2, msg, \ | |
2101 _0, _1, _2, _3, NULL, NULL, NULL, NULL) | |
2102 | |
2103 #define RX_UINT_CHECK_LESSER_OR_EQUAL_MSG_5(x1, x2, msg, \ | |
2104 _0, _1, _2, _3, _4) \ | |
2105 RX__UINT_DEFINE_TEST(RX_NONFATAL, RX__OP_LESSER_OR_EQUAL, x1, x2, msg, \ | |
2106 _0, _1, _2, _3, _4, NULL, NULL, NULL) | |
2107 | |
2108 #define RX_UINT_CHECK_LESSER_OR_EQUAL_MSG_6(x1, x2, msg, \ | |
2109 _0, _1, _2, _3, _4, _5) \ | |
2110 RX__UINT_DEFINE_TEST(RX_NONFATAL, RX__OP_LESSER_OR_EQUAL, x1, x2, msg, \ | |
2111 _0, _1, _2, _3, _4, _5, NULL, NULL) | |
2112 | |
2113 #define RX_UINT_CHECK_LESSER_OR_EQUAL_MSG_7(x1, x2, msg, \ | |
2114 _0, _1, _2, _3, _4, _5, _6) \ | |
2115 RX__UINT_DEFINE_TEST(RX_NONFATAL, RX__OP_LESSER_OR_EQUAL, x1, x2, msg, \ | |
2116 _0, _1, _2, _3, _4, _5, _6, NULL) | |
2117 | |
2118 #define RX_UINT_CHECK_LESSER_OR_EQUAL_MSG_8(x1, x2, msg, \ | |
2119 _0, _1, _2, _3, _4, _5, _6, _7) \ | |
2120 RX__UINT_DEFINE_TEST(RX_NONFATAL, RX__OP_LESSER_OR_EQUAL, x1, x2, msg, \ | |
2121 _0, _1, _2, _3, _4, _5, _6, _7) | |
2122 | |
2123 /* Floating-Point Assertions O-(''Q) | |
2124 -------------------------------------------------------------------------- */ | |
2125 | |
2126 #if RX__HAS_VARIADIC_MACROS | |
2127 #define RX__REAL_DEFINE_TEST(severity, op, x1, x2, ...) \ | |
2128 rx__real_assess_comparison(RX_PARAM_CONTEXT, \ | |
2129 (x1), \ | |
2130 (x2), \ | |
2131 op, \ | |
2132 #x1, \ | |
2133 #x2, \ | |
2134 __FILE__, \ | |
2135 __LINE__, \ | |
2136 severity, \ | |
2137 __VA_ARGS__) | |
2138 #else | |
2139 #define RX__REAL_DEFINE_TEST(severity, op, x1, x2, msg, \ | |
2140 _0, _1, _2, _3, _4, _5, _6, _7) \ | |
2141 rx__real_assess_comparison(RX_PARAM_CONTEXT, \ | |
2142 (x1), \ | |
2143 (x2), \ | |
2144 op, \ | |
2145 #x1, \ | |
2146 #x2, \ | |
2147 __FILE__, \ | |
2148 __LINE__, \ | |
2149 severity, \ | |
2150 msg, \ | |
2151 _0, _1, _2, _3, _4, _5, _6, _7) | |
2152 #endif | |
2153 | |
2154 #define RX_REAL_REQUIRE_EQUAL(x1, x2) \ | |
2155 RX_REAL_REQUIRE_EQUAL_MSG(x1, x2, NULL) | |
2156 | |
2157 #if RX__HAS_VARIADIC_MACROS | |
2158 #define RX_REAL_REQUIRE_EQUAL_MSG(x1, x2, ...) \ | |
2159 RX__REAL_DEFINE_TEST(RX_FATAL, RX__OP_EQUAL, x1, x2, __VA_ARGS__) | |
2160 #else | |
2161 #define RX_REAL_REQUIRE_EQUAL_MSG(x1, x2, msg) \ | |
2162 RX__REAL_DEFINE_TEST(RX_FATAL, RX__OP_EQUAL, x1, x2, msg, \ | |
2163 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) | |
2164 #endif | |
2165 | |
2166 #define RX_REAL_REQUIRE_EQUAL_MSG_1(x1, x2, msg, \ | |
2167 _0) \ | |
2168 RX__REAL_DEFINE_TEST(RX_FATAL, RX__OP_EQUAL, x1, x2, msg, \ | |
2169 _0, NULL, NULL, NULL, NULL, NULL, NULL, NULL) | |
2170 | |
2171 #define RX_REAL_REQUIRE_EQUAL_MSG_2(x1, x2, msg, \ | |
2172 _0, _1) \ | |
2173 RX__REAL_DEFINE_TEST(RX_FATAL, RX__OP_EQUAL, x1, x2, msg, \ | |
2174 _0, _1, NULL, NULL, NULL, NULL, NULL, NULL) | |
2175 | |
2176 #define RX_REAL_REQUIRE_EQUAL_MSG_3(x1, x2, msg, \ | |
2177 _0, _1, _2) \ | |
2178 RX__REAL_DEFINE_TEST(RX_FATAL, RX__OP_EQUAL, x1, x2, msg, \ | |
2179 _0, _1, _2, NULL, NULL, NULL, NULL, NULL) | |
2180 | |
2181 #define RX_REAL_REQUIRE_EQUAL_MSG_4(x1, x2, msg, \ | |
2182 _0, _1, _2, _3) \ | |
2183 RX__REAL_DEFINE_TEST(RX_FATAL, RX__OP_EQUAL, x1, x2, msg, \ | |
2184 _0, _1, _2, _3, NULL, NULL, NULL, NULL) | |
2185 | |
2186 #define RX_REAL_REQUIRE_EQUAL_MSG_5(x1, x2, msg, \ | |
2187 _0, _1, _2, _3, _4) \ | |
2188 RX__REAL_DEFINE_TEST(RX_FATAL, RX__OP_EQUAL, x1, x2, msg, \ | |
2189 _0, _1, _2, _3, _4, NULL, NULL, NULL) | |
2190 | |
2191 #define RX_REAL_REQUIRE_EQUAL_MSG_6(x1, x2, msg, \ | |
2192 _0, _1, _2, _3, _4, _5) \ | |
2193 RX__REAL_DEFINE_TEST(RX_FATAL, RX__OP_EQUAL, x1, x2, msg, \ | |
2194 _0, _1, _2, _3, _4, _5, NULL, NULL) | |
2195 | |
2196 #define RX_REAL_REQUIRE_EQUAL_MSG_7(x1, x2, msg, \ | |
2197 _0, _1, _2, _3, _4, _5, _6) \ | |
2198 RX__REAL_DEFINE_TEST(RX_FATAL, RX__OP_EQUAL, x1, x2, msg, \ | |
2199 _0, _1, _2, _3, _4, _5, _6, NULL) | |
2200 | |
2201 #define RX_REAL_REQUIRE_EQUAL_MSG_8(x1, x2, msg, \ | |
2202 _0, _1, _2, _3, _4, _5, _6, _7) \ | |
2203 RX__REAL_DEFINE_TEST(RX_FATAL, RX__OP_EQUAL, x1, x2, msg, \ | |
2204 _0, _1, _2, _3, _4, _5, _6, _7) | |
2205 | |
2206 #define RX_REAL_CHECK_EQUAL(x1, x2) \ | |
2207 RX_REAL_CHECK_EQUAL_MSG(x1, x2, NULL) | |
2208 | |
2209 #if RX__HAS_VARIADIC_MACROS | |
2210 #define RX_REAL_CHECK_EQUAL_MSG(x1, x2, ...) \ | |
2211 RX__REAL_DEFINE_TEST(RX_NONFATAL, RX__OP_EQUAL, x1, x2, __VA_ARGS__) | |
2212 #else | |
2213 #define RX_REAL_CHECK_EQUAL_MSG(x1, x2, msg) \ | |
2214 RX__REAL_DEFINE_TEST(RX_NONFATAL, RX__OP_EQUAL, x1, x2, msg, \ | |
2215 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) | |
2216 #endif | |
2217 | |
2218 #define RX_REAL_CHECK_EQUAL_MSG_1(x1, x2, msg, \ | |
2219 _0) \ | |
2220 RX__REAL_DEFINE_TEST(RX_NONFATAL, RX__OP_EQUAL, x1, x2, msg, \ | |
2221 _0, NULL, NULL, NULL, NULL, NULL, NULL, NULL) | |
2222 | |
2223 #define RX_REAL_CHECK_EQUAL_MSG_2(x1, x2, msg, \ | |
2224 _0, _1) \ | |
2225 RX__REAL_DEFINE_TEST(RX_NONFATAL, RX__OP_EQUAL, x1, x2, msg, \ | |
2226 _0, _1, NULL, NULL, NULL, NULL, NULL, NULL) | |
2227 | |
2228 #define RX_REAL_CHECK_EQUAL_MSG_3(x1, x2, msg, \ | |
2229 _0, _1, _2) \ | |
2230 RX__REAL_DEFINE_TEST(RX_NONFATAL, RX__OP_EQUAL, x1, x2, msg, \ | |
2231 _0, _1, _2, NULL, NULL, NULL, NULL, NULL) | |
2232 | |
2233 #define RX_REAL_CHECK_EQUAL_MSG_4(x1, x2, msg, \ | |
2234 _0, _1, _2, _3) \ | |
2235 RX__REAL_DEFINE_TEST(RX_NONFATAL, RX__OP_EQUAL, x1, x2, msg, \ | |
2236 _0, _1, _2, _3, NULL, NULL, NULL, NULL) | |
2237 | |
2238 #define RX_REAL_CHECK_EQUAL_MSG_5(x1, x2, msg, \ | |
2239 _0, _1, _2, _3, _4) \ | |
2240 RX__REAL_DEFINE_TEST(RX_NONFATAL, RX__OP_EQUAL, x1, x2, msg, \ | |
2241 _0, _1, _2, _3, _4, NULL, NULL, NULL) | |
2242 | |
2243 #define RX_REAL_CHECK_EQUAL_MSG_6(x1, x2, msg, \ | |
2244 _0, _1, _2, _3, _4, _5) \ | |
2245 RX__REAL_DEFINE_TEST(RX_NONFATAL, RX__OP_EQUAL, x1, x2, msg, \ | |
2246 _0, _1, _2, _3, _4, _5, NULL, NULL) | |
2247 | |
2248 #define RX_REAL_CHECK_EQUAL_MSG_7(x1, x2, msg, \ | |
2249 _0, _1, _2, _3, _4, _5, _6) \ | |
2250 RX__REAL_DEFINE_TEST(RX_NONFATAL, RX__OP_EQUAL, x1, x2, msg, \ | |
2251 _0, _1, _2, _3, _4, _5, _6, NULL) | |
2252 | |
2253 #define RX_REAL_CHECK_EQUAL_MSG_8(x1, x2, msg, \ | |
2254 _0, _1, _2, _3, _4, _5, _6, _7) \ | |
2255 RX__REAL_DEFINE_TEST(RX_NONFATAL, RX__OP_EQUAL, x1, x2, msg, \ | |
2256 _0, _1, _2, _3, _4, _5, _6, _7) | |
2257 | |
2258 #define RX_REAL_REQUIRE_NOT_EQUAL(x1, x2) \ | |
2259 RX_REAL_REQUIRE_NOT_EQUAL_MSG(x1, x2, NULL) | |
2260 | |
2261 #if RX__HAS_VARIADIC_MACROS | |
2262 #define RX_REAL_REQUIRE_NOT_EQUAL_MSG(x1, x2, ...) \ | |
2263 RX__REAL_DEFINE_TEST(RX_FATAL, RX__OP_NOT_EQUAL, x1, x2, __VA_ARGS__) | |
2264 #else | |
2265 #define RX_REAL_REQUIRE_NOT_EQUAL_MSG(x1, x2, msg) \ | |
2266 RX__REAL_DEFINE_TEST(RX_FATAL, RX__OP_NOT_EQUAL, x1, x2, msg, \ | |
2267 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) | |
2268 #endif | |
2269 | |
2270 #define RX_REAL_REQUIRE_NOT_EQUAL_MSG_1(x1, x2, msg, \ | |
2271 _0) \ | |
2272 RX__REAL_DEFINE_TEST(RX_FATAL, RX__OP_NOT_EQUAL, x1, x2, msg, \ | |
2273 _0, NULL, NULL, NULL, NULL, NULL, NULL, NULL) | |
2274 | |
2275 #define RX_REAL_REQUIRE_NOT_EQUAL_MSG_2(x1, x2, msg, \ | |
2276 _0, _1) \ | |
2277 RX__REAL_DEFINE_TEST(RX_FATAL, RX__OP_NOT_EQUAL, x1, x2, msg, \ | |
2278 _0, _1, NULL, NULL, NULL, NULL, NULL, NULL) | |
2279 | |
2280 #define RX_REAL_REQUIRE_NOT_EQUAL_MSG_3(x1, x2, msg, \ | |
2281 _0, _1, _2) \ | |
2282 RX__REAL_DEFINE_TEST(RX_FATAL, RX__OP_NOT_EQUAL, x1, x2, msg, \ | |
2283 _0, _1, _2, NULL, NULL, NULL, NULL, NULL) | |
2284 | |
2285 #define RX_REAL_REQUIRE_NOT_EQUAL_MSG_4(x1, x2, msg, \ | |
2286 _0, _1, _2, _3) \ | |
2287 RX__REAL_DEFINE_TEST(RX_FATAL, RX__OP_NOT_EQUAL, x1, x2, msg, \ | |
2288 _0, _1, _2, _3, NULL, NULL, NULL, NULL) | |
2289 | |
2290 #define RX_REAL_REQUIRE_NOT_EQUAL_MSG_5(x1, x2, msg, \ | |
2291 _0, _1, _2, _3, _4) \ | |
2292 RX__REAL_DEFINE_TEST(RX_FATAL, RX__OP_NOT_EQUAL, x1, x2, msg, \ | |
2293 _0, _1, _2, _3, _4, NULL, NULL, NULL) | |
2294 | |
2295 #define RX_REAL_REQUIRE_NOT_EQUAL_MSG_6(x1, x2, msg, \ | |
2296 _0, _1, _2, _3, _4, _5) \ | |
2297 RX__REAL_DEFINE_TEST(RX_FATAL, RX__OP_NOT_EQUAL, x1, x2, msg, \ | |
2298 _0, _1, _2, _3, _4, _5, NULL, NULL) | |
2299 | |
2300 #define RX_REAL_REQUIRE_NOT_EQUAL_MSG_7(x1, x2, msg, \ | |
2301 _0, _1, _2, _3, _4, _5, _6) \ | |
2302 RX__REAL_DEFINE_TEST(RX_FATAL, RX__OP_NOT_EQUAL, x1, x2, msg, \ | |
2303 _0, _1, _2, _3, _4, _5, _6, NULL) | |
2304 | |
2305 #define RX_REAL_REQUIRE_NOT_EQUAL_MSG_8(x1, x2, msg, \ | |
2306 _0, _1, _2, _3, _4, _5, _6, _7) \ | |
2307 RX__REAL_DEFINE_TEST(RX_FATAL, RX__OP_NOT_EQUAL, x1, x2, msg, \ | |
2308 _0, _1, _2, _3, _4, _5, _6, _7) | |
2309 | |
2310 #define RX_REAL_CHECK_NOT_EQUAL(x1, x2) \ | |
2311 RX_REAL_CHECK_NOT_EQUAL_MSG(x1, x2, NULL) | |
2312 | |
2313 #if RX__HAS_VARIADIC_MACROS | |
2314 #define RX_REAL_CHECK_NOT_EQUAL_MSG(x1, x2, ...) \ | |
2315 RX__REAL_DEFINE_TEST(RX_NONFATAL, RX__OP_NOT_EQUAL, x1, x2, __VA_ARGS__) | |
2316 #else | |
2317 #define RX_REAL_CHECK_NOT_EQUAL_MSG(x1, x2, msg) \ | |
2318 RX__REAL_DEFINE_TEST(RX_NONFATAL, RX__OP_NOT_EQUAL, x1, x2, msg, \ | |
2319 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) | |
2320 #endif | |
2321 | |
2322 #define RX_REAL_CHECK_NOT_EQUAL_MSG_1(x1, x2, msg, \ | |
2323 _0) \ | |
2324 RX__REAL_DEFINE_TEST(RX_NONFATAL, RX__OP_NOT_EQUAL, x1, x2, msg, \ | |
2325 _0, NULL, NULL, NULL, NULL, NULL, NULL, NULL) | |
2326 | |
2327 #define RX_REAL_CHECK_NOT_EQUAL_MSG_2(x1, x2, msg, \ | |
2328 _0, _1) \ | |
2329 RX__REAL_DEFINE_TEST(RX_NONFATAL, RX__OP_NOT_EQUAL, x1, x2, msg, \ | |
2330 _0, _1, NULL, NULL, NULL, NULL, NULL, NULL) | |
2331 | |
2332 #define RX_REAL_CHECK_NOT_EQUAL_MSG_3(x1, x2, msg, \ | |
2333 _0, _1, _2) \ | |
2334 RX__REAL_DEFINE_TEST(RX_NONFATAL, RX__OP_NOT_EQUAL, x1, x2, msg, \ | |
2335 _0, _1, _2, NULL, NULL, NULL, NULL, NULL) | |
2336 | |
2337 #define RX_REAL_CHECK_NOT_EQUAL_MSG_4(x1, x2, msg, \ | |
2338 _0, _1, _2, _3) \ | |
2339 RX__REAL_DEFINE_TEST(RX_NONFATAL, RX__OP_NOT_EQUAL, x1, x2, msg, \ | |
2340 _0, _1, _2, _3, NULL, NULL, NULL, NULL) | |
2341 | |
2342 #define RX_REAL_CHECK_NOT_EQUAL_MSG_5(x1, x2, msg, \ | |
2343 _0, _1, _2, _3, _4) \ | |
2344 RX__REAL_DEFINE_TEST(RX_NONFATAL, RX__OP_NOT_EQUAL, x1, x2, msg, \ | |
2345 _0, _1, _2, _3, _4, NULL, NULL, NULL) | |
2346 | |
2347 #define RX_REAL_CHECK_NOT_EQUAL_MSG_6(x1, x2, msg, \ | |
2348 _0, _1, _2, _3, _4, _5) \ | |
2349 RX__REAL_DEFINE_TEST(RX_NONFATAL, RX__OP_NOT_EQUAL, x1, x2, msg, \ | |
2350 _0, _1, _2, _3, _4, _5, NULL, NULL) | |
2351 | |
2352 #define RX_REAL_CHECK_NOT_EQUAL_MSG_7(x1, x2, msg, \ | |
2353 _0, _1, _2, _3, _4, _5, _6) \ | |
2354 RX__REAL_DEFINE_TEST(RX_NONFATAL, RX__OP_NOT_EQUAL, x1, x2, msg, \ | |
2355 _0, _1, _2, _3, _4, _5, _6, NULL) | |
2356 | |
2357 #define RX_REAL_CHECK_NOT_EQUAL_MSG_8(x1, x2, msg, \ | |
2358 _0, _1, _2, _3, _4, _5, _6, _7) \ | |
2359 RX__REAL_DEFINE_TEST(RX_NONFATAL, RX__OP_NOT_EQUAL, x1, x2, msg, \ | |
2360 _0, _1, _2, _3, _4, _5, _6, _7) | |
2361 | |
2362 #define RX_REAL_REQUIRE_GREATER(x1, x2) \ | |
2363 RX_REAL_REQUIRE_GREATER_MSG(x1, x2, NULL) | |
2364 | |
2365 #if RX__HAS_VARIADIC_MACROS | |
2366 #define RX_REAL_REQUIRE_GREATER_MSG(x1, x2, ...) \ | |
2367 RX__REAL_DEFINE_TEST(RX_FATAL, RX__OP_GREATER, x1, x2, __VA_ARGS__) | |
2368 #else | |
2369 #define RX_REAL_REQUIRE_GREATER_MSG(x1, x2, msg) \ | |
2370 RX__REAL_DEFINE_TEST(RX_FATAL, RX__OP_GREATER, x1, x2, msg, \ | |
2371 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) | |
2372 #endif | |
2373 | |
2374 #define RX_REAL_REQUIRE_GREATER_MSG_1(x1, x2, msg, \ | |
2375 _0) \ | |
2376 RX__REAL_DEFINE_TEST(RX_FATAL, RX__OP_GREATER, x1, x2, msg, \ | |
2377 _0, NULL, NULL, NULL, NULL, NULL, NULL, NULL) | |
2378 | |
2379 #define RX_REAL_REQUIRE_GREATER_MSG_2(x1, x2, msg, \ | |
2380 _0, _1) \ | |
2381 RX__REAL_DEFINE_TEST(RX_FATAL, RX__OP_GREATER, x1, x2, msg, \ | |
2382 _0, _1, NULL, NULL, NULL, NULL, NULL, NULL) | |
2383 | |
2384 #define RX_REAL_REQUIRE_GREATER_MSG_3(x1, x2, msg, \ | |
2385 _0, _1, _2) \ | |
2386 RX__REAL_DEFINE_TEST(RX_FATAL, RX__OP_GREATER, x1, x2, msg, \ | |
2387 _0, _1, _2, NULL, NULL, NULL, NULL, NULL) | |
2388 | |
2389 #define RX_REAL_REQUIRE_GREATER_MSG_4(x1, x2, msg, \ | |
2390 _0, _1, _2, _3) \ | |
2391 RX__REAL_DEFINE_TEST(RX_FATAL, RX__OP_GREATER, x1, x2, msg, \ | |
2392 _0, _1, _2, _3, NULL, NULL, NULL, NULL) | |
2393 | |
2394 #define RX_REAL_REQUIRE_GREATER_MSG_5(x1, x2, msg, \ | |
2395 _0, _1, _2, _3, _4) \ | |
2396 RX__REAL_DEFINE_TEST(RX_FATAL, RX__OP_GREATER, x1, x2, msg, \ | |
2397 _0, _1, _2, _3, _4, NULL, NULL, NULL) | |
2398 | |
2399 #define RX_REAL_REQUIRE_GREATER_MSG_6(x1, x2, msg, \ | |
2400 _0, _1, _2, _3, _4, _5) \ | |
2401 RX__REAL_DEFINE_TEST(RX_FATAL, RX__OP_GREATER, x1, x2, msg, \ | |
2402 _0, _1, _2, _3, _4, _5, NULL, NULL) | |
2403 | |
2404 #define RX_REAL_REQUIRE_GREATER_MSG_7(x1, x2, msg, \ | |
2405 _0, _1, _2, _3, _4, _5, _6) \ | |
2406 RX__REAL_DEFINE_TEST(RX_FATAL, RX__OP_GREATER, x1, x2, msg, \ | |
2407 _0, _1, _2, _3, _4, _5, _6, NULL) | |
2408 | |
2409 #define RX_REAL_REQUIRE_GREATER_MSG_8(x1, x2, msg, \ | |
2410 _0, _1, _2, _3, _4, _5, _6, _7) \ | |
2411 RX__REAL_DEFINE_TEST(RX_FATAL, RX__OP_GREATER, x1, x2, msg, \ | |
2412 _0, _1, _2, _3, _4, _5, _6, _7) | |
2413 | |
2414 #define RX_REAL_CHECK_GREATER(x1, x2) \ | |
2415 RX_REAL_CHECK_GREATER_MSG(x1, x2, NULL) | |
2416 | |
2417 #if RX__HAS_VARIADIC_MACROS | |
2418 #define RX_REAL_CHECK_GREATER_MSG(x1, x2, ...) \ | |
2419 RX__REAL_DEFINE_TEST(RX_NONFATAL, RX__OP_GREATER, x1, x2, __VA_ARGS__) | |
2420 #else | |
2421 #define RX_REAL_CHECK_GREATER_MSG(x1, x2, msg) \ | |
2422 RX__REAL_DEFINE_TEST(RX_NONFATAL, RX__OP_GREATER, x1, x2, msg, \ | |
2423 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) | |
2424 #endif | |
2425 | |
2426 #define RX_REAL_CHECK_GREATER_MSG_1(x1, x2, msg, \ | |
2427 _0) \ | |
2428 RX__REAL_DEFINE_TEST(RX_NONFATAL, RX__OP_GREATER, x1, x2, msg, \ | |
2429 _0, NULL, NULL, NULL, NULL, NULL, NULL, NULL) | |
2430 | |
2431 #define RX_REAL_CHECK_GREATER_MSG_2(x1, x2, msg, \ | |
2432 _0, _1) \ | |
2433 RX__REAL_DEFINE_TEST(RX_NONFATAL, RX__OP_GREATER, x1, x2, msg, \ | |
2434 _0, _1, NULL, NULL, NULL, NULL, NULL, NULL) | |
2435 | |
2436 #define RX_REAL_CHECK_GREATER_MSG_3(x1, x2, msg, \ | |
2437 _0, _1, _2) \ | |
2438 RX__REAL_DEFINE_TEST(RX_NONFATAL, RX__OP_GREATER, x1, x2, msg, \ | |
2439 _0, _1, _2, NULL, NULL, NULL, NULL, NULL) | |
2440 | |
2441 #define RX_REAL_CHECK_GREATER_MSG_4(x1, x2, msg, \ | |
2442 _0, _1, _2, _3) \ | |
2443 RX__REAL_DEFINE_TEST(RX_NONFATAL, RX__OP_GREATER, x1, x2, msg, \ | |
2444 _0, _1, _2, _3, NULL, NULL, NULL, NULL) | |
2445 | |
2446 #define RX_REAL_CHECK_GREATER_MSG_5(x1, x2, msg, \ | |
2447 _0, _1, _2, _3, _4) \ | |
2448 RX__REAL_DEFINE_TEST(RX_NONFATAL, RX__OP_GREATER, x1, x2, msg, \ | |
2449 _0, _1, _2, _3, _4, NULL, NULL, NULL) | |
2450 | |
2451 #define RX_REAL_CHECK_GREATER_MSG_6(x1, x2, msg, \ | |
2452 _0, _1, _2, _3, _4, _5) \ | |
2453 RX__REAL_DEFINE_TEST(RX_NONFATAL, RX__OP_GREATER, x1, x2, msg, \ | |
2454 _0, _1, _2, _3, _4, _5, NULL, NULL) | |
2455 | |
2456 #define RX_REAL_CHECK_GREATER_MSG_7(x1, x2, msg, \ | |
2457 _0, _1, _2, _3, _4, _5, _6) \ | |
2458 RX__REAL_DEFINE_TEST(RX_NONFATAL, RX__OP_GREATER, x1, x2, msg, \ | |
2459 _0, _1, _2, _3, _4, _5, _6, NULL) | |
2460 | |
2461 #define RX_REAL_CHECK_GREATER_MSG_8(x1, x2, msg, \ | |
2462 _0, _1, _2, _3, _4, _5, _6, _7) \ | |
2463 RX__REAL_DEFINE_TEST(RX_NONFATAL, RX__OP_GREATER, x1, x2, msg, \ | |
2464 _0, _1, _2, _3, _4, _5, _6, _7) | |
2465 | |
2466 #define RX_REAL_REQUIRE_LESSER(x1, x2) \ | |
2467 RX_REAL_REQUIRE_LESSER_MSG(x1, x2, NULL) | |
2468 | |
2469 #if RX__HAS_VARIADIC_MACROS | |
2470 #define RX_REAL_REQUIRE_LESSER_MSG(x1, x2, ...) \ | |
2471 RX__REAL_DEFINE_TEST(RX_FATAL, RX__OP_LESSER, x1, x2, __VA_ARGS__) | |
2472 #else | |
2473 #define RX_REAL_REQUIRE_LESSER_MSG(x1, x2, msg) \ | |
2474 RX__REAL_DEFINE_TEST(RX_FATAL, RX__OP_LESSER, x1, x2, msg, \ | |
2475 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) | |
2476 #endif | |
2477 | |
2478 #define RX_REAL_REQUIRE_LESSER_MSG_1(x1, x2, msg, \ | |
2479 _0) \ | |
2480 RX__REAL_DEFINE_TEST(RX_FATAL, RX__OP_LESSER, x1, x2, msg, \ | |
2481 _0, NULL, NULL, NULL, NULL, NULL, NULL, NULL) | |
2482 | |
2483 #define RX_REAL_REQUIRE_LESSER_MSG_2(x1, x2, msg, \ | |
2484 _0, _1) \ | |
2485 RX__REAL_DEFINE_TEST(RX_FATAL, RX__OP_LESSER, x1, x2, msg, \ | |
2486 _0, _1, NULL, NULL, NULL, NULL, NULL, NULL) | |
2487 | |
2488 #define RX_REAL_REQUIRE_LESSER_MSG_3(x1, x2, msg, \ | |
2489 _0, _1, _2) \ | |
2490 RX__REAL_DEFINE_TEST(RX_FATAL, RX__OP_LESSER, x1, x2, msg, \ | |
2491 _0, _1, _2, NULL, NULL, NULL, NULL, NULL) | |
2492 | |
2493 #define RX_REAL_REQUIRE_LESSER_MSG_4(x1, x2, msg, \ | |
2494 _0, _1, _2, _3) \ | |
2495 RX__REAL_DEFINE_TEST(RX_FATAL, RX__OP_LESSER, x1, x2, msg, \ | |
2496 _0, _1, _2, _3, NULL, NULL, NULL, NULL) | |
2497 | |
2498 #define RX_REAL_REQUIRE_LESSER_MSG_5(x1, x2, msg, \ | |
2499 _0, _1, _2, _3, _4) \ | |
2500 RX__REAL_DEFINE_TEST(RX_FATAL, RX__OP_LESSER, x1, x2, msg, \ | |
2501 _0, _1, _2, _3, _4, NULL, NULL, NULL) | |
2502 | |
2503 #define RX_REAL_REQUIRE_LESSER_MSG_6(x1, x2, msg, \ | |
2504 _0, _1, _2, _3, _4, _5) \ | |
2505 RX__REAL_DEFINE_TEST(RX_FATAL, RX__OP_LESSER, x1, x2, msg, \ | |
2506 _0, _1, _2, _3, _4, _5, NULL, NULL) | |
2507 | |
2508 #define RX_REAL_REQUIRE_LESSER_MSG_7(x1, x2, msg, \ | |
2509 _0, _1, _2, _3, _4, _5, _6) \ | |
2510 RX__REAL_DEFINE_TEST(RX_FATAL, RX__OP_LESSER, x1, x2, msg, \ | |
2511 _0, _1, _2, _3, _4, _5, _6, NULL) | |
2512 | |
2513 #define RX_REAL_REQUIRE_LESSER_MSG_8(x1, x2, msg, \ | |
2514 _0, _1, _2, _3, _4, _5, _6, _7) \ | |
2515 RX__REAL_DEFINE_TEST(RX_FATAL, RX__OP_LESSER, x1, x2, msg, \ | |
2516 _0, _1, _2, _3, _4, _5, _6, _7) | |
2517 | |
2518 #define RX_REAL_CHECK_LESSER(x1, x2) \ | |
2519 RX_REAL_CHECK_LESSER_MSG(x1, x2, NULL) | |
2520 | |
2521 #if RX__HAS_VARIADIC_MACROS | |
2522 #define RX_REAL_CHECK_LESSER_MSG(x1, x2, ...) \ | |
2523 RX__REAL_DEFINE_TEST(RX_NONFATAL, RX__OP_LESSER, x1, x2, __VA_ARGS__) | |
2524 #else | |
2525 #define RX_REAL_CHECK_LESSER_MSG(x1, x2, msg) \ | |
2526 RX__REAL_DEFINE_TEST(RX_NONFATAL, RX__OP_LESSER, x1, x2, msg, \ | |
2527 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) | |
2528 #endif | |
2529 | |
2530 #define RX_REAL_CHECK_LESSER_MSG_1(x1, x2, msg, \ | |
2531 _0) \ | |
2532 RX__REAL_DEFINE_TEST(RX_NONFATAL, RX__OP_LESSER, x1, x2, msg, \ | |
2533 _0, NULL, NULL, NULL, NULL, NULL, NULL, NULL) | |
2534 | |
2535 #define RX_REAL_CHECK_LESSER_MSG_2(x1, x2, msg, \ | |
2536 _0, _1) \ | |
2537 RX__REAL_DEFINE_TEST(RX_NONFATAL, RX__OP_LESSER, x1, x2, msg, \ | |
2538 _0, _1, NULL, NULL, NULL, NULL, NULL, NULL) | |
2539 | |
2540 #define RX_REAL_CHECK_LESSER_MSG_3(x1, x2, msg, \ | |
2541 _0, _1, _2) \ | |
2542 RX__REAL_DEFINE_TEST(RX_NONFATAL, RX__OP_LESSER, x1, x2, msg, \ | |
2543 _0, _1, _2, NULL, NULL, NULL, NULL, NULL) | |
2544 | |
2545 #define RX_REAL_CHECK_LESSER_MSG_4(x1, x2, msg, \ | |
2546 _0, _1, _2, _3) \ | |
2547 RX__REAL_DEFINE_TEST(RX_NONFATAL, RX__OP_LESSER, x1, x2, msg, \ | |
2548 _0, _1, _2, _3, NULL, NULL, NULL, NULL) | |
2549 | |
2550 #define RX_REAL_CHECK_LESSER_MSG_5(x1, x2, msg, \ | |
2551 _0, _1, _2, _3, _4) \ | |
2552 RX__REAL_DEFINE_TEST(RX_NONFATAL, RX__OP_LESSER, x1, x2, msg, \ | |
2553 _0, _1, _2, _3, _4, NULL, NULL, NULL) | |
2554 | |
2555 #define RX_REAL_CHECK_LESSER_MSG_6(x1, x2, msg, \ | |
2556 _0, _1, _2, _3, _4, _5) \ | |
2557 RX__REAL_DEFINE_TEST(RX_NONFATAL, RX__OP_LESSER, x1, x2, msg, \ | |
2558 _0, _1, _2, _3, _4, _5, NULL, NULL) | |
2559 | |
2560 #define RX_REAL_CHECK_LESSER_MSG_7(x1, x2, msg, \ | |
2561 _0, _1, _2, _3, _4, _5, _6) \ | |
2562 RX__REAL_DEFINE_TEST(RX_NONFATAL, RX__OP_LESSER, x1, x2, msg, \ | |
2563 _0, _1, _2, _3, _4, _5, _6, NULL) | |
2564 | |
2565 #define RX_REAL_CHECK_LESSER_MSG_8(x1, x2, msg, \ | |
2566 _0, _1, _2, _3, _4, _5, _6, _7) \ | |
2567 RX__REAL_DEFINE_TEST(RX_NONFATAL, RX__OP_LESSER, x1, x2, msg, \ | |
2568 _0, _1, _2, _3, _4, _5, _6, _7) | |
2569 | |
2570 #define RX_REAL_REQUIRE_GREATER_OR_EQUAL(x1, x2) \ | |
2571 RX_REAL_REQUIRE_GREATER_OR_EQUAL_MSG(x1, x2, NULL) | |
2572 | |
2573 #if RX__HAS_VARIADIC_MACROS | |
2574 #define RX_REAL_REQUIRE_GREATER_OR_EQUAL_MSG(x1, x2, ...) \ | |
2575 RX__REAL_DEFINE_TEST(RX_FATAL, RX__OP_GREATER_OR_EQUAL, x1, x2, \ | |
2576 __VA_ARGS__) | |
2577 #else | |
2578 #define RX_REAL_REQUIRE_GREATER_OR_EQUAL_MSG(x1, x2, msg) \ | |
2579 RX__REAL_DEFINE_TEST(RX_FATAL, RX__OP_GREATER_OR_EQUAL, x1, x2, msg, \ | |
2580 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) | |
2581 #endif | |
2582 | |
2583 #define RX_REAL_REQUIRE_GREATER_OR_EQUAL_MSG_1(x1, x2, msg, \ | |
2584 _0) \ | |
2585 RX__REAL_DEFINE_TEST(RX_FATAL, RX__OP_GREATER_OR_EQUAL, x1, x2, msg, \ | |
2586 _0, NULL, NULL, NULL, NULL, NULL, NULL, NULL) | |
2587 | |
2588 #define RX_REAL_REQUIRE_GREATER_OR_EQUAL_MSG_2(x1, x2, msg, \ | |
2589 _0, _1) \ | |
2590 RX__REAL_DEFINE_TEST(RX_FATAL, RX__OP_GREATER_OR_EQUAL, x1, x2, msg, \ | |
2591 _0, _1, NULL, NULL, NULL, NULL, NULL, NULL) | |
2592 | |
2593 #define RX_REAL_REQUIRE_GREATER_OR_EQUAL_MSG_3(x1, x2, msg, \ | |
2594 _0, _1, _2) \ | |
2595 RX__REAL_DEFINE_TEST(RX_FATAL, RX__OP_GREATER_OR_EQUAL, x1, x2, msg, \ | |
2596 _0, _1, _2, NULL, NULL, NULL, NULL, NULL) | |
2597 | |
2598 #define RX_REAL_REQUIRE_GREATER_OR_EQUAL_MSG_4(x1, x2, msg, \ | |
2599 _0, _1, _2, _3) \ | |
2600 RX__REAL_DEFINE_TEST(RX_FATAL, RX__OP_GREATER_OR_EQUAL, x1, x2, msg, \ | |
2601 _0, _1, _2, _3, NULL, NULL, NULL, NULL) | |
2602 | |
2603 #define RX_REAL_REQUIRE_GREATER_OR_EQUAL_MSG_5(x1, x2, msg, \ | |
2604 _0, _1, _2, _3, _4) \ | |
2605 RX__REAL_DEFINE_TEST(RX_FATAL, RX__OP_GREATER_OR_EQUAL, x1, x2, msg, \ | |
2606 _0, _1, _2, _3, _4, NULL, NULL, NULL) | |
2607 | |
2608 #define RX_REAL_REQUIRE_GREATER_OR_EQUAL_MSG_6(x1, x2, msg, \ | |
2609 _0, _1, _2, _3, _4, _5) \ | |
2610 RX__REAL_DEFINE_TEST(RX_FATAL, RX__OP_GREATER_OR_EQUAL, x1, x2, msg, \ | |
2611 _0, _1, _2, _3, _4, _5, NULL, NULL) | |
2612 | |
2613 #define RX_REAL_REQUIRE_GREATER_OR_EQUAL_MSG_7(x1, x2, msg, \ | |
2614 _0, _1, _2, _3, _4, _5, _6) \ | |
2615 RX__REAL_DEFINE_TEST(RX_FATAL, RX__OP_GREATER_OR_EQUAL, x1, x2, msg, \ | |
2616 _0, _1, _2, _3, _4, _5, _6, NULL) | |
2617 | |
2618 #define RX_REAL_REQUIRE_GREATER_OR_EQUAL_MSG_8(x1, x2, msg, \ | |
2619 _0, _1, _2, _3, _4, _5, _6, _7) \ | |
2620 RX__REAL_DEFINE_TEST(RX_FATAL, RX__OP_GREATER_OR_EQUAL, x1, x2, msg, \ | |
2621 _0, _1, _2, _3, _4, _5, _6, _7) | |
2622 | |
2623 #define RX_REAL_CHECK_GREATER_OR_EQUAL(x1, x2) \ | |
2624 RX_REAL_CHECK_GREATER_OR_EQUAL_MSG(x1, x2, NULL) | |
2625 | |
2626 #if RX__HAS_VARIADIC_MACROS | |
2627 #define RX_REAL_CHECK_GREATER_OR_EQUAL_MSG(x1, x2, ...) \ | |
2628 RX__REAL_DEFINE_TEST(RX_NONFATAL, RX__OP_GREATER_OR_EQUAL, x1, x2, \ | |
2629 __VA_ARGS__) | |
2630 #else | |
2631 #define RX_REAL_CHECK_GREATER_OR_EQUAL_MSG(x1, x2, msg) \ | |
2632 RX__REAL_DEFINE_TEST(RX_NONFATAL, RX__OP_GREATER_OR_EQUAL, x1, x2, msg,\ | |
2633 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) | |
2634 #endif | |
2635 | |
2636 #define RX_REAL_CHECK_GREATER_OR_EQUAL_MSG_1(x1, x2, msg, \ | |
2637 _0) \ | |
2638 RX__REAL_DEFINE_TEST(RX_NONFATAL, RX__OP_GREATER_OR_EQUAL, x1, x2, msg, \ | |
2639 _0, NULL, NULL, NULL, NULL, NULL, NULL, NULL) | |
2640 | |
2641 #define RX_REAL_CHECK_GREATER_OR_EQUAL_MSG_2(x1, x2, msg, \ | |
2642 _0, _1) \ | |
2643 RX__REAL_DEFINE_TEST(RX_NONFATAL, RX__OP_GREATER_OR_EQUAL, x1, x2, msg, \ | |
2644 _0, _1, NULL, NULL, NULL, NULL, NULL, NULL) | |
2645 | |
2646 #define RX_REAL_CHECK_GREATER_OR_EQUAL_MSG_3(x1, x2, msg, \ | |
2647 _0, _1, _2) \ | |
2648 RX__REAL_DEFINE_TEST(RX_NONFATAL, RX__OP_GREATER_OR_EQUAL, x1, x2, msg, \ | |
2649 _0, _1, _2, NULL, NULL, NULL, NULL, NULL) | |
2650 | |
2651 #define RX_REAL_CHECK_GREATER_OR_EQUAL_MSG_4(x1, x2, msg, \ | |
2652 _0, _1, _2, _3) \ | |
2653 RX__REAL_DEFINE_TEST(RX_NONFATAL, RX__OP_GREATER_OR_EQUAL, x1, x2, msg, \ | |
2654 _0, _1, _2, _3, NULL, NULL, NULL, NULL) | |
2655 | |
2656 #define RX_REAL_CHECK_GREATER_OR_EQUAL_MSG_5(x1, x2, msg, \ | |
2657 _0, _1, _2, _3, _4) \ | |
2658 RX__REAL_DEFINE_TEST(RX_NONFATAL, RX__OP_GREATER_OR_EQUAL, x1, x2, msg, \ | |
2659 _0, _1, _2, _3, _4, NULL, NULL, NULL) | |
2660 | |
2661 #define RX_REAL_CHECK_GREATER_OR_EQUAL_MSG_6(x1, x2, msg, \ | |
2662 _0, _1, _2, _3, _4, _5) \ | |
2663 RX__REAL_DEFINE_TEST(RX_NONFATAL, RX__OP_GREATER_OR_EQUAL, x1, x2, msg, \ | |
2664 _0, _1, _2, _3, _4, _5, NULL, NULL) | |
2665 | |
2666 #define RX_REAL_CHECK_GREATER_OR_EQUAL_MSG_7(x1, x2, msg, \ | |
2667 _0, _1, _2, _3, _4, _5, _6) \ | |
2668 RX__REAL_DEFINE_TEST(RX_NONFATAL, RX__OP_GREATER_OR_EQUAL, x1, x2, msg, \ | |
2669 _0, _1, _2, _3, _4, _5, _6, NULL) | |
2670 | |
2671 #define RX_REAL_CHECK_GREATER_OR_EQUAL_MSG_8(x1, x2, msg, \ | |
2672 _0, _1, _2, _3, _4, _5, _6, _7) \ | |
2673 RX__REAL_DEFINE_TEST(RX_NONFATAL, RX__OP_GREATER_OR_EQUAL, x1, x2, msg, \ | |
2674 _0, _1, _2, _3, _4, _5, _6, _7) | |
2675 | |
2676 #define RX_REAL_REQUIRE_LESSER_OR_EQUAL(x1, x2) \ | |
2677 RX_REAL_REQUIRE_LESSER_OR_EQUAL_MSG(x1, x2, NULL) | |
2678 | |
2679 #if RX__HAS_VARIADIC_MACROS | |
2680 #define RX_REAL_REQUIRE_LESSER_OR_EQUAL_MSG(x1, x2, ...) \ | |
2681 RX__REAL_DEFINE_TEST(RX_FATAL, RX__OP_LESSER_OR_EQUAL, x1, x2, \ | |
2682 __VA_ARGS__) | |
2683 #else | |
2684 #define RX_REAL_REQUIRE_LESSER_OR_EQUAL_MSG(x1, x2, msg) \ | |
2685 RX__REAL_DEFINE_TEST(RX_FATAL, RX__OP_LESSER_OR_EQUAL, x1, x2, msg, \ | |
2686 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) | |
2687 #endif | |
2688 | |
2689 #define RX_REAL_REQUIRE_LESSER_OR_EQUAL_MSG_1(x1, x2, msg, \ | |
2690 _0) \ | |
2691 RX__REAL_DEFINE_TEST(RX_FATAL, RX__OP_LESSER_OR_EQUAL, x1, x2, msg, \ | |
2692 _0, NULL, NULL, NULL, NULL, NULL, NULL, NULL) | |
2693 | |
2694 #define RX_REAL_REQUIRE_LESSER_OR_EQUAL_MSG_2(x1, x2, msg, \ | |
2695 _0, _1) \ | |
2696 RX__REAL_DEFINE_TEST(RX_FATAL, RX__OP_LESSER_OR_EQUAL, x1, x2, msg, \ | |
2697 _0, _1, NULL, NULL, NULL, NULL, NULL, NULL) | |
2698 | |
2699 #define RX_REAL_REQUIRE_LESSER_OR_EQUAL_MSG_3(x1, x2, msg, \ | |
2700 _0, _1, _2) \ | |
2701 RX__REAL_DEFINE_TEST(RX_FATAL, RX__OP_LESSER_OR_EQUAL, x1, x2, msg, \ | |
2702 _0, _1, _2, NULL, NULL, NULL, NULL, NULL) | |
2703 | |
2704 #define RX_REAL_REQUIRE_LESSER_OR_EQUAL_MSG_4(x1, x2, msg, \ | |
2705 _0, _1, _2, _3) \ | |
2706 RX__REAL_DEFINE_TEST(RX_FATAL, RX__OP_LESSER_OR_EQUAL, x1, x2, msg, \ | |
2707 _0, _1, _2, _3, NULL, NULL, NULL, NULL) | |
2708 | |
2709 #define RX_REAL_REQUIRE_LESSER_OR_EQUAL_MSG_5(x1, x2, msg, \ | |
2710 _0, _1, _2, _3, _4) \ | |
2711 RX__REAL_DEFINE_TEST(RX_FATAL, RX__OP_LESSER_OR_EQUAL, x1, x2, msg, \ | |
2712 _0, _1, _2, _3, _4, NULL, NULL, NULL) | |
2713 | |
2714 #define RX_REAL_REQUIRE_LESSER_OR_EQUAL_MSG_6(x1, x2, msg, \ | |
2715 _0, _1, _2, _3, _4, _5) \ | |
2716 RX__REAL_DEFINE_TEST(RX_FATAL, RX__OP_LESSER_OR_EQUAL, x1, x2, msg, \ | |
2717 _0, _1, _2, _3, _4, _5, NULL, NULL) | |
2718 | |
2719 #define RX_REAL_REQUIRE_LESSER_OR_EQUAL_MSG_7(x1, x2, msg, \ | |
2720 _0, _1, _2, _3, _4, _5, _6) \ | |
2721 RX__REAL_DEFINE_TEST(RX_FATAL, RX__OP_LESSER_OR_EQUAL, x1, x2, msg, \ | |
2722 _0, _1, _2, _3, _4, _5, _6, NULL) | |
2723 | |
2724 #define RX_REAL_REQUIRE_LESSER_OR_EQUAL_MSG_8(x1, x2, msg, \ | |
2725 _0, _1, _2, _3, _4, _5, _6, _7) \ | |
2726 RX__REAL_DEFINE_TEST(RX_FATAL, RX__OP_LESSER_OR_EQUAL, x1, x2, msg, \ | |
2727 _0, _1, _2, _3, _4, _5, _6, _7) | |
2728 | |
2729 #define RX_REAL_CHECK_LESSER_OR_EQUAL(x1, x2) \ | |
2730 RX_REAL_CHECK_LESSER_OR_EQUAL_MSG(x1, x2, NULL) | |
2731 | |
2732 #if RX__HAS_VARIADIC_MACROS | |
2733 #define RX_REAL_CHECK_LESSER_OR_EQUAL_MSG(x1, x2, ...) \ | |
2734 RX__REAL_DEFINE_TEST(RX_NONFATAL, RX__OP_LESSER_OR_EQUAL, x1, x2, \ | |
2735 __VA_ARGS__) | |
2736 #else | |
2737 #define RX_REAL_CHECK_LESSER_OR_EQUAL_MSG(x1, x2, msg) \ | |
2738 RX__REAL_DEFINE_TEST(RX_NONFATAL, RX__OP_LESSER_OR_EQUAL, x1, x2, msg, \ | |
2739 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) | |
2740 #endif | |
2741 | |
2742 #define RX_REAL_CHECK_LESSER_OR_EQUAL_MSG_1(x1, x2, msg, \ | |
2743 _0) \ | |
2744 RX__REAL_DEFINE_TEST(RX_NONFATAL, RX__OP_LESSER_OR_EQUAL, x1, x2, msg, \ | |
2745 _0, NULL, NULL, NULL, NULL, NULL, NULL, NULL) | |
2746 | |
2747 #define RX_REAL_CHECK_LESSER_OR_EQUAL_MSG_2(x1, x2, msg, \ | |
2748 _0, _1) \ | |
2749 RX__REAL_DEFINE_TEST(RX_NONFATAL, RX__OP_LESSER_OR_EQUAL, x1, x2, msg, \ | |
2750 _0, _1, NULL, NULL, NULL, NULL, NULL, NULL) | |
2751 | |
2752 #define RX_REAL_CHECK_LESSER_OR_EQUAL_MSG_3(x1, x2, msg, \ | |
2753 _0, _1, _2) \ | |
2754 RX__REAL_DEFINE_TEST(RX_NONFATAL, RX__OP_LESSER_OR_EQUAL, x1, x2, msg, \ | |
2755 _0, _1, _2, NULL, NULL, NULL, NULL, NULL) | |
2756 | |
2757 #define RX_REAL_CHECK_LESSER_OR_EQUAL_MSG_4(x1, x2, msg, \ | |
2758 _0, _1, _2, _3) \ | |
2759 RX__REAL_DEFINE_TEST(RX_NONFATAL, RX__OP_LESSER_OR_EQUAL, x1, x2, msg, \ | |
2760 _0, _1, _2, _3, NULL, NULL, NULL, NULL) | |
2761 | |
2762 #define RX_REAL_CHECK_LESSER_OR_EQUAL_MSG_5(x1, x2, msg, \ | |
2763 _0, _1, _2, _3, _4) \ | |
2764 RX__REAL_DEFINE_TEST(RX_NONFATAL, RX__OP_LESSER_OR_EQUAL, x1, x2, msg, \ | |
2765 _0, _1, _2, _3, _4, NULL, NULL, NULL) | |
2766 | |
2767 #define RX_REAL_CHECK_LESSER_OR_EQUAL_MSG_6(x1, x2, msg, \ | |
2768 _0, _1, _2, _3, _4, _5) \ | |
2769 RX__REAL_DEFINE_TEST(RX_NONFATAL, RX__OP_LESSER_OR_EQUAL, x1, x2, msg, \ | |
2770 _0, _1, _2, _3, _4, _5, NULL, NULL) | |
2771 | |
2772 #define RX_REAL_CHECK_LESSER_OR_EQUAL_MSG_7(x1, x2, msg, \ | |
2773 _0, _1, _2, _3, _4, _5, _6) \ | |
2774 RX__REAL_DEFINE_TEST(RX_NONFATAL, RX__OP_LESSER_OR_EQUAL, x1, x2, msg, \ | |
2775 _0, _1, _2, _3, _4, _5, _6, NULL) | |
2776 | |
2777 #define RX_REAL_CHECK_LESSER_OR_EQUAL_MSG_8(x1, x2, msg, \ | |
2778 _0, _1, _2, _3, _4, _5, _6, _7) \ | |
2779 RX__REAL_DEFINE_TEST(RX_NONFATAL, RX__OP_LESSER_OR_EQUAL, x1, x2, msg, \ | |
2780 _0, _1, _2, _3, _4, _5, _6, _7) | |
2781 | |
2782 #if RX__HAS_VARIADIC_MACROS | |
2783 #define RX__REAL_DEFINE_FUZZY_TEST(severity, op, x1, x2, tol, ...) \ | |
2784 rx__real_assess_fuzzy_comparison(RX_PARAM_CONTEXT, \ | |
2785 (x1), \ | |
2786 (x2), \ | |
2787 (tol), \ | |
2788 op, \ | |
2789 #x1, \ | |
2790 #x2, \ | |
2791 __FILE__, \ | |
2792 __LINE__, \ | |
2793 severity, \ | |
2794 __VA_ARGS__) | |
2795 #else | |
2796 #define RX__REAL_DEFINE_FUZZY_TEST(severity, op, x1, x2, tol, msg, \ | |
2797 _0, _1, _2, _3, _4, _5, _6, _7) \ | |
2798 rx__real_assess_fuzzy_comparison(RX_PARAM_CONTEXT, \ | |
2799 (x1), \ | |
2800 (x2), \ | |
2801 (tol), \ | |
2802 op, \ | |
2803 #x1, \ | |
2804 #x2, \ | |
2805 __FILE__, \ | |
2806 __LINE__, \ | |
2807 severity, \ | |
2808 msg, \ | |
2809 _0, _1, _2, _3, _4, _5, _6, _7) | |
2810 #endif | |
2811 | |
2812 #define RX_REAL_REQUIRE_FUZZY_EQUAL(x1, x2, tol) \ | |
2813 RX_REAL_REQUIRE_FUZZY_EQUAL_MSG(x1, x2, tol, NULL) | |
2814 | |
2815 #if RX__HAS_VARIADIC_MACROS | |
2816 #define RX_REAL_REQUIRE_FUZZY_EQUAL_MSG(x1, x2, tol, ...) \ | |
2817 RX__REAL_DEFINE_FUZZY_TEST(RX_FATAL, RX__OP_EQUAL, x1, x2, tol, \ | |
2818 __VA_ARGS__) | |
2819 #else | |
2820 #define RX_REAL_REQUIRE_FUZZY_EQUAL_MSG(x1, x2, tol, msg) \ | |
2821 RX__REAL_DEFINE_FUZZY_TEST( \ | |
2822 RX_FATAL, RX__OP_EQUAL, x1, x2, tol, msg, \ | |
2823 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) | |
2824 #endif | |
2825 | |
2826 #define RX_REAL_REQUIRE_FUZZY_EQUAL_MSG_1(x1, x2, tol, msg, \ | |
2827 _0) \ | |
2828 RX__REAL_DEFINE_FUZZY_TEST(RX_FATAL, RX__OP_EQUAL, x1, x2, tol, msg, \ | |
2829 _0, NULL, NULL, NULL, NULL, NULL, NULL, NULL) | |
2830 | |
2831 #define RX_REAL_REQUIRE_FUZZY_EQUAL_MSG_2(x1, x2, tol, msg, \ | |
2832 _0, _1) \ | |
2833 RX__REAL_DEFINE_FUZZY_TEST(RX_FATAL, RX__OP_EQUAL, x1, x2, tol, msg, \ | |
2834 _0, _1, NULL, NULL, NULL, NULL, NULL, NULL) | |
2835 | |
2836 #define RX_REAL_REQUIRE_FUZZY_EQUAL_MSG_3(x1, x2, tol, msg, \ | |
2837 _0, _1, _2) \ | |
2838 RX__REAL_DEFINE_FUZZY_TEST(RX_FATAL, RX__OP_EQUAL, x1, x2, tol, msg, \ | |
2839 _0, _1, _2, NULL, NULL, NULL, NULL, NULL) | |
2840 | |
2841 #define RX_REAL_REQUIRE_FUZZY_EQUAL_MSG_4(x1, x2, tol, msg, \ | |
2842 _0, _1, _2, _3) \ | |
2843 RX__REAL_DEFINE_FUZZY_TEST(RX_FATAL, RX__OP_EQUAL, x1, x2, tol, msg, \ | |
2844 _0, _1, _2, _3, NULL, NULL, NULL, NULL) | |
2845 | |
2846 #define RX_REAL_REQUIRE_FUZZY_EQUAL_MSG_5(x1, x2, tol, msg, \ | |
2847 _0, _1, _2, _3, _4) \ | |
2848 RX__REAL_DEFINE_FUZZY_TEST(RX_FATAL, RX__OP_EQUAL, x1, x2, tol, msg, \ | |
2849 _0, _1, _2, _3, _4, NULL, NULL, NULL) | |
2850 | |
2851 #define RX_REAL_REQUIRE_FUZZY_EQUAL_MSG_6(x1, x2, tol, msg, \ | |
2852 _0, _1, _2, _3, _4, _5) \ | |
2853 RX__REAL_DEFINE_FUZZY_TEST(RX_FATAL, RX__OP_EQUAL, x1, x2, tol, msg, \ | |
2854 _0, _1, _2, _3, _4, _5, NULL, NULL) | |
2855 | |
2856 #define RX_REAL_REQUIRE_FUZZY_EQUAL_MSG_7(x1, x2, tol, msg, \ | |
2857 _0, _1, _2, _3, _4, _5, _6) \ | |
2858 RX__REAL_DEFINE_FUZZY_TEST(RX_FATAL, RX__OP_EQUAL, x1, x2, tol, msg, \ | |
2859 _0, _1, _2, _3, _4, _5, _6, NULL) | |
2860 | |
2861 #define RX_REAL_REQUIRE_FUZZY_EQUAL_MSG_8(x1, x2, tol, msg, \ | |
2862 _0, _1, _2, _3, _4, _5, _6, _7) \ | |
2863 RX__REAL_DEFINE_FUZZY_TEST(RX_FATAL, RX__OP_EQUAL, x1, x2, tol, msg, \ | |
2864 _0, _1, _2, _3, _4, _5, _6, _7) | |
2865 | |
2866 #define RX_REAL_CHECK_FUZZY_EQUAL(x1, x2, tol) \ | |
2867 RX_REAL_CHECK_FUZZY_EQUAL_MSG(x1, x2, tol, NULL) | |
2868 | |
2869 #if RX__HAS_VARIADIC_MACROS | |
2870 #define RX_REAL_CHECK_FUZZY_EQUAL_MSG(x1, x2, tol, ...) \ | |
2871 RX__REAL_DEFINE_FUZZY_TEST(RX_NONFATAL, RX__OP_EQUAL, x1, x2, tol, \ | |
2872 __VA_ARGS__) | |
2873 #else | |
2874 #define RX_REAL_CHECK_FUZZY_EQUAL_MSG(x1, x2, tol, msg) \ | |
2875 RX__REAL_DEFINE_FUZZY_TEST( \ | |
2876 RX_NONFATAL, RX__OP_EQUAL, x1, x2, tol, msg, \ | |
2877 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) | |
2878 #endif | |
2879 | |
2880 #define RX_REAL_CHECK_FUZZY_EQUAL_MSG_1(x1, x2, tol, msg, \ | |
2881 _0) \ | |
2882 RX__REAL_DEFINE_FUZZY_TEST(RX_NONFATAL, RX__OP_EQUAL, x1, x2, tol, msg, \ | |
2883 _0, NULL, NULL, NULL, NULL, NULL, NULL, NULL) | |
2884 | |
2885 #define RX_REAL_CHECK_FUZZY_EQUAL_MSG_2(x1, x2, tol, msg, \ | |
2886 _0, _1) \ | |
2887 RX__REAL_DEFINE_FUZZY_TEST(RX_NONFATAL, RX__OP_EQUAL, x1, x2, tol, msg, \ | |
2888 _0, _1, NULL, NULL, NULL, NULL, NULL, NULL) | |
2889 | |
2890 #define RX_REAL_CHECK_FUZZY_EQUAL_MSG_3(x1, x2, tol, msg, \ | |
2891 _0, _1, _2) \ | |
2892 RX__REAL_DEFINE_FUZZY_TEST(RX_NONFATAL, RX__OP_EQUAL, x1, x2, tol, msg, \ | |
2893 _0, _1, _2, NULL, NULL, NULL, NULL, NULL) | |
2894 | |
2895 #define RX_REAL_CHECK_FUZZY_EQUAL_MSG_4(x1, x2, tol, msg, \ | |
2896 _0, _1, _2, _3) \ | |
2897 RX__REAL_DEFINE_FUZZY_TEST(RX_NONFATAL, RX__OP_EQUAL, x1, x2, tol, msg, \ | |
2898 _0, _1, _2, _3, NULL, NULL, NULL, NULL) | |
2899 | |
2900 #define RX_REAL_CHECK_FUZZY_EQUAL_MSG_5(x1, x2, tol, msg, \ | |
2901 _0, _1, _2, _3, _4) \ | |
2902 RX__REAL_DEFINE_FUZZY_TEST(RX_NONFATAL, RX__OP_EQUAL, x1, x2, tol, msg, \ | |
2903 _0, _1, _2, _3, _4, NULL, NULL, NULL) | |
2904 | |
2905 #define RX_REAL_CHECK_FUZZY_EQUAL_MSG_6(x1, x2, tol, msg, \ | |
2906 _0, _1, _2, _3, _4, _5) \ | |
2907 RX__REAL_DEFINE_FUZZY_TEST(RX_NONFATAL, RX__OP_EQUAL, x1, x2, tol, msg, \ | |
2908 _0, _1, _2, _3, _4, _5, NULL, NULL) | |
2909 | |
2910 #define RX_REAL_CHECK_FUZZY_EQUAL_MSG_7(x1, x2, tol, msg, \ | |
2911 _0, _1, _2, _3, _4, _5, _6) \ | |
2912 RX__REAL_DEFINE_FUZZY_TEST(RX_NONFATAL, RX__OP_EQUAL, x1, x2, tol, msg, \ | |
2913 _0, _1, _2, _3, _4, _5, _6, NULL) | |
2914 | |
2915 #define RX_REAL_CHECK_FUZZY_EQUAL_MSG_8(x1, x2, tol, msg, \ | |
2916 _0, _1, _2, _3, _4, _5, _6, _7) \ | |
2917 RX__REAL_DEFINE_FUZZY_TEST(RX_NONFATAL, RX__OP_EQUAL, x1, x2, tol, msg, \ | |
2918 _0, _1, _2, _3, _4, _5, _6, _7) | |
2919 | |
2920 #define RX_REAL_REQUIRE_FUZZY_NOT_EQUAL(x1, x2, tol) \ | |
2921 RX_REAL_REQUIRE_FUZZY_NOT_EQUAL_MSG(x1, x2, tol, NULL) | |
2922 | |
2923 #if RX__HAS_VARIADIC_MACROS | |
2924 #define RX_REAL_REQUIRE_FUZZY_NOT_EQUAL_MSG(x1, x2, tol, ...) \ | |
2925 RX__REAL_DEFINE_FUZZY_TEST(RX_FATAL, RX__OP_NOT_EQUAL, x1, x2, tol, \ | |
2926 __VA_ARGS__) | |
2927 #else | |
2928 #define RX_REAL_REQUIRE_FUZZY_NOT_EQUAL_MSG(x1, x2, tol, msg) \ | |
2929 RX__REAL_DEFINE_FUZZY_TEST( \ | |
2930 RX_FATAL, RX__OP_NOT_EQUAL, x1, x2, tol, msg, \ | |
2931 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) | |
2932 #endif | |
2933 | |
2934 #define RX_REAL_REQUIRE_FUZZY_NOT_EQUAL_MSG_1(x1, x2, tol, msg, \ | |
2935 _0) \ | |
2936 RX__REAL_DEFINE_FUZZY_TEST(RX_FATAL, RX__OP_NOT_EQUAL, x1, x2, tol, msg, \ | |
2937 _0, NULL, NULL, NULL, NULL, NULL, NULL, NULL) | |
2938 | |
2939 #define RX_REAL_REQUIRE_FUZZY_NOT_EQUAL_MSG_2(x1, x2, tol, msg, \ | |
2940 _0, _1) \ | |
2941 RX__REAL_DEFINE_FUZZY_TEST(RX_FATAL, RX__OP_NOT_EQUAL, x1, x2, tol, msg, \ | |
2942 _0, _1, NULL, NULL, NULL, NULL, NULL, NULL) | |
2943 | |
2944 #define RX_REAL_REQUIRE_FUZZY_NOT_EQUAL_MSG_3(x1, x2, tol, msg, \ | |
2945 _0, _1, _2) \ | |
2946 RX__REAL_DEFINE_FUZZY_TEST(RX_FATAL, RX__OP_NOT_EQUAL, x1, x2, tol, msg, \ | |
2947 _0, _1, _2, NULL, NULL, NULL, NULL, NULL) | |
2948 | |
2949 #define RX_REAL_REQUIRE_FUZZY_NOT_EQUAL_MSG_4(x1, x2, tol, msg, \ | |
2950 _0, _1, _2, _3) \ | |
2951 RX__REAL_DEFINE_FUZZY_TEST(RX_FATAL, RX__OP_NOT_EQUAL, x1, x2, tol, msg, \ | |
2952 _0, _1, _2, _3, NULL, NULL, NULL, NULL) | |
2953 | |
2954 #define RX_REAL_REQUIRE_FUZZY_NOT_EQUAL_MSG_5(x1, x2, tol, msg, \ | |
2955 _0, _1, _2, _3, _4) \ | |
2956 RX__REAL_DEFINE_FUZZY_TEST(RX_FATAL, RX__OP_NOT_EQUAL, x1, x2, tol, msg, \ | |
2957 _0, _1, _2, _3, _4, NULL, NULL, NULL) | |
2958 | |
2959 #define RX_REAL_REQUIRE_FUZZY_NOT_EQUAL_MSG_6(x1, x2, tol, msg, \ | |
2960 _0, _1, _2, _3, _4, _5) \ | |
2961 RX__REAL_DEFINE_FUZZY_TEST(RX_FATAL, RX__OP_NOT_EQUAL, x1, x2, tol, msg, \ | |
2962 _0, _1, _2, _3, _4, _5, NULL, NULL) | |
2963 | |
2964 #define RX_REAL_REQUIRE_FUZZY_NOT_EQUAL_MSG_7(x1, x2, tol, msg, \ | |
2965 _0, _1, _2, _3, _4, _5, _6) \ | |
2966 RX__REAL_DEFINE_FUZZY_TEST(RX_FATAL, RX__OP_NOT_EQUAL, x1, x2, tol, msg, \ | |
2967 _0, _1, _2, _3, _4, _5, _6, NULL) | |
2968 | |
2969 #define RX_REAL_REQUIRE_FUZZY_NOT_EQUAL_MSG_8(x1, x2, tol, msg, \ | |
2970 _0, _1, _2, _3, _4, _5, _6, _7) \ | |
2971 RX__REAL_DEFINE_FUZZY_TEST(RX_FATAL, RX__OP_NOT_EQUAL, x1, x2, tol, msg, \ | |
2972 _0, _1, _2, _3, _4, _5, _6, _7) | |
2973 | |
2974 #define RX_REAL_CHECK_FUZZY_NOT_EQUAL(x1, x2, tol) \ | |
2975 RX_REAL_CHECK_FUZZY_NOT_EQUAL_MSG(x1, x2, tol, NULL) | |
2976 | |
2977 #if RX__HAS_VARIADIC_MACROS | |
2978 #define RX_REAL_CHECK_FUZZY_NOT_EQUAL_MSG(x1, x2, tol, ...) \ | |
2979 RX__REAL_DEFINE_FUZZY_TEST(RX_NONFATAL, RX__OP_NOT_EQUAL, x1, x2, tol, \ | |
2980 __VA_ARGS__) | |
2981 #else | |
2982 #define RX_REAL_CHECK_FUZZY_NOT_EQUAL_MSG(x1, x2, tol, msg) \ | |
2983 RX__REAL_DEFINE_FUZZY_TEST( \ | |
2984 RX_NONFATAL, RX__OP_NOT_EQUAL, x1, x2, tol, msg, \ | |
2985 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) | |
2986 #endif | |
2987 | |
2988 #define RX_REAL_CHECK_FUZZY_NOT_EQUAL_MSG_1(x1, x2, tol, msg, \ | |
2989 _0) \ | |
2990 RX__REAL_DEFINE_FUZZY_TEST(RX_NONFATAL, RX__OP_NOT_EQUAL, x1, x2, tol, msg,\ | |
2991 _0, NULL, NULL, NULL, NULL, NULL, NULL, NULL) | |
2992 | |
2993 #define RX_REAL_CHECK_FUZZY_NOT_EQUAL_MSG_2(x1, x2, tol, msg, \ | |
2994 _0, _1) \ | |
2995 RX__REAL_DEFINE_FUZZY_TEST(RX_NONFATAL, RX__OP_NOT_EQUAL, x1, x2, tol, msg,\ | |
2996 _0, _1, NULL, NULL, NULL, NULL, NULL, NULL) | |
2997 | |
2998 #define RX_REAL_CHECK_FUZZY_NOT_EQUAL_MSG_3(x1, x2, tol, msg, \ | |
2999 _0, _1, _2) \ | |
3000 RX__REAL_DEFINE_FUZZY_TEST(RX_NONFATAL, RX__OP_NOT_EQUAL, x1, x2, tol, msg,\ | |
3001 _0, _1, _2, NULL, NULL, NULL, NULL, NULL) | |
3002 | |
3003 #define RX_REAL_CHECK_FUZZY_NOT_EQUAL_MSG_4(x1, x2, tol, msg, \ | |
3004 _0, _1, _2, _3) \ | |
3005 RX__REAL_DEFINE_FUZZY_TEST(RX_NONFATAL, RX__OP_NOT_EQUAL, x1, x2, tol, msg,\ | |
3006 _0, _1, _2, _3, NULL, NULL, NULL, NULL) | |
3007 | |
3008 #define RX_REAL_CHECK_FUZZY_NOT_EQUAL_MSG_5(x1, x2, tol, msg, \ | |
3009 _0, _1, _2, _3, _4) \ | |
3010 RX__REAL_DEFINE_FUZZY_TEST(RX_NONFATAL, RX__OP_NOT_EQUAL, x1, x2, tol, msg,\ | |
3011 _0, _1, _2, _3, _4, NULL, NULL, NULL) | |
3012 | |
3013 #define RX_REAL_CHECK_FUZZY_NOT_EQUAL_MSG_6(x1, x2, tol, msg, \ | |
3014 _0, _1, _2, _3, _4, _5) \ | |
3015 RX__REAL_DEFINE_FUZZY_TEST(RX_NONFATAL, RX__OP_NOT_EQUAL, x1, x2, tol, msg,\ | |
3016 _0, _1, _2, _3, _4, _5, NULL, NULL) | |
3017 | |
3018 #define RX_REAL_CHECK_FUZZY_NOT_EQUAL_MSG_7(x1, x2, tol, msg, \ | |
3019 _0, _1, _2, _3, _4, _5, _6) \ | |
3020 RX__REAL_DEFINE_FUZZY_TEST(RX_NONFATAL, RX__OP_NOT_EQUAL, x1, x2, tol, msg,\ | |
3021 _0, _1, _2, _3, _4, _5, _6, NULL) | |
3022 | |
3023 #define RX_REAL_CHECK_FUZZY_NOT_EQUAL_MSG_8(x1, x2, tol, msg, \ | |
3024 _0, _1, _2, _3, _4, _5, _6, _7) \ | |
3025 RX__REAL_DEFINE_FUZZY_TEST(RX_NONFATAL, RX__OP_NOT_EQUAL, x1, x2, tol, msg,\ | |
3026 _0, _1, _2, _3, _4, _5, _6, _7) | |
3027 | |
3028 /* String Assertions O-(''Q) | |
3029 -------------------------------------------------------------------------- */ | |
3030 | |
3031 #if RX__HAS_VARIADIC_MACROS | |
3032 #define RX__STR_TEST_DEFINE(severity, op, str_case, s1, s2, ...) \ | |
3033 rx__str_assess_comparison(RX_PARAM_CONTEXT, \ | |
3034 (s1), \ | |
3035 (s2), \ | |
3036 str_case, \ | |
3037 op, \ | |
3038 #s1, \ | |
3039 #s2, \ | |
3040 __FILE__, \ | |
3041 __LINE__, \ | |
3042 severity, \ | |
3043 __VA_ARGS__) | |
3044 #else | |
3045 #define RX__STR_TEST_DEFINE(severity, op, str_case, s1, s2, msg, \ | |
3046 _0, _1, _2, _3, _4, _5, _6, _7) \ | |
3047 rx__str_assess_comparison(RX_PARAM_CONTEXT, \ | |
3048 (s1), \ | |
3049 (s2), \ | |
3050 str_case, \ | |
3051 op, \ | |
3052 #s1, \ | |
3053 #s2, \ | |
3054 __FILE__, \ | |
3055 __LINE__, \ | |
3056 severity, \ | |
3057 msg, \ | |
3058 _0, _1, _2, _3, _4, _5, _6, _7) | |
3059 #endif | |
3060 | |
3061 #define RX_STR_REQUIRE_EQUAL(s1, s2) \ | |
3062 RX_STR_REQUIRE_EQUAL_MSG(s1, s2, NULL) | |
3063 | |
3064 #if RX__HAS_VARIADIC_MACROS | |
3065 #define RX_STR_REQUIRE_EQUAL_MSG(s1, s2, ...) \ | |
3066 RX__STR_TEST_DEFINE( \ | |
3067 RX_FATAL, RX__OP_EQUAL, RX__STR_CASE_OBEY, s1, s2, __VA_ARGS__) | |
3068 #else | |
3069 #define RX_STR_REQUIRE_EQUAL_MSG(s1, s2, msg) \ | |
3070 RX__STR_TEST_DEFINE( \ | |
3071 RX_FATAL, RX__OP_EQUAL, RX__STR_CASE_OBEY, s1, s2, msg, \ | |
3072 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) | |
3073 #endif | |
3074 | |
3075 #define RX_STR_REQUIRE_EQUAL_MSG_1(s1, s2, msg, \ | |
3076 _0) \ | |
3077 RX__STR_TEST_DEFINE( \ | |
3078 RX_FATAL, RX__OP_EQUAL, RX__STR_CASE_OBEY, s1, s2, msg, \ | |
3079 _0, NULL, NULL, NULL, NULL, NULL, NULL, NULL) | |
3080 | |
3081 #define RX_STR_REQUIRE_EQUAL_MSG_2(s1, s2, msg, \ | |
3082 _0, _1) \ | |
3083 RX__STR_TEST_DEFINE( \ | |
3084 RX_FATAL, RX__OP_EQUAL, RX__STR_CASE_OBEY, s1, s2, msg, \ | |
3085 _0, _1, NULL, NULL, NULL, NULL, NULL, NULL) | |
3086 | |
3087 #define RX_STR_REQUIRE_EQUAL_MSG_3(s1, s2, msg, \ | |
3088 _0, _1, _2) \ | |
3089 RX__STR_TEST_DEFINE( \ | |
3090 RX_FATAL, RX__OP_EQUAL, RX__STR_CASE_OBEY, s1, s2, msg, \ | |
3091 _0, _1, _2, NULL, NULL, NULL, NULL, NULL) | |
3092 | |
3093 #define RX_STR_REQUIRE_EQUAL_MSG_4(s1, s2, msg, \ | |
3094 _0, _1, _2, _3) \ | |
3095 RX__STR_TEST_DEFINE( \ | |
3096 RX_FATAL, RX__OP_EQUAL, RX__STR_CASE_OBEY, s1, s2, msg, \ | |
3097 _0, _1, _2, _3, NULL, NULL, NULL, NULL) | |
3098 | |
3099 #define RX_STR_REQUIRE_EQUAL_MSG_5(s1, s2, msg, \ | |
3100 _0, _1, _2, _3, _4) \ | |
3101 RX__STR_TEST_DEFINE( \ | |
3102 RX_FATAL, RX__OP_EQUAL, RX__STR_CASE_OBEY, s1, s2, msg, \ | |
3103 _0, _1, _2, _3, _4, NULL, NULL, NULL) | |
3104 | |
3105 #define RX_STR_REQUIRE_EQUAL_MSG_6(s1, s2, msg, \ | |
3106 _0, _1, _2, _3, _4, _5) \ | |
3107 RX__STR_TEST_DEFINE( \ | |
3108 RX_FATAL, RX__OP_EQUAL, RX__STR_CASE_OBEY, s1, s2, msg, \ | |
3109 _0, _1, _2, _3, _4, _5, NULL, NULL) | |
3110 | |
3111 #define RX_STR_REQUIRE_EQUAL_MSG_7(s1, s2, msg, \ | |
3112 _0, _1, _2, _3, _4, _5, _6) \ | |
3113 RX__STR_TEST_DEFINE( \ | |
3114 RX_FATAL, RX__OP_EQUAL, RX__STR_CASE_OBEY, s1, s2, msg, \ | |
3115 _0, _1, _2, _3, _4, _5, _6, NULL) | |
3116 | |
3117 #define RX_STR_REQUIRE_EQUAL_MSG_8(s1, s2, msg, \ | |
3118 _0, _1, _2, _3, _4, _5, _6, _7) \ | |
3119 RX__STR_TEST_DEFINE( \ | |
3120 RX_FATAL, RX__OP_EQUAL, RX__STR_CASE_OBEY, s1, s2, msg, \ | |
3121 _0, _1, _2, _3, _4, _5, _6, _7) | |
3122 | |
3123 #define RX_STR_CHECK_EQUAL(s1, s2) \ | |
3124 RX_STR_CHECK_EQUAL_MSG(s1, s2, NULL) | |
3125 | |
3126 #if RX__HAS_VARIADIC_MACROS | |
3127 #define RX_STR_CHECK_EQUAL_MSG(s1, s2, ...) \ | |
3128 RX__STR_TEST_DEFINE( \ | |
3129 RX_NONFATAL, RX__OP_EQUAL, RX__STR_CASE_OBEY, s1, s2, __VA_ARGS__) | |
3130 #else | |
3131 #define RX_STR_CHECK_EQUAL_MSG(s1, s2, msg) \ | |
3132 RX__STR_TEST_DEFINE( \ | |
3133 RX_NONFATAL, RX__OP_EQUAL, RX__STR_CASE_OBEY, s1, s2, msg, \ | |
3134 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) | |
3135 #endif | |
3136 | |
3137 #define RX_STR_CHECK_EQUAL_MSG_1(s1, s2, msg, \ | |
3138 _0) \ | |
3139 RX__STR_TEST_DEFINE( \ | |
3140 RX_NONFATAL, RX__OP_EQUAL, RX__STR_CASE_OBEY, s1, s2, msg, \ | |
3141 _0, NULL, NULL, NULL, NULL, NULL, NULL, NULL) | |
3142 | |
3143 #define RX_STR_CHECK_EQUAL_MSG_2(s1, s2, msg, \ | |
3144 _0, _1) \ | |
3145 RX__STR_TEST_DEFINE( \ | |
3146 RX_NONFATAL, RX__OP_EQUAL, RX__STR_CASE_OBEY, s1, s2, msg, \ | |
3147 _0, _1, NULL, NULL, NULL, NULL, NULL, NULL) | |
3148 | |
3149 #define RX_STR_CHECK_EQUAL_MSG_3(s1, s2, msg, \ | |
3150 _0, _1, _2) \ | |
3151 RX__STR_TEST_DEFINE( \ | |
3152 RX_NONFATAL, RX__OP_EQUAL, RX__STR_CASE_OBEY, s1, s2, msg, \ | |
3153 _0, _1, _2, NULL, NULL, NULL, NULL, NULL) | |
3154 | |
3155 #define RX_STR_CHECK_EQUAL_MSG_4(s1, s2, msg, \ | |
3156 _0, _1, _2, _3) \ | |
3157 RX__STR_TEST_DEFINE( \ | |
3158 RX_NONFATAL, RX__OP_EQUAL, RX__STR_CASE_OBEY, s1, s2, msg, \ | |
3159 _0, _1, _2, _3, NULL, NULL, NULL, NULL) | |
3160 | |
3161 #define RX_STR_CHECK_EQUAL_MSG_5(s1, s2, msg, \ | |
3162 _0, _1, _2, _3, _4) \ | |
3163 RX__STR_TEST_DEFINE( \ | |
3164 RX_NONFATAL, RX__OP_EQUAL, RX__STR_CASE_OBEY, s1, s2, msg, \ | |
3165 _0, _1, _2, _3, _4, NULL, NULL, NULL) | |
3166 | |
3167 #define RX_STR_CHECK_EQUAL_MSG_6(s1, s2, msg, \ | |
3168 _0, _1, _2, _3, _4, _5) \ | |
3169 RX__STR_TEST_DEFINE( \ | |
3170 RX_NONFATAL, RX__OP_EQUAL, RX__STR_CASE_OBEY, s1, s2, msg, \ | |
3171 _0, _1, _2, _3, _4, _5, NULL, NULL) | |
3172 | |
3173 #define RX_STR_CHECK_EQUAL_MSG_7(s1, s2, msg, \ | |
3174 _0, _1, _2, _3, _4, _5, _6) \ | |
3175 RX__STR_TEST_DEFINE( \ | |
3176 RX_NONFATAL, RX__OP_EQUAL, RX__STR_CASE_OBEY, s1, s2, msg, \ | |
3177 _0, _1, _2, _3, _4, _5, _6, NULL) | |
3178 | |
3179 #define RX_STR_CHECK_EQUAL_MSG_8(s1, s2, msg, \ | |
3180 _0, _1, _2, _3, _4, _5, _6, _7) \ | |
3181 RX__STR_TEST_DEFINE( \ | |
3182 RX_NONFATAL, RX__OP_EQUAL, RX__STR_CASE_OBEY, s1, s2, msg, \ | |
3183 _0, _1, _2, _3, _4, _5, _6, _7) | |
3184 | |
3185 #define RX_STR_REQUIRE_NOT_EQUAL(s1, s2) \ | |
3186 RX_STR_REQUIRE_NOT_EQUAL_MSG(s1, s2, NULL) | |
3187 | |
3188 #if RX__HAS_VARIADIC_MACROS | |
3189 #define RX_STR_REQUIRE_NOT_EQUAL_MSG(s1, s2, ...) \ | |
3190 RX__STR_TEST_DEFINE( \ | |
3191 RX_FATAL, RX__OP_NOT_EQUAL, RX__STR_CASE_OBEY, s1, s2, \ | |
3192 __VA_ARGS__) | |
3193 #else | |
3194 #define RX_STR_REQUIRE_NOT_EQUAL_MSG(s1, s2, msg) \ | |
3195 RX__STR_TEST_DEFINE( \ | |
3196 RX_FATAL, RX__OP_NOT_EQUAL, RX__STR_CASE_OBEY, s1, s2, msg, \ | |
3197 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) | |
3198 #endif | |
3199 | |
3200 #define RX_STR_REQUIRE_NOT_EQUAL_MSG_1(s1, s2, msg, \ | |
3201 _0) \ | |
3202 RX__STR_TEST_DEFINE( \ | |
3203 RX_FATAL, RX__OP_NOT_EQUAL, RX__STR_CASE_OBEY, s1, s2, msg, \ | |
3204 _0, NULL, NULL, NULL, NULL, NULL, NULL, NULL) | |
3205 | |
3206 #define RX_STR_REQUIRE_NOT_EQUAL_MSG_2(s1, s2, msg, \ | |
3207 _0, _1) \ | |
3208 RX__STR_TEST_DEFINE( \ | |
3209 RX_FATAL, RX__OP_NOT_EQUAL, RX__STR_CASE_OBEY, s1, s2, msg, \ | |
3210 _0, _1, NULL, NULL, NULL, NULL, NULL, NULL) | |
3211 | |
3212 #define RX_STR_REQUIRE_NOT_EQUAL_MSG_3(s1, s2, msg, \ | |
3213 _0, _1, _2) \ | |
3214 RX__STR_TEST_DEFINE( \ | |
3215 RX_FATAL, RX__OP_NOT_EQUAL, RX__STR_CASE_OBEY, s1, s2, msg, \ | |
3216 _0, _1, _2, NULL, NULL, NULL, NULL, NULL) | |
3217 | |
3218 #define RX_STR_REQUIRE_NOT_EQUAL_MSG_4(s1, s2, msg, \ | |
3219 _0, _1, _2, _3) \ | |
3220 RX__STR_TEST_DEFINE( \ | |
3221 RX_FATAL, RX__OP_NOT_EQUAL, RX__STR_CASE_OBEY, s1, s2, msg, \ | |
3222 _0, _1, _2, _3, NULL, NULL, NULL, NULL) | |
3223 | |
3224 #define RX_STR_REQUIRE_NOT_EQUAL_MSG_5(s1, s2, msg, \ | |
3225 _0, _1, _2, _3, _4) \ | |
3226 RX__STR_TEST_DEFINE( \ | |
3227 RX_FATAL, RX__OP_NOT_EQUAL, RX__STR_CASE_OBEY, s1, s2, msg, \ | |
3228 _0, _1, _2, _3, _4, NULL, NULL, NULL) | |
3229 | |
3230 #define RX_STR_REQUIRE_NOT_EQUAL_MSG_6(s1, s2, msg, \ | |
3231 _0, _1, _2, _3, _4, _5) \ | |
3232 RX__STR_TEST_DEFINE( \ | |
3233 RX_FATAL, RX__OP_NOT_EQUAL, RX__STR_CASE_OBEY, s1, s2, msg, \ | |
3234 _0, _1, _2, _3, _4, _5, NULL, NULL) | |
3235 | |
3236 #define RX_STR_REQUIRE_NOT_EQUAL_MSG_7(s1, s2, msg, \ | |
3237 _0, _1, _2, _3, _4, _5, _6) \ | |
3238 RX__STR_TEST_DEFINE( \ | |
3239 RX_FATAL, RX__OP_NOT_EQUAL, RX__STR_CASE_OBEY, s1, s2, msg, \ | |
3240 _0, _1, _2, _3, _4, _5, _6, NULL) | |
3241 | |
3242 #define RX_STR_REQUIRE_NOT_EQUAL_MSG_8(s1, s2, msg, \ | |
3243 _0, _1, _2, _3, _4, _5, _6, _7) \ | |
3244 RX__STR_TEST_DEFINE( \ | |
3245 RX_FATAL, RX__OP_NOT_EQUAL, RX__STR_CASE_OBEY, s1, s2, msg, \ | |
3246 _0, _1, _2, _3, _4, _5, _6, _7) | |
3247 | |
3248 #define RX_STR_CHECK_NOT_EQUAL(s1, s2) \ | |
3249 RX_STR_CHECK_NOT_EQUAL_MSG(s1, s2, NULL) | |
3250 | |
3251 #if RX__HAS_VARIADIC_MACROS | |
3252 #define RX_STR_CHECK_NOT_EQUAL_MSG(s1, s2, ...) \ | |
3253 RX__STR_TEST_DEFINE( \ | |
3254 RX_NONFATAL, RX__OP_NOT_EQUAL, RX__STR_CASE_OBEY, s1, s2, \ | |
3255 __VA_ARGS__) | |
3256 #else | |
3257 #define RX_STR_CHECK_NOT_EQUAL_MSG(s1, s2, msg) \ | |
3258 RX__STR_TEST_DEFINE( \ | |
3259 RX_NONFATAL, RX__OP_NOT_EQUAL, RX__STR_CASE_OBEY, s1, s2, msg, \ | |
3260 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) | |
3261 #endif | |
3262 | |
3263 #define RX_STR_CHECK_NOT_EQUAL_MSG_1(s1, s2, msg, \ | |
3264 _0) \ | |
3265 RX__STR_TEST_DEFINE( \ | |
3266 RX_NONFATAL, RX__OP_NOT_EQUAL, RX__STR_CASE_OBEY, s1, s2, msg, \ | |
3267 _0, NULL, NULL, NULL, NULL, NULL, NULL, NULL) | |
3268 | |
3269 #define RX_STR_CHECK_NOT_EQUAL_MSG_2(s1, s2, msg, \ | |
3270 _0, _1) \ | |
3271 RX__STR_TEST_DEFINE( \ | |
3272 RX_NONFATAL, RX__OP_NOT_EQUAL, RX__STR_CASE_OBEY, s1, s2, msg, \ | |
3273 _0, _1, NULL, NULL, NULL, NULL, NULL, NULL) | |
3274 | |
3275 #define RX_STR_CHECK_NOT_EQUAL_MSG_3(s1, s2, msg, \ | |
3276 _0, _1, _2) \ | |
3277 RX__STR_TEST_DEFINE( \ | |
3278 RX_NONFATAL, RX__OP_NOT_EQUAL, RX__STR_CASE_OBEY, s1, s2, msg, \ | |
3279 _0, _1, _2, NULL, NULL, NULL, NULL, NULL) | |
3280 | |
3281 #define RX_STR_CHECK_NOT_EQUAL_MSG_4(s1, s2, msg, \ | |
3282 _0, _1, _2, _3) \ | |
3283 RX__STR_TEST_DEFINE( \ | |
3284 RX_NONFATAL, RX__OP_NOT_EQUAL, RX__STR_CASE_OBEY, s1, s2, msg, \ | |
3285 _0, _1, _2, _3, NULL, NULL, NULL, NULL) | |
3286 | |
3287 #define RX_STR_CHECK_NOT_EQUAL_MSG_5(s1, s2, msg, \ | |
3288 _0, _1, _2, _3, _4) \ | |
3289 RX__STR_TEST_DEFINE( \ | |
3290 RX_NONFATAL, RX__OP_NOT_EQUAL, RX__STR_CASE_OBEY, s1, s2, msg, \ | |
3291 _0, _1, _2, _3, _4, NULL, NULL, NULL) | |
3292 | |
3293 #define RX_STR_CHECK_NOT_EQUAL_MSG_6(s1, s2, msg, \ | |
3294 _0, _1, _2, _3, _4, _5) \ | |
3295 RX__STR_TEST_DEFINE( \ | |
3296 RX_NONFATAL, RX__OP_NOT_EQUAL, RX__STR_CASE_OBEY, s1, s2, msg, \ | |
3297 _0, _1, _2, _3, _4, _5, NULL, NULL) | |
3298 | |
3299 #define RX_STR_CHECK_NOT_EQUAL_MSG_7(s1, s2, msg, \ | |
3300 _0, _1, _2, _3, _4, _5, _6) \ | |
3301 RX__STR_TEST_DEFINE( \ | |
3302 RX_NONFATAL, RX__OP_NOT_EQUAL, RX__STR_CASE_OBEY, s1, s2, msg, \ | |
3303 _0, _1, _2, _3, _4, _5, _6, NULL) | |
3304 | |
3305 #define RX_STR_CHECK_NOT_EQUAL_MSG_8(s1, s2, msg, \ | |
3306 _0, _1, _2, _3, _4, _5, _6, _7) \ | |
3307 RX__STR_TEST_DEFINE( \ | |
3308 RX_NONFATAL, RX__OP_NOT_EQUAL, RX__STR_CASE_OBEY, s1, s2, msg, \ | |
3309 _0, _1, _2, _3, _4, _5, _6, _7) | |
3310 | |
3311 #define RX_STR_REQUIRE_EQUAL_NO_CASE(s1, s2) \ | |
3312 RX_STR_REQUIRE_EQUAL_NO_CASE_MSG(s1, s2, NULL) | |
3313 | |
3314 #if RX__HAS_VARIADIC_MACROS | |
3315 #define RX_STR_REQUIRE_EQUAL_NO_CASE_MSG(s1, s2, ...) \ | |
3316 RX__STR_TEST_DEFINE( \ | |
3317 RX_FATAL, RX__OP_EQUAL, RX__STR_CASE_IGNORE, s1, s2, __VA_ARGS__) | |
3318 #else | |
3319 #define RX_STR_REQUIRE_EQUAL_NO_CASE_MSG(s1, s2, msg) \ | |
3320 RX__STR_TEST_DEFINE( \ | |
3321 RX_FATAL, RX__OP_EQUAL, RX__STR_CASE_IGNORE, s1, s2, msg, \ | |
3322 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) | |
3323 #endif | |
3324 | |
3325 #define RX_STR_REQUIRE_EQUAL_NO_CASE_MSG_1(s1, s2, msg, \ | |
3326 _0) \ | |
3327 RX__STR_TEST_DEFINE( \ | |
3328 RX_FATAL, RX__OP_EQUAL, RX__STR_CASE_IGNORE, s1, s2, msg, \ | |
3329 _0, NULL, NULL, NULL, NULL, NULL, NULL, NULL) | |
3330 | |
3331 #define RX_STR_REQUIRE_EQUAL_NO_CASE_MSG_2(s1, s2, msg, \ | |
3332 _0, _1) \ | |
3333 RX__STR_TEST_DEFINE( \ | |
3334 RX_FATAL, RX__OP_EQUAL, RX__STR_CASE_IGNORE, s1, s2, msg, \ | |
3335 _0, _1, NULL, NULL, NULL, NULL, NULL, NULL) | |
3336 | |
3337 #define RX_STR_REQUIRE_EQUAL_NO_CASE_MSG_3(s1, s2, msg, \ | |
3338 _0, _1, _2) \ | |
3339 RX__STR_TEST_DEFINE( \ | |
3340 RX_FATAL, RX__OP_EQUAL, RX__STR_CASE_IGNORE, s1, s2, msg, \ | |
3341 _0, _1, _2, NULL, NULL, NULL, NULL, NULL) | |
3342 | |
3343 #define RX_STR_REQUIRE_EQUAL_NO_CASE_MSG_4(s1, s2, msg, \ | |
3344 _0, _1, _2, _3) \ | |
3345 RX__STR_TEST_DEFINE( \ | |
3346 RX_FATAL, RX__OP_EQUAL, RX__STR_CASE_IGNORE, s1, s2, msg, \ | |
3347 _0, _1, _2, _3, NULL, NULL, NULL, NULL) | |
3348 | |
3349 #define RX_STR_REQUIRE_EQUAL_NO_CASE_MSG_5(s1, s2, msg, \ | |
3350 _0, _1, _2, _3, _4) \ | |
3351 RX__STR_TEST_DEFINE( \ | |
3352 RX_FATAL, RX__OP_EQUAL, RX__STR_CASE_IGNORE, s1, s2, msg, \ | |
3353 _0, _1, _2, _3, _4, NULL, NULL, NULL) | |
3354 | |
3355 #define RX_STR_REQUIRE_EQUAL_NO_CASE_MSG_6(s1, s2, msg, \ | |
3356 _0, _1, _2, _3, _4, _5) \ | |
3357 RX__STR_TEST_DEFINE( \ | |
3358 RX_FATAL, RX__OP_EQUAL, RX__STR_CASE_IGNORE, s1, s2, msg, \ | |
3359 _0, _1, _2, _3, _4, _5, NULL, NULL) | |
3360 | |
3361 #define RX_STR_REQUIRE_EQUAL_NO_CASE_MSG_7(s1, s2, msg, \ | |
3362 _0, _1, _2, _3, _4, _5, _6) \ | |
3363 RX__STR_TEST_DEFINE( \ | |
3364 RX_FATAL, RX__OP_EQUAL, RX__STR_CASE_IGNORE, s1, s2, msg, \ | |
3365 _0, _1, _2, _3, _4, _5, _6, NULL) | |
3366 | |
3367 #define RX_STR_REQUIRE_EQUAL_NO_CASE_MSG_8(s1, s2, msg, \ | |
3368 _0, _1, _2, _3, _4, _5, _6, _7) \ | |
3369 RX__STR_TEST_DEFINE( \ | |
3370 RX_FATAL, RX__OP_EQUAL, RX__STR_CASE_IGNORE, s1, s2, msg, \ | |
3371 _0, _1, _2, _3, _4, _5, _6, _7) | |
3372 | |
3373 #define RX_STR_CHECK_EQUAL_NO_CASE(s1, s2) \ | |
3374 RX_STR_CHECK_EQUAL_NO_CASE_MSG(s1, s2, NULL) | |
3375 | |
3376 #if RX__HAS_VARIADIC_MACROS | |
3377 #define RX_STR_CHECK_EQUAL_NO_CASE_MSG(s1, s2, ...) \ | |
3378 RX__STR_TEST_DEFINE( \ | |
3379 RX_NONFATAL, RX__OP_EQUAL, RX__STR_CASE_IGNORE, s1, s2, __VA_ARGS__) | |
3380 #else | |
3381 #define RX_STR_CHECK_EQUAL_NO_CASE_MSG(s1, s2, msg) \ | |
3382 RX__STR_TEST_DEFINE( \ | |
3383 RX_NONFATAL, RX__OP_EQUAL, RX__STR_CASE_IGNORE, s1, s2, msg, \ | |
3384 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) | |
3385 #endif | |
3386 | |
3387 #define RX_STR_CHECK_EQUAL_NO_CASE_MSG_1(s1, s2, msg, \ | |
3388 _0) \ | |
3389 RX__STR_TEST_DEFINE( \ | |
3390 RX_NONFATAL, RX__OP_EQUAL, RX__STR_CASE_IGNORE, s1, s2, msg, \ | |
3391 _0, NULL, NULL, NULL, NULL, NULL, NULL, NULL) | |
3392 | |
3393 #define RX_STR_CHECK_EQUAL_NO_CASE_MSG_2(s1, s2, msg, \ | |
3394 _0, _1) \ | |
3395 RX__STR_TEST_DEFINE( \ | |
3396 RX_NONFATAL, RX__OP_EQUAL, RX__STR_CASE_IGNORE, s1, s2, msg, \ | |
3397 _0, _1, NULL, NULL, NULL, NULL, NULL, NULL) | |
3398 | |
3399 #define RX_STR_CHECK_EQUAL_NO_CASE_MSG_3(s1, s2, msg, \ | |
3400 _0, _1, _2) \ | |
3401 RX__STR_TEST_DEFINE( \ | |
3402 RX_NONFATAL, RX__OP_EQUAL, RX__STR_CASE_IGNORE, s1, s2, msg, \ | |
3403 _0, _1, _2, NULL, NULL, NULL, NULL, NULL) | |
3404 | |
3405 #define RX_STR_CHECK_EQUAL_NO_CASE_MSG_4(s1, s2, msg, \ | |
3406 _0, _1, _2, _3) \ | |
3407 RX__STR_TEST_DEFINE( \ | |
3408 RX_NONFATAL, RX__OP_EQUAL, RX__STR_CASE_IGNORE, s1, s2, msg, \ | |
3409 _0, _1, _2, _3, NULL, NULL, NULL, NULL) | |
3410 | |
3411 #define RX_STR_CHECK_EQUAL_NO_CASE_MSG_5(s1, s2, msg, \ | |
3412 _0, _1, _2, _3, _4) \ | |
3413 RX__STR_TEST_DEFINE( \ | |
3414 RX_NONFATAL, RX__OP_EQUAL, RX__STR_CASE_IGNORE, s1, s2, msg, \ | |
3415 _0, _1, _2, _3, _4, NULL, NULL, NULL) | |
3416 | |
3417 #define RX_STR_CHECK_EQUAL_NO_CASE_MSG_6(s1, s2, msg, \ | |
3418 _0, _1, _2, _3, _4, _5) \ | |
3419 RX__STR_TEST_DEFINE( \ | |
3420 RX_NONFATAL, RX__OP_EQUAL, RX__STR_CASE_IGNORE, s1, s2, msg, \ | |
3421 _0, _1, _2, _3, _4, _5, NULL, NULL) | |
3422 | |
3423 #define RX_STR_CHECK_EQUAL_NO_CASE_MSG_7(s1, s2, msg, \ | |
3424 _0, _1, _2, _3, _4, _5, _6) \ | |
3425 RX__STR_TEST_DEFINE( \ | |
3426 RX_NONFATAL, RX__OP_EQUAL, RX__STR_CASE_IGNORE, s1, s2, msg, \ | |
3427 _0, _1, _2, _3, _4, _5, _6, NULL) | |
3428 | |
3429 #define RX_STR_CHECK_EQUAL_NO_CASE_MSG_8(s1, s2, msg, \ | |
3430 _0, _1, _2, _3, _4, _5, _6, _7) \ | |
3431 RX__STR_TEST_DEFINE( \ | |
3432 RX_NONFATAL, RX__OP_EQUAL, RX__STR_CASE_IGNORE, s1, s2, msg, \ | |
3433 _0, _1, _2, _3, _4, _5, _6, _7) | |
3434 | |
3435 #define RX_STR_REQUIRE_NOT_EQUAL_NO_CASE(s1, s2) \ | |
3436 RX_STR_REQUIRE_NOT_EQUAL_NO_CASE_MSG(s1, s2, NULL) | |
3437 | |
3438 #if RX__HAS_VARIADIC_MACROS | |
3439 #define RX_STR_REQUIRE_NOT_EQUAL_NO_CASE_MSG(s1, s2, ...) \ | |
3440 RX__STR_TEST_DEFINE( \ | |
3441 RX_FATAL, RX__OP_NOT_EQUAL, RX__STR_CASE_IGNORE, s1, s2, \ | |
3442 __VA_ARGS__) | |
3443 #else | |
3444 #define RX_STR_REQUIRE_NOT_EQUAL_NO_CASE_MSG(s1, s2, msg) \ | |
3445 RX__STR_TEST_DEFINE( \ | |
3446 RX_FATAL, RX__OP_NOT_EQUAL, RX__STR_CASE_IGNORE, s1, s2, msg, \ | |
3447 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) | |
3448 #endif | |
3449 | |
3450 #define RX_STR_REQUIRE_NOT_EQUAL_NO_CASE_MSG_1(s1, s2, msg, \ | |
3451 _0) \ | |
3452 RX__STR_TEST_DEFINE( \ | |
3453 RX_FATAL, RX__OP_NOT_EQUAL, RX__STR_CASE_IGNORE, s1, s2, msg, \ | |
3454 _0, NULL, NULL, NULL, NULL, NULL, NULL, NULL) | |
3455 | |
3456 #define RX_STR_REQUIRE_NOT_EQUAL_NO_CASE_MSG_2(s1, s2, msg, \ | |
3457 _0, _1) \ | |
3458 RX__STR_TEST_DEFINE( \ | |
3459 RX_FATAL, RX__OP_NOT_EQUAL, RX__STR_CASE_IGNORE, s1, s2, msg, \ | |
3460 _0, _1, NULL, NULL, NULL, NULL, NULL, NULL) | |
3461 | |
3462 #define RX_STR_REQUIRE_NOT_EQUAL_NO_CASE_MSG_3(s1, s2, msg, \ | |
3463 _0, _1, _2) \ | |
3464 RX__STR_TEST_DEFINE( \ | |
3465 RX_FATAL, RX__OP_NOT_EQUAL, RX__STR_CASE_IGNORE, s1, s2, msg, \ | |
3466 _0, _1, _2, NULL, NULL, NULL, NULL, NULL) | |
3467 | |
3468 #define RX_STR_REQUIRE_NOT_EQUAL_NO_CASE_MSG_4(s1, s2, msg, \ | |
3469 _0, _1, _2, _3) \ | |
3470 RX__STR_TEST_DEFINE( \ | |
3471 RX_FATAL, RX__OP_NOT_EQUAL, RX__STR_CASE_IGNORE, s1, s2, msg, \ | |
3472 _0, _1, _2, _3, NULL, NULL, NULL, NULL) | |
3473 | |
3474 #define RX_STR_REQUIRE_NOT_EQUAL_NO_CASE_MSG_5(s1, s2, msg, \ | |
3475 _0, _1, _2, _3, _4) \ | |
3476 RX__STR_TEST_DEFINE( \ | |
3477 RX_FATAL, RX__OP_NOT_EQUAL, RX__STR_CASE_IGNORE, s1, s2, msg, \ | |
3478 _0, _1, _2, _3, _4, NULL, NULL, NULL) | |
3479 | |
3480 #define RX_STR_REQUIRE_NOT_EQUAL_NO_CASE_MSG_6(s1, s2, msg, \ | |
3481 _0, _1, _2, _3, _4, _5) \ | |
3482 RX__STR_TEST_DEFINE( \ | |
3483 RX_FATAL, RX__OP_NOT_EQUAL, RX__STR_CASE_IGNORE, s1, s2, msg, \ | |
3484 _0, _1, _2, _3, _4, _5, NULL, NULL) | |
3485 | |
3486 #define RX_STR_REQUIRE_NOT_EQUAL_NO_CASE_MSG_7(s1, s2, msg, \ | |
3487 _0, _1, _2, _3, _4, _5, _6) \ | |
3488 RX__STR_TEST_DEFINE( \ | |
3489 RX_FATAL, RX__OP_NOT_EQUAL, RX__STR_CASE_IGNORE, s1, s2, msg, \ | |
3490 _0, _1, _2, _3, _4, _5, _6, NULL) | |
3491 | |
3492 #define RX_STR_REQUIRE_NOT_EQUAL_NO_CASE_MSG_8(s1, s2, msg, \ | |
3493 _0, _1, _2, _3, _4, _5, _6, _7) \ | |
3494 RX__STR_TEST_DEFINE( \ | |
3495 RX_FATAL, RX__OP_NOT_EQUAL, RX__STR_CASE_IGNORE, s1, s2, msg, \ | |
3496 _0, _1, _2, _3, _4, _5, _6, _7) | |
3497 | |
3498 #define RX_STR_CHECK_NOT_EQUAL_NO_CASE(s1, s2) \ | |
3499 RX_STR_CHECK_NOT_EQUAL_NO_CASE_MSG(s1, s2, NULL) | |
3500 | |
3501 #if RX__HAS_VARIADIC_MACROS | |
3502 #define RX_STR_CHECK_NOT_EQUAL_NO_CASE_MSG(s1, s2, ...) \ | |
3503 RX__STR_TEST_DEFINE( \ | |
3504 RX_NONFATAL, RX__OP_NOT_EQUAL, RX__STR_CASE_IGNORE, s1, s2, \ | |
3505 __VA_ARGS__) | |
3506 #else | |
3507 #define RX_STR_CHECK_NOT_EQUAL_NO_CASE_MSG(s1, s2, msg) \ | |
3508 RX__STR_TEST_DEFINE( \ | |
3509 RX_NONFATAL, RX__OP_NOT_EQUAL, RX__STR_CASE_IGNORE, s1, s2, msg, \ | |
3510 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) | |
3511 #endif | |
3512 | |
3513 #define RX_STR_CHECK_NOT_EQUAL_NO_CASE_MSG_1(s1, s2, msg, \ | |
3514 _0) \ | |
3515 RX__STR_TEST_DEFINE( \ | |
3516 RX_NONFATAL, RX__OP_NOT_EQUAL, RX__STR_CASE_IGNORE, s1, s2, msg, \ | |
3517 _0, NULL, NULL, NULL, NULL, NULL, NULL, NULL) | |
3518 | |
3519 #define RX_STR_CHECK_NOT_EQUAL_NO_CASE_MSG_2(s1, s2, msg, \ | |
3520 _0, _1) \ | |
3521 RX__STR_TEST_DEFINE( \ | |
3522 RX_NONFATAL, RX__OP_NOT_EQUAL, RX__STR_CASE_IGNORE, s1, s2, msg, \ | |
3523 _0, _1, NULL, NULL, NULL, NULL, NULL, NULL) | |
3524 | |
3525 #define RX_STR_CHECK_NOT_EQUAL_NO_CASE_MSG_3(s1, s2, msg, \ | |
3526 _0, _1, _2) \ | |
3527 RX__STR_TEST_DEFINE( \ | |
3528 RX_NONFATAL, RX__OP_NOT_EQUAL, RX__STR_CASE_IGNORE, s1, s2, msg, \ | |
3529 _0, _1, _2, NULL, NULL, NULL, NULL, NULL) | |
3530 | |
3531 #define RX_STR_CHECK_NOT_EQUAL_NO_CASE_MSG_4(s1, s2, msg, \ | |
3532 _0, _1, _2, _3) \ | |
3533 RX__STR_TEST_DEFINE( \ | |
3534 RX_NONFATAL, RX__OP_NOT_EQUAL, RX__STR_CASE_IGNORE, s1, s2, msg, \ | |
3535 _0, _1, _2, _3, NULL, NULL, NULL, NULL) | |
3536 | |
3537 #define RX_STR_CHECK_NOT_EQUAL_NO_CASE_MSG_5(s1, s2, msg, \ | |
3538 _0, _1, _2, _3, _4) \ | |
3539 RX__STR_TEST_DEFINE( \ | |
3540 RX_NONFATAL, RX__OP_NOT_EQUAL, RX__STR_CASE_IGNORE, s1, s2, msg, \ | |
3541 _0, _1, _2, _3, _4, NULL, NULL, NULL) | |
3542 | |
3543 #define RX_STR_CHECK_NOT_EQUAL_NO_CASE_MSG_6(s1, s2, msg, \ | |
3544 _0, _1, _2, _3, _4, _5) \ | |
3545 RX__STR_TEST_DEFINE( \ | |
3546 RX_NONFATAL, RX__OP_NOT_EQUAL, RX__STR_CASE_IGNORE, s1, s2, msg, \ | |
3547 _0, _1, _2, _3, _4, _5, NULL, NULL) | |
3548 | |
3549 #define RX_STR_CHECK_NOT_EQUAL_NO_CASE_MSG_7(s1, s2, msg, \ | |
3550 _0, _1, _2, _3, _4, _5, _6) \ | |
3551 RX__STR_TEST_DEFINE( \ | |
3552 RX_NONFATAL, RX__OP_NOT_EQUAL, RX__STR_CASE_IGNORE, s1, s2, msg, \ | |
3553 _0, _1, _2, _3, _4, _5, _6, NULL) | |
3554 | |
3555 #define RX_STR_CHECK_NOT_EQUAL_NO_CASE_MSG_8(s1, s2, msg, \ | |
3556 _0, _1, _2, _3, _4, _5, _6, _7) \ | |
3557 RX__STR_TEST_DEFINE( \ | |
3558 RX_NONFATAL, RX__OP_NOT_EQUAL, RX__STR_CASE_IGNORE, s1, s2, msg, \ | |
3559 _0, _1, _2, _3, _4, _5, _6, _7) | |
3560 | |
3561 /* Pointer Assertions O-(''Q) | |
3562 -------------------------------------------------------------------------- */ | |
3563 | |
3564 #if RX__HAS_VARIADIC_MACROS | |
3565 #define RX__PTR_DEFINE_TEST(severity, op, x1, x2, ...) \ | |
3566 rx__ptr_assess_comparison(RX_PARAM_CONTEXT, \ | |
3567 (x1), \ | |
3568 (x2), \ | |
3569 op, \ | |
3570 #x1, \ | |
3571 #x2, \ | |
3572 __FILE__, \ | |
3573 __LINE__, \ | |
3574 severity, \ | |
3575 __VA_ARGS__) | |
3576 #else | |
3577 #define RX__PTR_DEFINE_TEST(severity, op, x1, x2, msg, \ | |
3578 _0, _1, _2, _3, _4, _5, _6, _7) \ | |
3579 rx__ptr_assess_comparison(RX_PARAM_CONTEXT, \ | |
3580 (x1), \ | |
3581 (x2), \ | |
3582 op, \ | |
3583 #x1, \ | |
3584 #x2, \ | |
3585 __FILE__, \ | |
3586 __LINE__, \ | |
3587 severity, \ | |
3588 msg, \ | |
3589 _0, _1, _2, _3, _4, _5, _6, _7) | |
3590 #endif | |
3591 | |
3592 #define RX_PTR_REQUIRE_EQUAL(x1, x2) \ | |
3593 RX_PTR_REQUIRE_EQUAL_MSG(x1, x2, NULL) | |
3594 | |
3595 #if RX__HAS_VARIADIC_MACROS | |
3596 #define RX_PTR_REQUIRE_EQUAL_MSG(x1, x2, ...) \ | |
3597 RX__PTR_DEFINE_TEST(RX_FATAL, RX__OP_EQUAL, x1, x2, __VA_ARGS__) | |
3598 #else | |
3599 #define RX_PTR_REQUIRE_EQUAL_MSG(x1, x2, msg) \ | |
3600 RX__PTR_DEFINE_TEST(RX_FATAL, RX__OP_EQUAL, x1, x2, msg, \ | |
3601 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) | |
3602 #endif | |
3603 | |
3604 #define RX_PTR_REQUIRE_EQUAL_MSG_1(x1, x2, msg, \ | |
3605 _0) \ | |
3606 RX__PTR_DEFINE_TEST(RX_FATAL, RX__OP_EQUAL, x1, x2, msg, \ | |
3607 _0, NULL, NULL, NULL, NULL, NULL, NULL, NULL) | |
3608 | |
3609 #define RX_PTR_REQUIRE_EQUAL_MSG_2(x1, x2, msg, \ | |
3610 _0, _1) \ | |
3611 RX__PTR_DEFINE_TEST(RX_FATAL, RX__OP_EQUAL, x1, x2, msg, \ | |
3612 _0, _1, NULL, NULL, NULL, NULL, NULL, NULL) | |
3613 | |
3614 #define RX_PTR_REQUIRE_EQUAL_MSG_3(x1, x2, msg, \ | |
3615 _0, _1, _2) \ | |
3616 RX__PTR_DEFINE_TEST(RX_FATAL, RX__OP_EQUAL, x1, x2, msg, \ | |
3617 _0, _1, _2, NULL, NULL, NULL, NULL, NULL) | |
3618 | |
3619 #define RX_PTR_REQUIRE_EQUAL_MSG_4(x1, x2, msg, \ | |
3620 _0, _1, _2, _3) \ | |
3621 RX__PTR_DEFINE_TEST(RX_FATAL, RX__OP_EQUAL, x1, x2, msg, \ | |
3622 _0, _1, _2, _3, NULL, NULL, NULL, NULL) | |
3623 | |
3624 #define RX_PTR_REQUIRE_EQUAL_MSG_5(x1, x2, msg, \ | |
3625 _0, _1, _2, _3, _4) \ | |
3626 RX__PTR_DEFINE_TEST(RX_FATAL, RX__OP_EQUAL, x1, x2, msg, \ | |
3627 _0, _1, _2, _3, _4, NULL, NULL, NULL) | |
3628 | |
3629 #define RX_PTR_REQUIRE_EQUAL_MSG_6(x1, x2, msg, \ | |
3630 _0, _1, _2, _3, _4, _5) \ | |
3631 RX__PTR_DEFINE_TEST(RX_FATAL, RX__OP_EQUAL, x1, x2, msg, \ | |
3632 _0, _1, _2, _3, _4, _5, NULL, NULL) | |
3633 | |
3634 #define RX_PTR_REQUIRE_EQUAL_MSG_7(x1, x2, msg, \ | |
3635 _0, _1, _2, _3, _4, _5, _6) \ | |
3636 RX__PTR_DEFINE_TEST(RX_FATAL, RX__OP_EQUAL, x1, x2, msg, \ | |
3637 _0, _1, _2, _3, _4, _5, _6, NULL) | |
3638 | |
3639 #define RX_PTR_REQUIRE_EQUAL_MSG_8(x1, x2, msg, \ | |
3640 _0, _1, _2, _3, _4, _5, _6, _7) \ | |
3641 RX__PTR_DEFINE_TEST(RX_FATAL, RX__OP_EQUAL, x1, x2, msg, \ | |
3642 _0, _1, _2, _3, _4, _5, _6, _7) | |
3643 | |
3644 #define RX_PTR_CHECK_EQUAL(x1, x2) \ | |
3645 RX_PTR_CHECK_EQUAL_MSG(x1, x2, NULL) | |
3646 | |
3647 #if RX__HAS_VARIADIC_MACROS | |
3648 #define RX_PTR_CHECK_EQUAL_MSG(x1, x2, ...) \ | |
3649 RX__PTR_DEFINE_TEST(RX_NONFATAL, RX__OP_EQUAL, x1, x2, __VA_ARGS__) | |
3650 #else | |
3651 #define RX_PTR_CHECK_EQUAL_MSG(x1, x2, msg) \ | |
3652 RX__PTR_DEFINE_TEST(RX_NONFATAL, RX__OP_EQUAL, x1, x2, msg, \ | |
3653 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) | |
3654 #endif | |
3655 | |
3656 #define RX_PTR_CHECK_EQUAL_MSG_1(x1, x2, msg, \ | |
3657 _0) \ | |
3658 RX__PTR_DEFINE_TEST(RX_NONFATAL, RX__OP_EQUAL, x1, x2, msg, \ | |
3659 _0, NULL, NULL, NULL, NULL, NULL, NULL, NULL) | |
3660 | |
3661 #define RX_PTR_CHECK_EQUAL_MSG_2(x1, x2, msg, \ | |
3662 _0, _1) \ | |
3663 RX__PTR_DEFINE_TEST(RX_NONFATAL, RX__OP_EQUAL, x1, x2, msg, \ | |
3664 _0, _1, NULL, NULL, NULL, NULL, NULL, NULL) | |
3665 | |
3666 #define RX_PTR_CHECK_EQUAL_MSG_3(x1, x2, msg, \ | |
3667 _0, _1, _2) \ | |
3668 RX__PTR_DEFINE_TEST(RX_NONFATAL, RX__OP_EQUAL, x1, x2, msg, \ | |
3669 _0, _1, _2, NULL, NULL, NULL, NULL, NULL) | |
3670 | |
3671 #define RX_PTR_CHECK_EQUAL_MSG_4(x1, x2, msg, \ | |
3672 _0, _1, _2, _3) \ | |
3673 RX__PTR_DEFINE_TEST(RX_NONFATAL, RX__OP_EQUAL, x1, x2, msg, \ | |
3674 _0, _1, _2, _3, NULL, NULL, NULL, NULL) | |
3675 | |
3676 #define RX_PTR_CHECK_EQUAL_MSG_5(x1, x2, msg, \ | |
3677 _0, _1, _2, _3, _4) \ | |
3678 RX__PTR_DEFINE_TEST(RX_NONFATAL, RX__OP_EQUAL, x1, x2, msg, \ | |
3679 _0, _1, _2, _3, _4, NULL, NULL, NULL) | |
3680 | |
3681 #define RX_PTR_CHECK_EQUAL_MSG_6(x1, x2, msg, \ | |
3682 _0, _1, _2, _3, _4, _5) \ | |
3683 RX__PTR_DEFINE_TEST(RX_NONFATAL, RX__OP_EQUAL, x1, x2, msg, \ | |
3684 _0, _1, _2, _3, _4, _5, NULL, NULL) | |
3685 | |
3686 #define RX_PTR_CHECK_EQUAL_MSG_7(x1, x2, msg, \ | |
3687 _0, _1, _2, _3, _4, _5, _6) \ | |
3688 RX__PTR_DEFINE_TEST(RX_NONFATAL, RX__OP_EQUAL, x1, x2, msg, \ | |
3689 _0, _1, _2, _3, _4, _5, _6, NULL) | |
3690 | |
3691 #define RX_PTR_CHECK_EQUAL_MSG_8(x1, x2, msg, \ | |
3692 _0, _1, _2, _3, _4, _5, _6, _7) \ | |
3693 RX__PTR_DEFINE_TEST(RX_NONFATAL, RX__OP_EQUAL, x1, x2, msg, \ | |
3694 _0, _1, _2, _3, _4, _5, _6, _7) | |
3695 | |
3696 #define RX_PTR_REQUIRE_NOT_EQUAL(x1, x2) \ | |
3697 RX_PTR_REQUIRE_NOT_EQUAL_MSG(x1, x2, NULL) | |
3698 | |
3699 #if RX__HAS_VARIADIC_MACROS | |
3700 #define RX_PTR_REQUIRE_NOT_EQUAL_MSG(x1, x2, ...) \ | |
3701 RX__PTR_DEFINE_TEST(RX_FATAL, RX__OP_NOT_EQUAL, x1, x2, __VA_ARGS__) | |
3702 #else | |
3703 #define RX_PTR_REQUIRE_NOT_EQUAL_MSG(x1, x2, msg) \ | |
3704 RX__PTR_DEFINE_TEST(RX_FATAL, RX__OP_NOT_EQUAL, x1, x2, msg, \ | |
3705 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) | |
3706 #endif | |
3707 | |
3708 #define RX_PTR_REQUIRE_NOT_EQUAL_MSG_1(x1, x2, msg, \ | |
3709 _0) \ | |
3710 RX__PTR_DEFINE_TEST(RX_FATAL, RX__OP_NOT_EQUAL, x1, x2, msg, \ | |
3711 _0, NULL, NULL, NULL, NULL, NULL, NULL, NULL) | |
3712 | |
3713 #define RX_PTR_REQUIRE_NOT_EQUAL_MSG_2(x1, x2, msg, \ | |
3714 _0, _1) \ | |
3715 RX__PTR_DEFINE_TEST(RX_FATAL, RX__OP_NOT_EQUAL, x1, x2, msg, \ | |
3716 _0, _1, NULL, NULL, NULL, NULL, NULL, NULL) | |
3717 | |
3718 #define RX_PTR_REQUIRE_NOT_EQUAL_MSG_3(x1, x2, msg, \ | |
3719 _0, _1, _2) \ | |
3720 RX__PTR_DEFINE_TEST(RX_FATAL, RX__OP_NOT_EQUAL, x1, x2, msg, \ | |
3721 _0, _1, _2, NULL, NULL, NULL, NULL, NULL) | |
3722 | |
3723 #define RX_PTR_REQUIRE_NOT_EQUAL_MSG_4(x1, x2, msg, \ | |
3724 _0, _1, _2, _3) \ | |
3725 RX__PTR_DEFINE_TEST(RX_FATAL, RX__OP_NOT_EQUAL, x1, x2, msg, \ | |
3726 _0, _1, _2, _3, NULL, NULL, NULL, NULL) | |
3727 | |
3728 #define RX_PTR_REQUIRE_NOT_EQUAL_MSG_5(x1, x2, msg, \ | |
3729 _0, _1, _2, _3, _4) \ | |
3730 RX__PTR_DEFINE_TEST(RX_FATAL, RX__OP_NOT_EQUAL, x1, x2, msg, \ | |
3731 _0, _1, _2, _3, _4, NULL, NULL, NULL) | |
3732 | |
3733 #define RX_PTR_REQUIRE_NOT_EQUAL_MSG_6(x1, x2, msg, \ | |
3734 _0, _1, _2, _3, _4, _5) \ | |
3735 RX__PTR_DEFINE_TEST(RX_FATAL, RX__OP_NOT_EQUAL, x1, x2, msg, \ | |
3736 _0, _1, _2, _3, _4, _5, NULL, NULL) | |
3737 | |
3738 #define RX_PTR_REQUIRE_NOT_EQUAL_MSG_7(x1, x2, msg, \ | |
3739 _0, _1, _2, _3, _4, _5, _6) \ | |
3740 RX__PTR_DEFINE_TEST(RX_FATAL, RX__OP_NOT_EQUAL, x1, x2, msg, \ | |
3741 _0, _1, _2, _3, _4, _5, _6, NULL) | |
3742 | |
3743 #define RX_PTR_REQUIRE_NOT_EQUAL_MSG_8(x1, x2, msg, \ | |
3744 _0, _1, _2, _3, _4, _5, _6, _7) \ | |
3745 RX__PTR_DEFINE_TEST(RX_FATAL, RX__OP_NOT_EQUAL, x1, x2, msg, \ | |
3746 _0, _1, _2, _3, _4, _5, _6, _7) | |
3747 | |
3748 #define RX_PTR_CHECK_NOT_EQUAL(x1, x2) \ | |
3749 RX_PTR_CHECK_NOT_EQUAL_MSG(x1, x2, NULL) | |
3750 | |
3751 #if RX__HAS_VARIADIC_MACROS | |
3752 #define RX_PTR_CHECK_NOT_EQUAL_MSG(x1, x2, ...) \ | |
3753 RX__PTR_DEFINE_TEST(RX_NONFATAL, RX__OP_NOT_EQUAL, x1, x2, __VA_ARGS__) | |
3754 #else | |
3755 #define RX_PTR_CHECK_NOT_EQUAL_MSG(x1, x2, msg) \ | |
3756 RX__PTR_DEFINE_TEST(RX_NONFATAL, RX__OP_NOT_EQUAL, x1, x2, msg, \ | |
3757 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) | |
3758 #endif | |
3759 | |
3760 #define RX_PTR_CHECK_NOT_EQUAL_MSG_1(x1, x2, msg, \ | |
3761 _0) \ | |
3762 RX__PTR_DEFINE_TEST(RX_NONFATAL, RX__OP_NOT_EQUAL, x1, x2, msg, \ | |
3763 _0, NULL, NULL, NULL, NULL, NULL, NULL, NULL) | |
3764 | |
3765 #define RX_PTR_CHECK_NOT_EQUAL_MSG_2(x1, x2, msg, \ | |
3766 _0, _1) \ | |
3767 RX__PTR_DEFINE_TEST(RX_NONFATAL, RX__OP_NOT_EQUAL, x1, x2, msg, \ | |
3768 _0, _1, NULL, NULL, NULL, NULL, NULL, NULL) | |
3769 | |
3770 #define RX_PTR_CHECK_NOT_EQUAL_MSG_3(x1, x2, msg, \ | |
3771 _0, _1, _2) \ | |
3772 RX__PTR_DEFINE_TEST(RX_NONFATAL, RX__OP_NOT_EQUAL, x1, x2, msg, \ | |
3773 _0, _1, _2, NULL, NULL, NULL, NULL, NULL) | |
3774 | |
3775 #define RX_PTR_CHECK_NOT_EQUAL_MSG_4(x1, x2, msg, \ | |
3776 _0, _1, _2, _3) \ | |
3777 RX__PTR_DEFINE_TEST(RX_NONFATAL, RX__OP_NOT_EQUAL, x1, x2, msg, \ | |
3778 _0, _1, _2, _3, NULL, NULL, NULL, NULL) | |
3779 | |
3780 #define RX_PTR_CHECK_NOT_EQUAL_MSG_5(x1, x2, msg, \ | |
3781 _0, _1, _2, _3, _4) \ | |
3782 RX__PTR_DEFINE_TEST(RX_NONFATAL, RX__OP_NOT_EQUAL, x1, x2, msg, \ | |
3783 _0, _1, _2, _3, _4, NULL, NULL, NULL) | |
3784 | |
3785 #define RX_PTR_CHECK_NOT_EQUAL_MSG_6(x1, x2, msg, \ | |
3786 _0, _1, _2, _3, _4, _5) \ | |
3787 RX__PTR_DEFINE_TEST(RX_NONFATAL, RX__OP_NOT_EQUAL, x1, x2, msg, \ | |
3788 _0, _1, _2, _3, _4, _5, NULL, NULL) | |
3789 | |
3790 #define RX_PTR_CHECK_NOT_EQUAL_MSG_7(x1, x2, msg, \ | |
3791 _0, _1, _2, _3, _4, _5, _6) \ | |
3792 RX__PTR_DEFINE_TEST(RX_NONFATAL, RX__OP_NOT_EQUAL, x1, x2, msg, \ | |
3793 _0, _1, _2, _3, _4, _5, _6, NULL) | |
3794 | |
3795 #define RX_PTR_CHECK_NOT_EQUAL_MSG_8(x1, x2, msg, \ | |
3796 _0, _1, _2, _3, _4, _5, _6, _7) \ | |
3797 RX__PTR_DEFINE_TEST(RX_NONFATAL, RX__OP_NOT_EQUAL, x1, x2, msg, \ | |
3798 _0, _1, _2, _3, _4, _5, _6, _7) | |
3799 | |
3800 #if RX__HAS_VARIADIC_MACROS | |
3801 #define RX__PTR_DEFINE_ALIGNMENT_TEST(severity, x, alignment, ...) \ | |
3802 rx__ptr_assess_alignment(RX_PARAM_CONTEXT, \ | |
3803 (x), \ | |
3804 (alignment), \ | |
3805 #x, \ | |
3806 __FILE__, \ | |
3807 __LINE__, \ | |
3808 severity, \ | |
3809 __VA_ARGS__) | |
3810 #else | |
3811 #define RX__PTR_DEFINE_ALIGNMENT_TEST(severity, x, alignment, msg, \ | |
3812 _0, _1, _2, _3, _4, _5, _6, _7) \ | |
3813 rx__ptr_assess_alignment(RX_PARAM_CONTEXT, \ | |
3814 (x), \ | |
3815 (alignment), \ | |
3816 #x, \ | |
3817 __FILE__, \ | |
3818 __LINE__, \ | |
3819 severity, \ | |
3820 msg, \ | |
3821 _0, _1, _2, _3, _4, _5, _6, _7) | |
3822 #endif | |
3823 | |
3824 #define RX_PTR_REQUIRE_ALIGNED(x, alignment) \ | |
3825 RX_PTR_REQUIRE_ALIGNED_MSG(x, alignment, NULL) | |
3826 | |
3827 #if RX__HAS_VARIADIC_MACROS | |
3828 #define RX_PTR_REQUIRE_ALIGNED_MSG(x, alignment, ...) \ | |
3829 RX__PTR_DEFINE_ALIGNMENT_TEST(RX_FATAL, x, alignment, __VA_ARGS__) | |
3830 #else | |
3831 #define RX_PTR_REQUIRE_ALIGNED_MSG(x, alignment, msg) \ | |
3832 RX__PTR_DEFINE_ALIGNMENT_TEST( \ | |
3833 RX_FATAL, x, alignment, msg, \ | |
3834 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) | |
3835 #endif | |
3836 | |
3837 #define RX_PTR_REQUIRE_ALIGNED_MSG_1(x, alignment, msg, \ | |
3838 _0) \ | |
3839 RX__PTR_DEFINE_ALIGNMENT_TEST(RX_FATAL, x, alignment, msg, \ | |
3840 _0, NULL, NULL, NULL, NULL, NULL, NULL, NULL) | |
3841 | |
3842 #define RX_PTR_REQUIRE_ALIGNED_MSG_2(x, alignment, msg, \ | |
3843 _0, _1) \ | |
3844 RX__PTR_DEFINE_ALIGNMENT_TEST(RX_FATAL, x, alignment, msg, \ | |
3845 _0, _1, NULL, NULL, NULL, NULL, NULL, NULL) | |
3846 | |
3847 #define RX_PTR_REQUIRE_ALIGNED_MSG_3(x, alignment, msg, \ | |
3848 _0, _1, _2) \ | |
3849 RX__PTR_DEFINE_ALIGNMENT_TEST(RX_FATAL, x, alignment, msg, \ | |
3850 _0, _1, _2, NULL, NULL, NULL, NULL, NULL) | |
3851 | |
3852 #define RX_PTR_REQUIRE_ALIGNED_MSG_4(x, alignment, msg, \ | |
3853 _0, _1, _2, _3) \ | |
3854 RX__PTR_DEFINE_ALIGNMENT_TEST(RX_FATAL, x, alignment, msg, \ | |
3855 _0, _1, _2, _3, NULL, NULL, NULL, NULL) | |
3856 | |
3857 #define RX_PTR_REQUIRE_ALIGNED_MSG_5(x, alignment, msg, \ | |
3858 _0, _1, _2, _3, _4) \ | |
3859 RX__PTR_DEFINE_ALIGNMENT_TEST(RX_FATAL, x, alignment, msg, \ | |
3860 _0, _1, _2, _3, _4, NULL, NULL, NULL) | |
3861 | |
3862 #define RX_PTR_REQUIRE_ALIGNED_MSG_6(x, alignment, msg, \ | |
3863 _0, _1, _2, _3, _4, _5) \ | |
3864 RX__PTR_DEFINE_ALIGNMENT_TEST(RX_FATAL, x, alignment, msg, \ | |
3865 _0, _1, _2, _3, _4, _5, NULL, NULL) | |
3866 | |
3867 #define RX_PTR_REQUIRE_ALIGNED_MSG_7(x, alignment, msg, \ | |
3868 _0, _1, _2, _3, _4, _5, _6) \ | |
3869 RX__PTR_DEFINE_ALIGNMENT_TEST(RX_FATAL, x, alignment, msg, \ | |
3870 _0, _1, _2, _3, _4, _5, _6, NULL) | |
3871 | |
3872 #define RX_PTR_REQUIRE_ALIGNED_MSG_8(x, alignment, msg, \ | |
3873 _0, _1, _2, _3, _4, _5, _6, _7) \ | |
3874 RX__PTR_DEFINE_ALIGNMENT_TEST(RX_FATAL, x, alignment, msg, \ | |
3875 _0, _1, _2, _3, _4, _5, _6, _7) | |
3876 | |
3877 #define RX_PTR_CHECK_ALIGNED(x, alignment) \ | |
3878 RX_PTR_CHECK_ALIGNED_MSG(x, alignment, NULL) | |
3879 | |
3880 #if RX__HAS_VARIADIC_MACROS | |
3881 #define RX_PTR_CHECK_ALIGNED_MSG(x, alignment, ...) \ | |
3882 RX__PTR_DEFINE_ALIGNMENT_TEST(RX_NONFATAL, x, alignment, __VA_ARGS__) | |
3883 #else | |
3884 #define RX_PTR_CHECK_ALIGNED_MSG(x, alignment, msg) \ | |
3885 RX__PTR_DEFINE_ALIGNMENT_TEST( \ | |
3886 RX_NONFATAL, x, alignment, msg, \ | |
3887 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) | |
3888 #endif | |
3889 | |
3890 #define RX_PTR_CHECK_ALIGNED_MSG_1(x, alignment, msg, \ | |
3891 _0) \ | |
3892 RX__PTR_DEFINE_ALIGNMENT_TEST(RX_NONFATAL, x, alignment, msg, \ | |
3893 _0, NULL, NULL, NULL, NULL, NULL, NULL, NULL) | |
3894 | |
3895 #define RX_PTR_CHECK_ALIGNED_MSG_2(x, alignment, msg, \ | |
3896 _0, _1) \ | |
3897 RX__PTR_DEFINE_ALIGNMENT_TEST(RX_NONFATAL, x, alignment, msg, \ | |
3898 _0, _1, NULL, NULL, NULL, NULL, NULL, NULL) | |
3899 | |
3900 #define RX_PTR_CHECK_ALIGNED_MSG_3(x, alignment, msg, \ | |
3901 _0, _1, _2) \ | |
3902 RX__PTR_DEFINE_ALIGNMENT_TEST(RX_NONFATAL, x, alignment, msg, \ | |
3903 _0, _1, _2, NULL, NULL, NULL, NULL, NULL) | |
3904 | |
3905 #define RX_PTR_CHECK_ALIGNED_MSG_4(x, alignment, msg, \ | |
3906 _0, _1, _2, _3) \ | |
3907 RX__PTR_DEFINE_ALIGNMENT_TEST(RX_NONFATAL, x, alignment, msg, \ | |
3908 _0, _1, _2, _3, NULL, NULL, NULL, NULL) | |
3909 | |
3910 #define RX_PTR_CHECK_ALIGNED_MSG_5(x, alignment, msg, \ | |
3911 _0, _1, _2, _3, _4) \ | |
3912 RX__PTR_DEFINE_ALIGNMENT_TEST(RX_NONFATAL, x, alignment, msg, \ | |
3913 _0, _1, _2, _3, _4, NULL, NULL, NULL) | |
3914 | |
3915 #define RX_PTR_CHECK_ALIGNED_MSG_6(x, alignment, msg, \ | |
3916 _0, _1, _2, _3, _4, _5) \ | |
3917 RX__PTR_DEFINE_ALIGNMENT_TEST(RX_NONFATAL, x, alignment, msg, \ | |
3918 _0, _1, _2, _3, _4, _5, NULL, NULL) | |
3919 | |
3920 #define RX_PTR_CHECK_ALIGNED_MSG_7(x, alignment, msg, \ | |
3921 _0, _1, _2, _3, _4, _5, _6) \ | |
3922 RX__PTR_DEFINE_ALIGNMENT_TEST(RX_NONFATAL, x, alignment, msg, \ | |
3923 _0, _1, _2, _3, _4, _5, _6, NULL) | |
3924 | |
3925 #define RX_PTR_CHECK_ALIGNED_MSG_8(x, alignment, msg, \ | |
3926 _0, _1, _2, _3, _4, _5, _6, _7) \ | |
3927 RX__PTR_DEFINE_ALIGNMENT_TEST(RX_NONFATAL, x, alignment, msg, \ | |
3928 _0, _1, _2, _3, _4, _5, _6, _7) | |
3929 | |
3930 /* Implementation: Helpers O-(''Q) | |
3931 -------------------------------------------------------------------------- */ | |
3932 | |
3933 #if defined(RX_ENABLE_DEBUGGING) \ | |
3934 || (!defined(RX_DISABLE_DEBUGGING) && (defined(DEBUG) || !defined(NDEBUG))) | |
3935 #define RX__DEBUGGING 1 | |
3936 #else | |
3937 #define RX__DEBUGGING 0 | |
3938 #endif | |
3939 | |
3940 #if defined(_WIN32) | |
3941 #define RX__PLATFORM_WINDOWS | |
3942 #elif defined(__unix__) || defined(__APPLE__) | |
3943 #define RX__PLATFORM_UNIX | |
3944 #if defined(__APPLE__) | |
3945 #define RX__PLATFORM_DARWIN | |
3946 #elif defined(__linux__) | |
3947 #define RX__PLATFORM_LINUX | |
3948 #endif | |
3949 #endif | |
3950 | |
3951 #include <ctype.h> | |
3952 #include <setjmp.h> | |
3953 #include <stdarg.h> | |
3954 #include <stddef.h> | |
3955 #include <stdio.h> | |
3956 #include <stdint.h> | |
3957 #include <string.h> | |
3958 | |
3959 #ifndef RX_ASSERT | |
3960 #include <assert.h> | |
3961 #define RX_ASSERT assert | |
3962 #endif | |
3963 | |
3964 #ifndef RX_MALLOC | |
3965 #include <stdlib.h> | |
3966 #define RX_MALLOC malloc | |
3967 #endif | |
3968 | |
3969 #ifndef RX_REALLOC | |
3970 #include <stdlib.h> | |
3971 #define RX_REALLOC realloc | |
3972 #endif | |
3973 | |
3974 #ifndef RX_FREE | |
3975 #include <stdlib.h> | |
3976 #define RX_FREE free | |
3977 #endif | |
3978 | |
3979 #if defined(RX__PLATFORM_WINDOWS) | |
3980 #include <io.h> | |
3981 #define RX__ISATTY _isatty | |
3982 #define RX__FILENO _fileno | |
3983 #else | |
3984 #include <unistd.h> | |
3985 #define RX__ISATTY isatty | |
3986 #define RX__FILENO fileno | |
3987 #endif | |
3988 | |
3989 typedef char rx__invalid_size_type[sizeof(rx_size) == sizeof(size_t) ? 1 : -1]; | |
3990 | |
3991 #define RX__UNUSED(x) (void)(x) | |
3992 | |
3993 #define RX__REQUIRE_SEMICOLON void rx__dummy(void) | |
3994 | |
3995 #define RX__STRINGIFY(x) #x | |
3996 | |
3997 #define RX__EXPAND(x) x | |
3998 | |
3999 #define RX__CONCAT_(a, b) a##b | |
4000 #define RX__CONCAT(a, b) RX__CONCAT_(a, b) | |
4001 | |
4002 #define RX__STRUCT_SET_MEMBER(x) (*obj) x; | |
4003 | |
4004 #define RX__STRUCT_UPDATE_0() | |
4005 | |
4006 #define RX__STRUCT_UPDATE_1(_0) \ | |
4007 RX__STRUCT_SET_MEMBER(_0) | |
4008 | |
4009 #define RX__STRUCT_UPDATE_2(_0, _1) \ | |
4010 RX__STRUCT_SET_MEMBER(_0) \ | |
4011 RX__STRUCT_UPDATE_1(_1) | |
4012 | |
4013 #define RX__STRUCT_UPDATE_3(_0, _1, _2) \ | |
4014 RX__STRUCT_SET_MEMBER(_0) \ | |
4015 RX__STRUCT_UPDATE_2(_1, _2) | |
4016 | |
4017 #define RX__STRUCT_UPDATE_4(_0, _1, _2, _3) \ | |
4018 RX__STRUCT_SET_MEMBER(_0) \ | |
4019 RX__STRUCT_UPDATE_3(_1, _2, _3) | |
4020 | |
4021 #define RX__STRUCT_UPDATE_5(_0, _1, _2, _3, _4) \ | |
4022 RX__STRUCT_SET_MEMBER(_0) \ | |
4023 RX__STRUCT_UPDATE_4(_1, _2, _3, _4) | |
4024 | |
4025 #define RX__STRUCT_UPDATE_6(_0, _1, _2, _3, _4, _5) \ | |
4026 RX__STRUCT_SET_MEMBER(_0) \ | |
4027 RX__STRUCT_UPDATE_5(_1, _2, _3, _4, _5) | |
4028 | |
4029 #define RX__STRUCT_UPDATE_7(_0, _1, _2, _3, _4, _5, _6) \ | |
4030 RX__STRUCT_SET_MEMBER(_0) \ | |
4031 RX__STRUCT_UPDATE_6(_1, _2, _3, _4, _5, _6) | |
4032 | |
4033 #define RX__STRUCT_UPDATE_8(_0, _1, _2, _3, _4, _5, _6, _7) \ | |
4034 RX__STRUCT_SET_MEMBER(_0) \ | |
4035 RX__STRUCT_UPDATE_7(_1, _2, _3, _4, _5, _6, _7) | |
4036 | |
4037 #define RX__STRUCT_DEFINE_UPDATE_FN(id, type, arg_count, args) \ | |
4038 static void \ | |
4039 id(type *obj) \ | |
4040 { \ | |
4041 RX__UNUSED(obj); \ | |
4042 RX__EXPAND(RX__CONCAT(RX__STRUCT_UPDATE_, arg_count) args) \ | |
4043 } | |
4044 | |
4045 #if RX__HAS_VARIADIC_MACROS | |
4046 #define RX__ARG( \ | |
4047 _0, _1, _2, _3, _4, _5, _6, _7, \ | |
4048 _8, ...) _8 | |
4049 | |
4050 #define RX__HAS_AT_LEAST_2_ARGS(...) \ | |
4051 RX__EXPAND(RX__ARG( \ | |
4052 __VA_ARGS__, \ | |
4053 1, 1, 1, 1, 1, 1, 1, 0,)) | |
4054 | |
4055 #define RX__HAS_AT_LEAST_3_ARGS(...) \ | |
4056 RX__EXPAND(RX__ARG( \ | |
4057 __VA_ARGS__, \ | |
4058 1, 1, 1, 1, 1, 1, 0, 0,)) | |
4059 | |
4060 #define RX__COUNT_ARGS(...) \ | |
4061 RX__EXPAND(RX__ARG( \ | |
4062 __VA_ARGS__, \ | |
4063 8, 7, 6, 5, 4, 3, 2, 1, \ | |
4064 0,)) | |
4065 #endif | |
4066 | |
4067 #define RX__FIXTURE_DESC_GET_ID(id) \ | |
4068 rx__fixture_desc_##id | |
4069 #define RX__FIXTURE_GET_UPDATE_FN_ID(id) \ | |
4070 rx__fixture_update_fn_##id | |
4071 | |
4072 #define RX__TEST_SUITE_DESC_GET_ID(id) \ | |
4073 rx__test_suite_desc_##id | |
4074 #define RX__TEST_SUITE_DESC_PTR_GET_ID(id) \ | |
4075 rx__test_suite_desc_ptr_##id | |
4076 | |
4077 #define RX__TEST_CASE_DESC_GET_ID(suite_id, id) \ | |
4078 rx__test_case_desc_##suite_id##_##id | |
4079 #define RX__TEST_CASE_DESC_PTR_GET_ID(suite_id, id) \ | |
4080 rx__test_case_desc_ptr_##suite_id##_##id | |
4081 | |
4082 #define RX__TEST_CASE_CONFIG_DESC_GET_ID(id) \ | |
4083 rx__test_case_config_desc_##id | |
4084 #define RX__TEST_CASE_CONFIG_BLUEPRINT_GET_UPDATE_FN_ID(id) \ | |
4085 rx__test_case_config_blueprint_update_fn_##id | |
4086 | |
4087 typedef intmax_t rx__int; | |
4088 typedef uintmax_t rx__uint; | |
4089 typedef long double rx__real; | |
4090 | |
4091 struct rx_context { | |
4092 jmp_buf env; | |
4093 struct rx_summary *summary; | |
4094 }; | |
4095 | |
4096 /* Implementation: Logger O-(''Q) | |
4097 -------------------------------------------------------------------------- */ | |
4098 | |
4099 #if !defined(RX_DISABLE_LOG_STYLING) \ | |
4100 && defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 1 | |
4101 #define RX__LOG_STYLING 1 | |
4102 #else | |
4103 #define RX__LOG_STYLING 0 | |
4104 #endif | |
4105 | |
4106 #if defined(RX_SET_LOGGING_LEVEL_ALL) | |
4107 #define RX__LOGGING_LEVEL RX_LOG_LEVEL_ALL | |
4108 #elif defined(RX_SET_LOGGING_LEVEL_DEBUG) | |
4109 #define RX__LOGGING_LEVEL RX_LOG_LEVEL_DEBUG | |
4110 #elif defined(RX_SET_LOGGING_LEVEL_INFO) | |
4111 #define RX__LOGGING_LEVEL RX_LOG_LEVEL_INFO | |
4112 #elif defined(RX_SET_LOGGING_LEVEL_WARNING) | |
4113 #define RX__LOGGING_LEVEL RX_LOG_LEVEL_WARNING | |
4114 #elif defined(RX_SET_LOGGING_LEVEL_ERROR) | |
4115 #define RX__LOGGING_LEVEL RX_LOG_LEVEL_ERROR | |
4116 #elif defined(RX_SET_LOGGING_LEVEL_FATAL) | |
4117 #define RX__LOGGING_LEVEL RX_LOG_LEVEL_FATAL | |
4118 #elif defined(RX_SET_LOGGING_LEVEL_NONDE) | |
4119 #define RX__LOGGING_LEVEL RX_LOG_LEVEL_NONE | |
4120 #elif RX__DEBUGGING | |
4121 #define RX__LOGGING_LEVEL RX_LOG_LEVEL_DEBUG | |
4122 #else | |
4123 #define RX__LOGGING_LEVEL RX_LOG_LEVEL_WARNING | |
4124 #endif | |
4125 | |
4126 #if defined(RX_DISABLE_LOGGING) | |
4127 #define RX__LOGGING 0 | |
4128 #else | |
4129 #define RX__LOGGING 1 | |
4130 #endif | |
4131 | |
4132 #ifndef RX_LOG | |
4133 #define RX_LOG rx__log | |
4134 #endif | |
4135 | |
4136 #if defined(_MSC_VER) | |
4137 #define RX__LOG(level, args) \ | |
4138 do { \ | |
4139 _Pragma("warning(push)") \ | |
4140 _Pragma("warning(disable : 4127)") \ | |
4141 if (RX__LOGGING && (level) <= RX__LOGGING_LEVEL) { \ | |
4142 RX_LOG args; \ | |
4143 } \ | |
4144 _Pragma("warning(pop)") \ | |
4145 } while (0) | |
4146 #elif defined(__GNUC__) | |
4147 #define RX__LOG(level, args) \ | |
4148 do { \ | |
4149 _Pragma("GCC diagnostic push") \ | |
4150 _Pragma("GCC diagnostic ignored \"-Wtautological-compare\"") \ | |
4151 if (RX__LOGGING && (level) <= RX__LOGGING_LEVEL) { \ | |
4152 RX_LOG args; \ | |
4153 } \ | |
4154 _Pragma("GCC diagnostic pop") \ | |
4155 } while (0) | |
4156 #else | |
4157 #define RX__LOG(level, args) \ | |
4158 do { \ | |
4159 if (RX__LOGGING && (level) <= RX__LOGGING_LEVEL) { \ | |
4160 RX_LOG args; \ | |
4161 } \ | |
4162 } while (0) | |
4163 #endif | |
4164 | |
4165 #define RX__LOG_DEBUG(msg) \ | |
4166 RX__LOG(RX_LOG_LEVEL_DEBUG, \ | |
4167 (RX_LOG_LEVEL_DEBUG, __FILE__, __LINE__, msg)) | |
4168 #define RX__LOG_DEBUG_1(fmt, _0) \ | |
4169 RX__LOG(RX_LOG_LEVEL_DEBUG, \ | |
4170 (RX_LOG_LEVEL_DEBUG, __FILE__, __LINE__, fmt, _0)) | |
4171 #define RX__LOG_DEBUG_2(fmt, _0, _1) \ | |
4172 RX__LOG(RX_LOG_LEVEL_DEBUG, \ | |
4173 (RX_LOG_LEVEL_DEBUG, __FILE__, __LINE__, fmt, _0, _1)) | |
4174 | |
4175 #define RX__LOG_INFO(msg) \ | |
4176 RX__LOG(RX_LOG_LEVEL_INFO, \ | |
4177 (RX_LOG_LEVEL_INFO, __FILE__, __LINE__, msg)) | |
4178 #define RX__LOG_INFO_1(fmt, _0) \ | |
4179 RX__LOG(RX_LOG_LEVEL_INFO, \ | |
4180 (RX_LOG_LEVEL_INFO, __FILE__, __LINE__, fmt, _0)) | |
4181 #define RX__LOG_INFO_2(fmt, _0, _1) \ | |
4182 RX__LOG(RX_LOG_LEVEL_INFO, \ | |
4183 (RX_LOG_LEVEL_INFO, __FILE__, __LINE__, fmt, _0, _1)) | |
4184 | |
4185 #define RX__LOG_WARNING(msg) \ | |
4186 RX__LOG(RX_LOG_LEVEL_WARNING, \ | |
4187 (RX_LOG_LEVEL_WARNING, __FILE__, __LINE__, msg)) | |
4188 #define RX__LOG_WARNING_1(fmt, _0) \ | |
4189 RX__LOG(RX_LOG_LEVEL_WARNING, \ | |
4190 (RX_LOG_LEVEL_WARNING, __FILE__, __LINE__, fmt, _0)) | |
4191 #define RX__LOG_WARNING_2(fmt, _0, _1) \ | |
4192 RX__LOG(RX_LOG_LEVEL_WARNING, \ | |
4193 (RX_LOG_LEVEL_WARNING, __FILE__, __LINE__, fmt, _0, _1)) | |
4194 | |
4195 #define RX__LOG_ERROR(msg) \ | |
4196 RX__LOG(RX_LOG_LEVEL_ERROR, \ | |
4197 (RX_LOG_LEVEL_ERROR, __FILE__, __LINE__, msg)) | |
4198 #define RX__LOG_ERROR_1(fmt, _0) \ | |
4199 RX__LOG(RX_LOG_LEVEL_ERROR, \ | |
4200 (RX_LOG_LEVEL_ERROR, __FILE__, __LINE__, fmt, _0)) | |
4201 #define RX__LOG_ERROR_2(fmt, _0, _1) \ | |
4202 RX__LOG(RX_LOG_LEVEL_ERROR, \ | |
4203 (RX_LOG_LEVEL_ERROR, __FILE__, __LINE__, fmt, _0, _1)) | |
4204 | |
4205 #define RX__LOG_FATAL(msg) \ | |
4206 RX__LOG(RX_LOG_LEVEL_FATAL, \ | |
4207 (RX_LOG_LEVEL_FATAL, __FILE__, __LINE__, msg)) | |
4208 #define RX__LOG_FATAL_1(fmt, _0) \ | |
4209 RX__LOG(RX_LOG_LEVEL_FATAL, \ | |
4210 (RX_LOG_LEVEL_FATAL, __FILE__, __LINE__, fmt, _0)) | |
4211 #define RX__LOG_FATAL_2(fmt, _0, _1) \ | |
4212 RX__LOG(RX_LOG_LEVEL_FATAL, \ | |
4213 (RX_LOG_LEVEL_FATAL, __FILE__, __LINE__, fmt, _0, _1)) | |
4214 | |
4215 #if RX__LOG_STYLING | |
4216 enum rx__log_style { | |
4217 RX__LOG_STYLE_RESET = 0, | |
4218 RX__LOG_STYLE_BLACK = 1, | |
4219 RX__LOG_STYLE_RED = 2, | |
4220 RX__LOG_STYLE_GREEN = 3, | |
4221 RX__LOG_STYLE_YELLOW = 4, | |
4222 RX__LOG_STYLE_BLUE = 5, | |
4223 RX__LOG_STYLE_MAGENTA = 6, | |
4224 RX__LOG_STYLE_CYAN = 7, | |
4225 RX__LOG_STYLE_BRIGHT_BLACK = 8, | |
4226 RX__LOG_STYLE_BRIGHT_RED = 9, | |
4227 RX__LOG_STYLE_BRIGHT_GREEN = 10, | |
4228 RX__LOG_STYLE_BRIGHT_YELLOW = 11, | |
4229 RX__LOG_STYLE_BRIGHT_BLUE = 12, | |
4230 RX__LOG_STYLE_BRIGHT_MAGENTA = 13, | |
4231 RX__LOG_STYLE_BRIGHT_CYAN = 14 | |
4232 }; | |
4233 #endif | |
4234 | |
4235 static void | |
4236 rx__log_level_get_name(const char **name, enum rx_log_level level) | |
4237 { | |
4238 RX_ASSERT(name != NULL); | |
4239 | |
4240 switch (level) { | |
4241 case RX_LOG_LEVEL_FATAL: | |
4242 *name = "fatal"; | |
4243 return; | |
4244 case RX_LOG_LEVEL_ERROR: | |
4245 *name = "error"; | |
4246 return; | |
4247 case RX_LOG_LEVEL_WARNING: | |
4248 *name = "warning"; | |
4249 return; | |
4250 case RX_LOG_LEVEL_INFO: | |
4251 *name = "info"; | |
4252 return; | |
4253 case RX_LOG_LEVEL_DEBUG: | |
4254 *name = "debug"; | |
4255 return; | |
4256 default: | |
4257 RX_ASSERT(0); | |
4258 } | |
4259 } | |
4260 | |
4261 #if RX__LOG_STYLING | |
4262 static void | |
4263 rx__log_level_get_style(enum rx__log_style *style, enum rx_log_level level) | |
4264 { | |
4265 RX_ASSERT(style != NULL); | |
4266 | |
4267 switch (level) { | |
4268 case RX_LOG_LEVEL_FATAL: | |
4269 *style = RX__LOG_STYLE_BRIGHT_MAGENTA; | |
4270 return; | |
4271 case RX_LOG_LEVEL_ERROR: | |
4272 *style = RX__LOG_STYLE_BRIGHT_RED; | |
4273 return; | |
4274 case RX_LOG_LEVEL_WARNING: | |
4275 *style = RX__LOG_STYLE_BRIGHT_YELLOW; | |
4276 return; | |
4277 case RX_LOG_LEVEL_INFO: | |
4278 *style = RX__LOG_STYLE_BRIGHT_GREEN; | |
4279 return; | |
4280 case RX_LOG_LEVEL_DEBUG: | |
4281 *style = RX__LOG_STYLE_BRIGHT_CYAN; | |
4282 return; | |
4283 default: | |
4284 RX_ASSERT(0); | |
4285 }; | |
4286 } | |
4287 | |
4288 static void | |
4289 rx__log_style_get_ansi_code(const char **code, enum rx__log_style style) | |
4290 { | |
4291 RX_ASSERT(code != NULL); | |
4292 | |
4293 switch (style) { | |
4294 case RX__LOG_STYLE_RESET: | |
4295 *code = "\x1b[0m"; | |
4296 return; | |
4297 case RX__LOG_STYLE_BLACK: | |
4298 *code = "\x1b[30m"; | |
4299 return; | |
4300 case RX__LOG_STYLE_RED: | |
4301 *code = "\x1b[31m"; | |
4302 return; | |
4303 case RX__LOG_STYLE_GREEN: | |
4304 *code = "\x1b[32m"; | |
4305 return; | |
4306 case RX__LOG_STYLE_YELLOW: | |
4307 *code = "\x1b[33m"; | |
4308 return; | |
4309 case RX__LOG_STYLE_BLUE: | |
4310 *code = "\x1b[34m"; | |
4311 return; | |
4312 case RX__LOG_STYLE_MAGENTA: | |
4313 *code = "\x1b[35m"; | |
4314 return; | |
4315 case RX__LOG_STYLE_CYAN: | |
4316 *code = "\x1b[36m"; | |
4317 return; | |
4318 case RX__LOG_STYLE_BRIGHT_BLACK: | |
4319 *code = "\x1b[1;30m"; | |
4320 return; | |
4321 case RX__LOG_STYLE_BRIGHT_RED: | |
4322 *code = "\x1b[1;31m"; | |
4323 return; | |
4324 case RX__LOG_STYLE_BRIGHT_GREEN: | |
4325 *code = "\x1b[1;32m"; | |
4326 return; | |
4327 case RX__LOG_STYLE_BRIGHT_YELLOW: | |
4328 *code = "\x1b[1;33m"; | |
4329 return; | |
4330 case RX__LOG_STYLE_BRIGHT_BLUE: | |
4331 *code = "\x1b[1;34m"; | |
4332 return; | |
4333 case RX__LOG_STYLE_BRIGHT_MAGENTA: | |
4334 *code = "\x1b[1;35m"; | |
4335 return; | |
4336 case RX__LOG_STYLE_BRIGHT_CYAN: | |
4337 *code = "\x1b[1;36m"; | |
4338 return; | |
4339 default: | |
4340 RX_ASSERT(0); | |
4341 } | |
4342 } | |
4343 #endif /* RX__LOG_STYLING */ | |
4344 | |
4345 RX__PRINTF_CHECK(4, 5) | |
4346 static void | |
4347 rx__log(enum rx_log_level level, | |
4348 const char *file, | |
4349 int line, | |
4350 const char *fmt, | |
4351 ...) | |
4352 { | |
4353 const char *level_name; | |
4354 const char *level_style_begin; | |
4355 const char *level_style_end; | |
4356 va_list args; | |
4357 | |
4358 RX_ASSERT(file != NULL); | |
4359 RX_ASSERT(fmt != NULL); | |
4360 | |
4361 rx__log_level_get_name(&level_name, level); | |
4362 | |
4363 #if RX__LOG_STYLING | |
4364 if (RX__ISATTY(RX__FILENO(stderr))) { | |
4365 enum rx__log_style level_style; | |
4366 | |
4367 rx__log_level_get_style(&level_style, level); | |
4368 rx__log_style_get_ansi_code(&level_style_begin, level_style); | |
4369 rx__log_style_get_ansi_code(&level_style_end, RX__LOG_STYLE_RESET); | |
4370 } else { | |
4371 level_style_begin = level_style_end = ""; | |
4372 } | |
4373 #else | |
4374 level_style_begin = level_style_end = ""; | |
4375 #endif | |
4376 | |
4377 va_start(args, fmt); | |
4378 fprintf(stderr, | |
4379 "%s:%d: %s%s%s: ", | |
4380 file, | |
4381 line, | |
4382 level_style_begin, | |
4383 level_name, | |
4384 level_style_end); | |
4385 vfprintf(stderr, fmt, args); | |
4386 va_end(args); | |
4387 } | |
4388 | |
4389 /* Implementation: Timer O-(''Q) | |
4390 -------------------------------------------------------------------------- */ | |
4391 | |
4392 #define RX__TICKS_PER_SECOND 1000000000ul | |
4393 #define RX__TICKS_PER_MICROSECOND 1000ul | |
4394 | |
4395 #if defined(RX__PLATFORM_WINDOWS) | |
4396 #define WIN32_LEAN_AND_MEAN | |
4397 #include <windows.h> | |
4398 #elif defined(RX__PLATFORM_DARWIN) | |
4399 #include <mach/mach_time.h> | |
4400 #include <sys/resource.h> | |
4401 #elif defined(RX__PLATFORM_UNIX) | |
4402 #include <sys/resource.h> | |
4403 #if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 199309L | |
4404 #include <time.h> | |
4405 #define RX__USE_CLOCK_GETTIME | |
4406 #if defined(CLOCK_MONOTONIC_RAW) | |
4407 #define RX__CLOCK_ID CLOCK_MONOTONIC_RAW | |
4408 #elif defined(CLOCK_MONOTONIC) | |
4409 #define RX__CLOCK_ID CLOCK_MONOTONIC | |
4410 #else | |
4411 #define RX__CLOCK_ID CLOCK_REALTIME | |
4412 #endif | |
4413 #else | |
4414 #include <sys/time.h> | |
4415 #endif | |
4416 #else | |
4417 typedef char rx__unsupported_platform[-1]; | |
4418 #endif | |
4419 | |
4420 static enum rx_status | |
4421 rx__get_real_time(uint64_t *time) | |
4422 { | |
4423 RX_ASSERT(time != NULL); | |
4424 | |
4425 #if defined(RX__PLATFORM_WINDOWS) | |
4426 { | |
4427 static double time_to_nano; | |
4428 LARGE_INTEGER counter; | |
4429 | |
4430 if (time_to_nano == 0.0) { | |
4431 LARGE_INTEGER frequency; | |
4432 | |
4433 if (!QueryPerformanceFrequency(&frequency)) { | |
4434 RX__LOG_DEBUG("failed to retrieve the timer's frequency\n"); | |
4435 return RX_ERROR; | |
4436 } | |
4437 | |
4438 time_to_nano = (double)RX__TICKS_PER_SECOND / frequency.QuadPart; | |
4439 } | |
4440 | |
4441 if (!QueryPerformanceCounter(&counter)) { | |
4442 RX__LOG_DEBUG("failed to retrieve the current time\n"); | |
4443 return RX_ERROR; | |
4444 } | |
4445 | |
4446 *time = (uint64_t)(counter.QuadPart * time_to_nano); | |
4447 return RX_SUCCESS; | |
4448 } | |
4449 #elif defined(RX__PLATFORM_DARWIN) | |
4450 /* | |
4451 Since Darwin 5.2, `clock_gettime()` can return high resolution times | |
4452 with the `CLOCK_UPTIME_RAW` clock but it internally only calls | |
4453 `mach_absolute_time()` with the overhead of converting the result into | |
4454 the `timespec` format. | |
4455 */ | |
4456 { | |
4457 static uint64_t time_to_nano; | |
4458 | |
4459 if (time_to_nano == 0) { | |
4460 mach_timebase_info_data_t info; | |
4461 | |
4462 if (mach_timebase_info(&info) != KERN_SUCCESS) { | |
4463 RX__LOG_DEBUG("failed to retrieve the current time\n"); | |
4464 return RX_ERROR; | |
4465 } | |
4466 | |
4467 time_to_nano = info.numer / info.denom; | |
4468 } | |
4469 | |
4470 *time = mach_absolute_time() * time_to_nano; | |
4471 return RX_SUCCESS; | |
4472 } | |
4473 #elif defined(RX__PLATFORM_UNIX) | |
4474 #if defined(RX__USE_CLOCK_GETTIME) | |
4475 { | |
4476 struct timespec t; | |
4477 | |
4478 if (clock_gettime(RX__CLOCK_ID, &t) != 0) { | |
4479 RX__LOG_DEBUG("failed to retrieve the current time\n"); | |
4480 return RX_ERROR; | |
4481 } | |
4482 | |
4483 *time = (uint64_t)t.tv_sec * RX__TICKS_PER_SECOND + (uint64_t)t.tv_nsec; | |
4484 return RX_SUCCESS; | |
4485 } | |
4486 #else | |
4487 { | |
4488 struct timeval t; | |
4489 | |
4490 if (gettimeofday(&t, NULL) != 0) { | |
4491 RX__LOG_DEBUG("failed to retrieve the current time\n"); | |
4492 return RX_ERROR; | |
4493 } | |
4494 | |
4495 *time = (uint64_t)t.tv_sec * RX__TICKS_PER_SECOND | |
4496 + (uint64_t)t.tv_usec * RX__TICKS_PER_MICROSECOND; | |
4497 return RX_SUCCESS; | |
4498 } | |
4499 #endif | |
4500 #else | |
4501 RX__LOG_DEBUG("platform not supported\n"); | |
4502 return RX_ERROR; | |
4503 #endif | |
4504 } | |
4505 | |
4506 /* Implementation: Test Failure Array O-(''Q) | |
4507 -------------------------------------------------------------------------- */ | |
4508 | |
4509 /* | |
4510 Simple implementation for dynamic arrays that can grow and stretch at | |
4511 runtime. The object returned to the user is a standard pointer to a C array | |
4512 but the implementation also allocates a header to keep track of the size | |
4513 and the capacity. | |
4514 | |
4515 The memory layout is better represented by the diagram below. | |
4516 | |
4517 block user pointer | |
4518 / / | |
4519 +--------+--------+ | |
4520 | header | buffer | | |
4521 +--------+--------+ | |
4522 | |
4523 The block points to the whole memory being allocated while the buffer | |
4524 represents the actual array exposed to the user. | |
4525 */ | |
4526 | |
4527 #define RX__DYN_ARRAY_GET_BLOCK(buf) \ | |
4528 ((void *)&((struct rx__dyn_array_header *)(buf))[-1]) | |
4529 #define RX__DYN_ARRAY_GET_HEADER(block) \ | |
4530 ((struct rx__dyn_array_header *)(block)) | |
4531 #define RX__DYN_ARRAY_GET_BUFFER(block) \ | |
4532 ((void *)&((struct rx__dyn_array_header *)(block))[1]) | |
4533 #define RX__DYN_ARRAY_GET_CONST_BLOCK(buf) \ | |
4534 ((const void *)&((const struct rx__dyn_array_header *)(buf))[-1]) | |
4535 #define RX__DYN_ARRAY_GET_CONST_HEADER(block) \ | |
4536 ((const struct rx__dyn_array_header *)(block)) | |
4537 | |
4538 struct rx__dyn_array_header { | |
4539 size_t size; | |
4540 size_t capacity; | |
4541 }; | |
4542 | |
4543 static const size_t rx__test_failure_array_max_capacity | |
4544 = (((size_t)-1 - sizeof(struct rx__dyn_array_header)) | |
4545 / sizeof(struct rx_failure)); | |
4546 | |
4547 static void | |
4548 rx__dyn_array_get_new_capacity(size_t *capacity, | |
4549 size_t current, | |
4550 size_t requested, | |
4551 size_t max) | |
4552 { | |
4553 *capacity = current + current / 2 + 1; | |
4554 if (*capacity < current) { | |
4555 *capacity = max; | |
4556 return; | |
4557 } | |
4558 | |
4559 if (*capacity < requested) { | |
4560 *capacity = requested; | |
4561 } | |
4562 } | |
4563 | |
4564 static enum rx_status | |
4565 rx__dyn_array_ensure_has_enough_capacity(void **block, | |
4566 size_t current_capacity, | |
4567 size_t requested_capacity, | |
4568 size_t max_capacity, | |
4569 size_t element_size) | |
4570 { | |
4571 void *buf; | |
4572 size_t new_capacity; | |
4573 | |
4574 RX_ASSERT(block != NULL); | |
4575 RX_ASSERT(element_size > 0); | |
4576 | |
4577 if (requested_capacity > max_capacity) { | |
4578 RX__LOG_DEBUG("the requested capacity is too large\n"); | |
4579 return RX_ERROR_MAX_SIZE_EXCEEDED; | |
4580 } | |
4581 | |
4582 if (*block != NULL && current_capacity >= requested_capacity) { | |
4583 return RX_SUCCESS; | |
4584 } | |
4585 | |
4586 rx__dyn_array_get_new_capacity( | |
4587 &new_capacity, current_capacity, requested_capacity, max_capacity); | |
4588 RX_ASSERT(new_capacity >= requested_capacity); | |
4589 RX_ASSERT(new_capacity <= max_capacity); | |
4590 | |
4591 buf = RX_REALLOC( | |
4592 *block, | |
4593 sizeof(struct rx__dyn_array_header) + element_size * new_capacity); | |
4594 if (buf == NULL) { | |
4595 RX__LOG_DEBUG("failed to reallocate the block\n"); | |
4596 return RX_ERROR_ALLOCATION; | |
4597 } | |
4598 | |
4599 RX__DYN_ARRAY_GET_HEADER(buf)->capacity = new_capacity; | |
4600 *block = buf; | |
4601 return RX_SUCCESS; | |
4602 } | |
4603 | |
4604 static enum rx_status | |
4605 rx__test_failure_array_create(struct rx_failure **array, size_t size) | |
4606 { | |
4607 void *block; | |
4608 size_t capacity; | |
4609 | |
4610 RX_ASSERT(array != NULL); | |
4611 | |
4612 rx__dyn_array_get_new_capacity( | |
4613 &capacity, 0, size, rx__test_failure_array_max_capacity); | |
4614 RX_ASSERT(capacity >= size); | |
4615 RX_ASSERT(capacity <= rx__test_failure_array_max_capacity); | |
4616 | |
4617 block = RX_MALLOC(sizeof(struct rx__dyn_array_header) | |
4618 + sizeof(struct rx_failure) * capacity); | |
4619 if (block == NULL) { | |
4620 RX__LOG_DEBUG_1("failed to reserve a large enough capacity for " | |
4621 "the test failure array (requested capacity: %lu)\n", | |
4622 (unsigned long)size); | |
4623 return RX_ERROR_ALLOCATION; | |
4624 } | |
4625 | |
4626 RX__DYN_ARRAY_GET_HEADER(block)->size = size; | |
4627 RX__DYN_ARRAY_GET_HEADER(block)->capacity = capacity; | |
4628 *array = (struct rx_failure *)RX__DYN_ARRAY_GET_BUFFER(block); | |
4629 return RX_SUCCESS; | |
4630 } | |
4631 | |
4632 static void | |
4633 rx__test_failure_array_destroy(struct rx_failure *array) | |
4634 { | |
4635 RX_FREE(RX__DYN_ARRAY_GET_BLOCK(array)); | |
4636 } | |
4637 | |
4638 static void | |
4639 rx__test_failure_array_get_size(size_t *size, const struct rx_failure *array) | |
4640 { | |
4641 RX_ASSERT(array != NULL); | |
4642 | |
4643 *size = RX__DYN_ARRAY_GET_CONST_HEADER(RX__DYN_ARRAY_GET_CONST_BLOCK(array)) | |
4644 ->size; | |
4645 } | |
4646 | |
4647 static enum rx_status | |
4648 rx__test_failure_array_extend_back(struct rx_failure **slice, | |
4649 struct rx_failure **array, | |
4650 size_t size) | |
4651 { | |
4652 enum rx_status status; | |
4653 void *block; | |
4654 size_t pos; | |
4655 | |
4656 RX_ASSERT(array != NULL); | |
4657 RX_ASSERT(*array != NULL); | |
4658 | |
4659 block = RX__DYN_ARRAY_GET_BLOCK(*array); | |
4660 status = rx__dyn_array_ensure_has_enough_capacity( | |
4661 &block, | |
4662 RX__DYN_ARRAY_GET_HEADER(block)->capacity, | |
4663 RX__DYN_ARRAY_GET_HEADER(block)->size + size, | |
4664 rx__test_failure_array_max_capacity, | |
4665 sizeof(struct rx_failure)); | |
4666 if (status != RX_SUCCESS) { | |
4667 RX__LOG_DEBUG_1( | |
4668 "failed to reserve a large enough capacity for " | |
4669 "the test failure array (requested capacity: %lu)\n", | |
4670 (unsigned long)RX__DYN_ARRAY_GET_HEADER(block)->size + size); | |
4671 return status; | |
4672 } | |
4673 | |
4674 RX_ASSERT(block != NULL); | |
4675 | |
4676 *array = (struct rx_failure *)RX__DYN_ARRAY_GET_BUFFER(block); | |
4677 | |
4678 pos = RX__DYN_ARRAY_GET_HEADER(block)->size; | |
4679 memmove(&(*array)[pos + size], | |
4680 &(*array)[pos], | |
4681 sizeof(struct rx_failure) | |
4682 * (RX__DYN_ARRAY_GET_HEADER(block)->size - pos)); | |
4683 | |
4684 if (slice != NULL) { | |
4685 *slice = &(*array)[pos]; | |
4686 } | |
4687 | |
4688 RX__DYN_ARRAY_GET_HEADER(block)->size += size; | |
4689 return RX_SUCCESS; | |
4690 } | |
4691 | |
4692 /* Implementation: Memory Sections O-(''Q) | |
4693 -------------------------------------------------------------------------- */ | |
4694 | |
4695 /* | |
4696 Compiler-specific code that allows grouping objects into specific | |
4697 data sections, thus enabling automatic discovery by iterating over | |
4698 anything registered in these sections. | |
4699 */ | |
4700 | |
4701 #if defined(_MSC_VER) | |
4702 __pragma(section("rxsuite$a", read)) | |
4703 __pragma(section("rxsuite$b", read)) | |
4704 __pragma(section("rxsuite$c", read)) | |
4705 | |
4706 __declspec(allocate("rxsuite$a")) | |
4707 const struct rx__test_suite_desc * const rx__test_suite_section_begin | |
4708 = NULL; | |
4709 | |
4710 __declspec(allocate("rxsuite$c")) | |
4711 const struct rx__test_suite_desc * const rx__test_suite_section_end | |
4712 = NULL; | |
4713 | |
4714 #define RX__TEST_SUITE_REGISTER(name) \ | |
4715 __declspec(allocate("rxsuite$b")) \ | |
4716 const struct rx__test_suite_desc * const \ | |
4717 RX__TEST_SUITE_DESC_PTR_GET_ID(name) \ | |
4718 = &RX__TEST_SUITE_DESC_GET_ID(name) | |
4719 | |
4720 #define RX__TEST_SUITE_SECTION_BEGIN (&rx__test_suite_section_begin + 1) | |
4721 #define RX__TEST_SUITE_SECTION_END (&rx__test_suite_section_end) | |
4722 #else | |
4723 #if defined(RX__PLATFORM_DARWIN) | |
4724 extern const struct rx__test_suite_desc * const __start_rxsuite \ | |
4725 __asm("section$start$__DATA$rxsuite"); | |
4726 extern const struct rx__test_suite_desc * const __stop_rxsuite \ | |
4727 __asm("section$end$__DATA$rxsuite"); | |
4728 | |
4729 #define RX__TEST_SUITE_SECTION \ | |
4730 __attribute__((used,section("__DATA,rxsuite"))) | |
4731 #else | |
4732 extern const struct rx__test_suite_desc * const __start_rxsuite; | |
4733 extern const struct rx__test_suite_desc * const __stop_rxsuite; | |
4734 | |
4735 #define RX__TEST_SUITE_SECTION \ | |
4736 __attribute__((used,section("rxsuite"))) | |
4737 #endif | |
4738 | |
4739 RX__TEST_SUITE_SECTION | |
4740 static const struct rx__test_suite_desc * const rx__dummy_suite = NULL; | |
4741 | |
4742 #define RX__TEST_SUITE_REGISTER(name) \ | |
4743 RX__TEST_SUITE_SECTION \ | |
4744 const struct rx__test_suite_desc * const \ | |
4745 RX__TEST_SUITE_DESC_PTR_GET_ID(name) \ | |
4746 = &RX__TEST_SUITE_DESC_GET_ID(name) | |
4747 | |
4748 #define RX__TEST_SUITE_SECTION_BEGIN (&__start_rxsuite) | |
4749 #define RX__TEST_SUITE_SECTION_END (&__stop_rxsuite) | |
4750 #endif | |
4751 | |
4752 #if defined(_MSC_VER) | |
4753 __pragma(section("rxcase$a", read)) | |
4754 __pragma(section("rxcase$b", read)) | |
4755 __pragma(section("rxcase$c", read)) | |
4756 | |
4757 __declspec(allocate("rxcase$a")) | |
4758 const struct rx__test_case_desc * const rx__test_case_section_begin | |
4759 = NULL; | |
4760 | |
4761 __declspec(allocate("rxcase$c")) | |
4762 const struct rx__test_case_desc * const rx__test_case_section_end | |
4763 = NULL; | |
4764 | |
4765 #define RX__TEST_CASE_REGISTER(suite_name, name) \ | |
4766 __declspec(allocate("rxcase$b")) \ | |
4767 const struct rx__test_case_desc * const \ | |
4768 RX__TEST_CASE_DESC_PTR_GET_ID(suite_name, name) \ | |
4769 = &RX__TEST_CASE_DESC_GET_ID(suite_name, name) | |
4770 | |
4771 #define RX__TEST_CASE_SECTION_BEGIN (&rx__test_case_section_begin + 1) | |
4772 #define RX__TEST_CASE_SECTION_END (&rx__test_case_section_end) | |
4773 #else | |
4774 #if defined(RX__PLATFORM_DARWIN) | |
4775 extern const struct rx__test_case_desc * const __start_rxcase \ | |
4776 __asm("section$start$__DATA$rxcase"); | |
4777 extern const struct rx__test_case_desc * const __stop_rxcase \ | |
4778 __asm("section$end$__DATA$rxcase"); | |
4779 | |
4780 #define RX__TEST_CASE_SECTION \ | |
4781 __attribute__((used,section("__DATA,rxcase"))) | |
4782 #else | |
4783 extern const struct rx__test_case_desc * const __start_rxcase; | |
4784 extern const struct rx__test_case_desc * const __stop_rxcase; | |
4785 | |
4786 #define RX__TEST_CASE_SECTION \ | |
4787 __attribute__((used,section("rxcase"))) | |
4788 #endif | |
4789 | |
4790 RX__TEST_CASE_SECTION | |
4791 static const struct rx__test_case_desc * const rx__dummy_case = NULL; | |
4792 | |
4793 #define RX__TEST_CASE_REGISTER(suite_name, name) \ | |
4794 RX__TEST_CASE_SECTION \ | |
4795 const struct rx__test_case_desc * const \ | |
4796 RX__TEST_CASE_DESC_PTR_GET_ID(suite_name, name) \ | |
4797 = &RX__TEST_CASE_DESC_GET_ID(suite_name, name) | |
4798 | |
4799 #define RX__TEST_CASE_SECTION_BEGIN (&__start_rxcase) | |
4800 #define RX__TEST_CASE_SECTION_END (&__stop_rxcase) | |
4801 #endif | |
4802 | |
4803 /* Implementation: Fixture O-(''Q) | |
4804 -------------------------------------------------------------------------- */ | |
4805 | |
4806 typedef void (*rx__fixture_config_update_fn)( | |
4807 struct rx_fixture_config *); | |
4808 | |
4809 struct rx__fixture_desc { | |
4810 rx_size size; | |
4811 const rx__fixture_config_update_fn update; | |
4812 }; | |
4813 | |
4814 #define RX__FIXTURE_(id, size, update_fn) \ | |
4815 static const struct rx__fixture_desc \ | |
4816 RX__FIXTURE_DESC_GET_ID(id) \ | |
4817 = {size, update_fn}; \ | |
4818 \ | |
4819 static const struct rx__fixture_desc \ | |
4820 *id = &RX__FIXTURE_DESC_GET_ID(id); | |
4821 | |
4822 #define RX__FIXTURE_0(id, size) \ | |
4823 RX__FIXTURE_(id, size, NULL) | |
4824 | |
4825 #define RX__FIXTURE_1(id, size, arg_count, args) \ | |
4826 RX__STRUCT_DEFINE_UPDATE_FN( \ | |
4827 RX__FIXTURE_GET_UPDATE_FN_ID(id), \ | |
4828 struct rx_fixture_config, \ | |
4829 arg_count, \ | |
4830 args) \ | |
4831 \ | |
4832 RX__FIXTURE_(id, size, &RX__FIXTURE_GET_UPDATE_FN_ID(id)) | |
4833 | |
4834 /* Implementation: Test Case Config O-(''Q) | |
4835 -------------------------------------------------------------------------- */ | |
4836 | |
4837 struct rx__test_case_config_blueprint { | |
4838 int skip; | |
4839 const struct rx__fixture_desc *fixture; | |
4840 }; | |
4841 | |
4842 typedef void (*rx__test_case_config_blueprint_update_fn)( | |
4843 struct rx__test_case_config_blueprint *); | |
4844 | |
4845 struct rx__test_case_config_desc { | |
4846 const rx__test_case_config_blueprint_update_fn update; | |
4847 }; | |
4848 | |
4849 #define RX__TEST_CASE_CONFIG(id, arg_count, args) \ | |
4850 RX__STRUCT_DEFINE_UPDATE_FN( \ | |
4851 RX__TEST_CASE_CONFIG_BLUEPRINT_GET_UPDATE_FN_ID(id), \ | |
4852 struct rx__test_case_config_blueprint, \ | |
4853 arg_count, \ | |
4854 args) \ | |
4855 \ | |
4856 static const struct rx__test_case_config_desc \ | |
4857 RX__TEST_CASE_CONFIG_DESC_GET_ID(id) \ | |
4858 = {RX__TEST_CASE_CONFIG_BLUEPRINT_GET_UPDATE_FN_ID(id)}; | |
4859 | |
4860 /* Implementation: Test Suite O-(''Q) | |
4861 -------------------------------------------------------------------------- */ | |
4862 | |
4863 struct rx__test_suite_desc { | |
4864 const char *name; | |
4865 const struct rx__test_case_config_desc *config_desc; | |
4866 }; | |
4867 | |
4868 #define RX__TEST_SUITE_(id, config_desc) \ | |
4869 static const struct rx__test_suite_desc \ | |
4870 RX__TEST_SUITE_DESC_GET_ID(id) \ | |
4871 = {#id, config_desc}; \ | |
4872 \ | |
4873 RX__TEST_SUITE_REGISTER(id) | |
4874 | |
4875 #define RX__TEST_SUITE_0(id) \ | |
4876 RX__TEST_SUITE_(id, NULL); | |
4877 | |
4878 #define RX__TEST_SUITE_1(id, arg_count, args) \ | |
4879 RX__TEST_CASE_CONFIG(id, arg_count, args) \ | |
4880 RX__TEST_SUITE_(id, &RX__TEST_CASE_CONFIG_DESC_GET_ID(id)); | |
4881 | |
4882 /* Implementation: Test Case O-(''Q) | |
4883 -------------------------------------------------------------------------- */ | |
4884 | |
4885 struct rx__test_case_desc { | |
4886 const char *suite_name; | |
4887 const char *name; | |
4888 rx_run_fn run; | |
4889 const struct rx__test_case_config_desc *config_desc; | |
4890 }; | |
4891 | |
4892 #define RX__TEST_CASE_(suite_id, id, config_desc) \ | |
4893 static void \ | |
4894 suite_id##_##id(RX__DEFINE_PARAMS(void)); \ | |
4895 \ | |
4896 static const struct rx__test_case_desc \ | |
4897 RX__TEST_CASE_DESC_GET_ID(suite_id, id) \ | |
4898 = {#suite_id, \ | |
4899 #id, \ | |
4900 suite_id##_##id, \ | |
4901 config_desc}; \ | |
4902 \ | |
4903 RX__TEST_CASE_REGISTER(suite_id, id); \ | |
4904 \ | |
4905 static void \ | |
4906 suite_id##_##id(RX__DEFINE_PARAMS(void)) | |
4907 | |
4908 #define RX__TEST_CASE_0(suite_id, id) \ | |
4909 RX__TEST_CASE_(suite_id, \ | |
4910 id, \ | |
4911 NULL) | |
4912 | |
4913 #define RX__TEST_CASE_1(suite_id, id, arg_count, args) \ | |
4914 RX__TEST_CASE_CONFIG(suite_id##_##id, arg_count, args) \ | |
4915 RX__TEST_CASE_(suite_id, \ | |
4916 id, \ | |
4917 &RX__TEST_CASE_CONFIG_DESC_GET_ID(suite_id##_##id)) | |
4918 | |
4919 /* Implementation: Operators O-(''Q) | |
4920 -------------------------------------------------------------------------- */ | |
4921 | |
4922 enum rx__op { | |
4923 RX__OP_EQUAL = 0, | |
4924 RX__OP_NOT_EQUAL = 1, | |
4925 RX__OP_GREATER = 2, | |
4926 RX__OP_LESSER = 3, | |
4927 RX__OP_GREATER_OR_EQUAL = 4, | |
4928 RX__OP_LESSER_OR_EQUAL = 5 | |
4929 }; | |
4930 | |
4931 static void | |
4932 rx__op_get_symbol(const char **symbol, enum rx__op op) | |
4933 { | |
4934 RX_ASSERT(symbol != NULL); | |
4935 | |
4936 switch (op) { | |
4937 case RX__OP_EQUAL: | |
4938 *symbol = "=="; | |
4939 return; | |
4940 case RX__OP_NOT_EQUAL: | |
4941 *symbol = "!="; | |
4942 return; | |
4943 case RX__OP_GREATER: | |
4944 *symbol = ">"; | |
4945 return; | |
4946 case RX__OP_LESSER: | |
4947 *symbol = "<"; | |
4948 return; | |
4949 case RX__OP_GREATER_OR_EQUAL: | |
4950 *symbol = ">="; | |
4951 return; | |
4952 case RX__OP_LESSER_OR_EQUAL: | |
4953 *symbol = "<="; | |
4954 return; | |
4955 default: | |
4956 RX_ASSERT(0); | |
4957 } | |
4958 } | |
4959 | |
4960 static void | |
4961 rx__op_get_name(const char **name, enum rx__op op) | |
4962 { | |
4963 RX_ASSERT(name != NULL); | |
4964 | |
4965 switch (op) { | |
4966 case RX__OP_EQUAL: | |
4967 *name = "equal to"; | |
4968 return; | |
4969 case RX__OP_NOT_EQUAL: | |
4970 *name = "not equal to"; | |
4971 return; | |
4972 case RX__OP_GREATER: | |
4973 *name = "greater than"; | |
4974 return; | |
4975 case RX__OP_LESSER: | |
4976 *name = "less than"; | |
4977 return; | |
4978 case RX__OP_GREATER_OR_EQUAL: | |
4979 *name = "greater than or equal to"; | |
4980 return; | |
4981 case RX__OP_LESSER_OR_EQUAL: | |
4982 *name = "less than or equal to"; | |
4983 return; | |
4984 default: | |
4985 RX_ASSERT(0); | |
4986 } | |
4987 } | |
4988 | |
4989 /* Implementation: String O-(''Q) | |
4990 -------------------------------------------------------------------------- */ | |
4991 | |
4992 #define RX__STR_LENGTH_ID rx__length | |
4993 | |
4994 #define RX__STR_CREATE_VA_LIST(status, s, fmt) \ | |
4995 do { \ | |
4996 va_list args; \ | |
4997 size_t RX__STR_LENGTH_ID; \ | |
4998 \ | |
4999 (s) = NULL; \ | |
5000 \ | |
5001 va_start(args, fmt); \ | |
5002 (status) \ | |
5003 = rx__str_initialize_va_list(&RX__STR_LENGTH_ID, s, fmt, args); \ | |
5004 va_end(args); \ | |
5005 \ | |
5006 if ((status) == RX_SUCCESS) { \ | |
5007 (s) = (char *)RX_MALLOC(sizeof *(s) * RX__STR_LENGTH_ID); \ | |
5008 if ((s) == NULL) { \ | |
5009 RX__LOG_DEBUG_1( \ | |
5010 "failed to allocate the string (%lu bytes)\n", \ | |
5011 (unsigned long)sizeof *(s) * RX__STR_LENGTH_ID); \ | |
5012 (status) = RX_ERROR_ALLOCATION; \ | |
5013 } else { \ | |
5014 va_start(args, fmt); \ | |
5015 (status) = rx__str_initialize_va_list( \ | |
5016 &RX__STR_LENGTH_ID, s, fmt, args); \ | |
5017 va_end(args); \ | |
5018 if ((status) != RX_SUCCESS) { \ | |
5019 RX_FREE(s); \ | |
5020 } \ | |
5021 } \ | |
5022 } \ | |
5023 } while (0) | |
5024 | |
5025 #define RX__STR_CREATE_(status, s, args) \ | |
5026 do { \ | |
5027 size_t RX__STR_LENGTH_ID; \ | |
5028 \ | |
5029 (s) = NULL; \ | |
5030 (status) = rx__str_initialize args; \ | |
5031 if ((status) == RX_SUCCESS) { \ | |
5032 (s) = (char *)RX_MALLOC(sizeof *(s) * RX__STR_LENGTH_ID); \ | |
5033 if ((s) == NULL) { \ | |
5034 RX__LOG_DEBUG_1( \ | |
5035 "failed to allocate the string (%lu bytes)\n", \ | |
5036 (unsigned long)sizeof *(s) * RX__STR_LENGTH_ID); \ | |
5037 (status) = RX_ERROR_ALLOCATION; \ | |
5038 } else { \ | |
5039 (status) = rx__str_initialize args; \ | |
5040 if ((status) != RX_SUCCESS) { \ | |
5041 RX_FREE(s); \ | |
5042 } \ | |
5043 } \ | |
5044 } \ | |
5045 } while (0) | |
5046 | |
5047 #define RX__STR_CREATE(status, s, msg) \ | |
5048 RX__STR_CREATE_(status, s, (&RX__STR_LENGTH_ID, s, msg)) | |
5049 | |
5050 #define RX__STR_CREATE_1(status, s, fmt, _0) \ | |
5051 RX__STR_CREATE_(status, s, (&RX__STR_LENGTH_ID, s, fmt, _0)) | |
5052 | |
5053 #define RX__STR_CREATE_2(status, s, fmt, _0, _1) \ | |
5054 RX__STR_CREATE_(status, s, (&RX__STR_LENGTH_ID, s, fmt, _0, _1)) | |
5055 | |
5056 #define RX__STR_CREATE_3(status, s, fmt, _0, _1, _2) \ | |
5057 RX__STR_CREATE_(status, s, (&RX__STR_LENGTH_ID, s, fmt, _0, _1, _2)) | |
5058 | |
5059 #define RX__STR_CREATE_4(status, s, fmt, _0, _1, _2, _3) \ | |
5060 RX__STR_CREATE_(status, s, (&RX__STR_LENGTH_ID, s, fmt, _0, _1, _2, _3)) | |
5061 | |
5062 enum rx__str_case { RX__STR_CASE_OBEY = 0, RX__STR_CASE_IGNORE = 1 }; | |
5063 | |
5064 static void | |
5065 rx__str_case_get_type(const char **type, enum rx__str_case str_case) | |
5066 { | |
5067 RX_ASSERT(type != NULL); | |
5068 | |
5069 switch (str_case) { | |
5070 case RX__STR_CASE_OBEY: | |
5071 *type = "obey"; | |
5072 return; | |
5073 case RX__STR_CASE_IGNORE: | |
5074 *type = "ignore"; | |
5075 return; | |
5076 default: | |
5077 RX_ASSERT(0); | |
5078 } | |
5079 } | |
5080 | |
5081 RX__PRINTF_CHECK(3, 0) | |
5082 static enum rx_status | |
5083 rx__str_initialize_va_list(size_t *count, | |
5084 char *s, | |
5085 const char *fmt, | |
5086 va_list args) | |
5087 { | |
5088 int size; | |
5089 | |
5090 RX_ASSERT(count != NULL); | |
5091 | |
5092 if (s == NULL) { | |
5093 #if defined(RX__PLATFORM_WINDOWS) | |
5094 size = _vscprintf(fmt, args); | |
5095 #elif RX__HAS_NPRINTF | |
5096 size = vsnprintf(NULL, 0, fmt, args); | |
5097 #else | |
5098 { | |
5099 FILE *file; | |
5100 | |
5101 file = fopen("/dev/null", "w"); | |
5102 if (file == NULL) { | |
5103 RX__LOG_DEBUG("could not open `/dev/null`\n"); | |
5104 return RX_ERROR; | |
5105 } | |
5106 | |
5107 size = vfprintf(file, fmt, args); | |
5108 fclose(file); | |
5109 } | |
5110 #endif | |
5111 | |
5112 if (size < 0) { | |
5113 RX__LOG_DEBUG("invalid string formatting\n"); | |
5114 return RX_ERROR; | |
5115 } | |
5116 | |
5117 *count = (size_t)size + 1; | |
5118 return RX_SUCCESS; | |
5119 } | |
5120 | |
5121 #if defined(_MSC_VER) | |
5122 #pragma warning(push) | |
5123 #pragma warning(disable : 4996) | |
5124 #endif | |
5125 size = vsprintf(s, fmt, args); | |
5126 #if defined(_MSC_VER) | |
5127 #pragma warning(pop) | |
5128 #endif | |
5129 if (size < 0) { | |
5130 RX__LOG_DEBUG("unexpected string formatting error\n"); | |
5131 return RX_ERROR; | |
5132 } | |
5133 | |
5134 *count = (size_t)size + 1; | |
5135 return RX_SUCCESS; | |
5136 } | |
5137 | |
5138 RX__PRINTF_CHECK(3, 4) | |
5139 static enum rx_status | |
5140 rx__str_initialize(size_t *count, char *s, const char *fmt, ...) | |
5141 { | |
5142 enum rx_status out; | |
5143 va_list args; | |
5144 | |
5145 RX_ASSERT(count != NULL); | |
5146 | |
5147 va_start(args, fmt); | |
5148 out = rx__str_initialize_va_list(count, s, fmt, args); | |
5149 va_end(args); | |
5150 | |
5151 return out; | |
5152 } | |
5153 | |
5154 static enum rx_status | |
5155 rx__str_copy(char **s, const char *original) | |
5156 { | |
5157 size_t size; | |
5158 | |
5159 size = strlen(original) + 1; | |
5160 | |
5161 *s = (char *)RX_MALLOC(sizeof **s * size); | |
5162 if (*s == NULL) { | |
5163 RX__LOG_DEBUG_1("failed to allocate the string (%lu bytes)\n", | |
5164 (unsigned long)sizeof **s * size); | |
5165 return RX_ERROR_ALLOCATION; | |
5166 } | |
5167 | |
5168 memcpy(*s, original, size); | |
5169 return RX_SUCCESS; | |
5170 } | |
5171 | |
5172 /* Implementation: Helpers O-(''Q) | |
5173 -------------------------------------------------------------------------- */ | |
5174 | |
5175 static int | |
5176 rx__compare_test_cases(const void *a, const void *b) | |
5177 { | |
5178 int out; | |
5179 const struct rx_test_case *aa; | |
5180 const struct rx_test_case *bb; | |
5181 | |
5182 aa = (const struct rx_test_case *)a; | |
5183 bb = (const struct rx_test_case *)b; | |
5184 | |
5185 out = strcmp(aa->suite_name, bb->suite_name); | |
5186 if (out != 0) { | |
5187 return out; | |
5188 } | |
5189 | |
5190 return strcmp(aa->name, bb->name); | |
5191 } | |
5192 | |
5193 static int | |
5194 rx__compare_summaries_by_test_suite(const void *a, const void *b) | |
5195 { | |
5196 const struct rx_summary *aa; | |
5197 const struct rx_summary *bb; | |
5198 | |
5199 aa = (const struct rx_summary *)a; | |
5200 bb = (const struct rx_summary *)b; | |
5201 return strcmp(aa->test_case->suite_name, bb->test_case->suite_name); | |
5202 } | |
5203 | |
5204 static void | |
5205 rx__real_are_equal_fuzzy(int *result, rx__real a, rx__real b, rx__real tol) | |
5206 { | |
5207 rx__real diff; | |
5208 rx__real abs_a; | |
5209 rx__real abs_b; | |
5210 | |
5211 diff = a > b ? a - b : b - a; | |
5212 if (diff <= tol) { | |
5213 *result = 1; | |
5214 return; | |
5215 } | |
5216 | |
5217 abs_a = a < 0 ? -a : a; | |
5218 abs_b = b < 0 ? -b : b; | |
5219 *result = diff <= (abs_a > abs_b ? abs_a : abs_b) * tol; | |
5220 } | |
5221 | |
5222 static void | |
5223 rx__str_are_equal(int *result, const char *a, const char *b) | |
5224 { | |
5225 while (*a != '\0') { | |
5226 if (*a != *b) { | |
5227 *result = 0; | |
5228 return; | |
5229 } | |
5230 | |
5231 ++a; | |
5232 ++b; | |
5233 } | |
5234 | |
5235 *result = *a == *b; | |
5236 } | |
5237 | |
5238 static void | |
5239 rx__str_are_equal_no_case(int *result, const char *a, const char *b) | |
5240 { | |
5241 while (*a != '\0') { | |
5242 if (tolower(*a) != tolower(*b)) { | |
5243 *result = 0; | |
5244 return; | |
5245 } | |
5246 | |
5247 ++a; | |
5248 ++b; | |
5249 } | |
5250 | |
5251 *result = tolower(*a) == tolower(*b); | |
5252 } | |
5253 | |
5254 RX__MAYBE_UNUSED static enum rx_status | |
5255 rx__run_test_cases(size_t test_case_count, | |
5256 const struct rx_test_case *test_cases) | |
5257 { | |
5258 size_t i; | |
5259 enum rx_status status; | |
5260 struct rx_summary *summaries; | |
5261 | |
5262 if (test_case_count == 0) { | |
5263 RX__LOG_INFO("nothing to run\n"); | |
5264 return RX_SUCCESS; | |
5265 } | |
5266 | |
5267 RX_ASSERT(test_cases != NULL); | |
5268 | |
5269 summaries = (struct rx_summary *)RX_MALLOC(sizeof *summaries | |
5270 * test_case_count); | |
5271 if (summaries == NULL) { | |
5272 RX__LOG_DEBUG("failed to allocate the summaries\n"); | |
5273 return RX_ERROR_ALLOCATION; | |
5274 } | |
5275 | |
5276 status = RX_SUCCESS; | |
5277 | |
5278 for (i = 0; i < test_case_count;) { | |
5279 const struct rx_test_case *test_case; | |
5280 struct rx_summary *summary; | |
5281 | |
5282 test_case = &test_cases[i]; | |
5283 summary = &summaries[i]; | |
5284 | |
5285 RX_ASSERT(test_case->suite_name != NULL); | |
5286 RX_ASSERT(test_case->name != NULL); | |
5287 | |
5288 status = rx_summary_initialize(summary, test_case); | |
5289 if (status != RX_SUCCESS) { | |
5290 RX__LOG_ERROR_2("failed to initialize the summary " | |
5291 "(suite: \"%s\", case: \"%s\")\n", | |
5292 test_case->suite_name, | |
5293 test_case->name); | |
5294 goto summaries_cleanup; | |
5295 } | |
5296 | |
5297 ++i; | |
5298 | |
5299 status = rx_test_case_run(summary, test_case); | |
5300 if (status != RX_SUCCESS) { | |
5301 RX__LOG_ERROR_2("failed to run a test case " | |
5302 "(suite: \"%s\", case: \"%s\")\n", | |
5303 test_case->suite_name, | |
5304 test_case->name); | |
5305 goto summaries_cleanup; | |
5306 } | |
5307 | |
5308 rx_summary_print(summary); | |
5309 } | |
5310 | |
5311 if (status == RX_SUCCESS) { | |
5312 size_t j; | |
5313 | |
5314 for (j = 0; j < test_case_count; ++j) { | |
5315 size_t k; | |
5316 struct rx_summary *summary; | |
5317 | |
5318 summary = &summaries[j]; | |
5319 | |
5320 for (k = 0; k < summary->failure_count; ++k) { | |
5321 const struct rx_failure *failure; | |
5322 | |
5323 failure = &summary->failures[k]; | |
5324 if (failure->severity == RX_FATAL) { | |
5325 status = RX_ERROR_ABORTED; | |
5326 goto summaries_cleanup; | |
5327 } | |
5328 } | |
5329 } | |
5330 } | |
5331 | |
5332 summaries_cleanup: | |
5333 while (i-- > 0) { | |
5334 rx_summary_terminate(&summaries[i]); | |
5335 } | |
5336 | |
5337 RX_FREE(summaries); | |
5338 | |
5339 return status; | |
5340 } | |
5341 | |
5342 RX__MAYBE_UNUSED static enum rx_status | |
5343 rx__run_registered_test_cases(void) | |
5344 { | |
5345 enum rx_status out; | |
5346 rx_size test_case_count; | |
5347 struct rx_test_case *test_cases; | |
5348 | |
5349 rx_enumerate_test_cases(&test_case_count, NULL); | |
5350 if (test_case_count == 0) { | |
5351 return rx__run_test_cases(0, NULL); | |
5352 } | |
5353 | |
5354 test_cases = (struct rx_test_case *)RX_MALLOC(sizeof *test_cases | |
5355 * test_case_count); | |
5356 if (test_cases == NULL) { | |
5357 RX__LOG_ERROR("failed to allocate the test cases\n"); | |
5358 return RX_ERROR_ALLOCATION; | |
5359 } | |
5360 | |
5361 rx_enumerate_test_cases(&test_case_count, test_cases); | |
5362 out = rx__run_test_cases(test_case_count, test_cases); | |
5363 RX_FREE(test_cases); | |
5364 return out; | |
5365 } | |
5366 | |
5367 /* Implementation: Test Assessments O-(''Q) | |
5368 -------------------------------------------------------------------------- */ | |
5369 | |
5370 RX__PRINTF_CHECK(8, 0) | |
5371 RX__MAYBE_UNUSED static void | |
5372 rx__assess_value(struct rx_context *context, | |
5373 int x, | |
5374 int expected, | |
5375 const char *expr, | |
5376 const char *file, | |
5377 int line, | |
5378 enum rx_severity severity, | |
5379 const char *failure_fmt, | |
5380 ...) | |
5381 { | |
5382 int result; | |
5383 char *failure_msg; | |
5384 char *diagnostic_msg; | |
5385 | |
5386 RX_ASSERT(context != NULL); | |
5387 RX_ASSERT(file != NULL); | |
5388 | |
5389 result = ((x && expected) || (!x && !expected)); | |
5390 | |
5391 if (result) { | |
5392 failure_msg = NULL; | |
5393 diagnostic_msg = NULL; | |
5394 } else { | |
5395 enum rx_status status; | |
5396 | |
5397 if (failure_fmt == NULL) { | |
5398 RX__STR_CREATE_1(status, | |
5399 failure_msg, | |
5400 "`%s` is expected to evaluate to true", | |
5401 expr); | |
5402 } else { | |
5403 RX__STR_CREATE_VA_LIST(status, failure_msg, failure_fmt); | |
5404 } | |
5405 | |
5406 if (status != RX_SUCCESS) { | |
5407 RX__LOG_DEBUG_2("failed to create the failure message for " | |
5408 "the test located at %s:%d\n", | |
5409 file, | |
5410 line); | |
5411 failure_msg = NULL; | |
5412 } | |
5413 | |
5414 RX__STR_CREATE_1(status, diagnostic_msg, "%d", x); | |
5415 if (status != RX_SUCCESS) { | |
5416 RX__LOG_DEBUG_2("failed to create the diagnostic message for " | |
5417 "the test located at %s:%d\n", | |
5418 file, | |
5419 line); | |
5420 diagnostic_msg = NULL; | |
5421 } | |
5422 } | |
5423 | |
5424 if (rx_handle_test_result( | |
5425 context, result, file, line, severity, failure_msg, diagnostic_msg) | |
5426 != RX_SUCCESS) { | |
5427 RX__LOG_DEBUG_2("failed to handle the test result for the test " | |
5428 "located at %s:%d\n", | |
5429 file, | |
5430 line); | |
5431 } | |
5432 | |
5433 RX_FREE(failure_msg); | |
5434 RX_FREE(diagnostic_msg); | |
5435 | |
5436 if (!result && severity == RX_FATAL) { | |
5437 rx_abort(context); | |
5438 } | |
5439 } | |
5440 | |
5441 RX__PRINTF_CHECK(8, 0) | |
5442 RX__MAYBE_UNUSED static void | |
5443 rx__bool_assess_value(struct rx_context *context, | |
5444 int x, | |
5445 int expected, | |
5446 const char *expr, | |
5447 const char *file, | |
5448 int line, | |
5449 enum rx_severity severity, | |
5450 const char *failure_fmt, | |
5451 ...) | |
5452 { | |
5453 int result; | |
5454 char *failure_msg; | |
5455 char *diagnostic_msg; | |
5456 | |
5457 RX_ASSERT(context != NULL); | |
5458 RX_ASSERT(expr != NULL); | |
5459 RX_ASSERT(file != NULL); | |
5460 | |
5461 result = ((x && expected) || (!x && !expected)); | |
5462 | |
5463 if (result) { | |
5464 failure_msg = NULL; | |
5465 diagnostic_msg = NULL; | |
5466 } else { | |
5467 enum rx_status status; | |
5468 | |
5469 if (failure_fmt == NULL) { | |
5470 RX__STR_CREATE_2(status, | |
5471 failure_msg, | |
5472 "`%s` is expected to be %s", | |
5473 expr, | |
5474 expected ? "true" : "false"); | |
5475 } else { | |
5476 RX__STR_CREATE_VA_LIST(status, failure_msg, failure_fmt); | |
5477 } | |
5478 | |
5479 if (status != RX_SUCCESS) { | |
5480 RX__LOG_DEBUG_2("failed to create the failure message for " | |
5481 "the boolean test located at %s:%d\n", | |
5482 file, | |
5483 line); | |
5484 failure_msg = NULL; | |
5485 } | |
5486 | |
5487 RX__STR_CREATE_2(status, diagnostic_msg, "%d == %d", x, expected); | |
5488 if (status != RX_SUCCESS) { | |
5489 RX__LOG_DEBUG_2("failed to create the diagnostic message for " | |
5490 "the boolean test located at %s:%d\n", | |
5491 file, | |
5492 line); | |
5493 diagnostic_msg = NULL; | |
5494 } | |
5495 } | |
5496 | |
5497 if (rx_handle_test_result( | |
5498 context, result, file, line, severity, failure_msg, diagnostic_msg) | |
5499 != RX_SUCCESS) { | |
5500 RX__LOG_DEBUG_2("failed to handle the test result for the boolean test " | |
5501 "located at %s:%d\n", | |
5502 file, | |
5503 line); | |
5504 } | |
5505 | |
5506 RX_FREE(failure_msg); | |
5507 RX_FREE(diagnostic_msg); | |
5508 | |
5509 if (!result && severity == RX_FATAL) { | |
5510 rx_abort(context); | |
5511 } | |
5512 } | |
5513 | |
5514 RX__PRINTF_CHECK(10, 0) | |
5515 RX__MAYBE_UNUSED static void | |
5516 rx__int_assess_comparison(struct rx_context *context, | |
5517 rx__int x1, | |
5518 rx__int x2, | |
5519 enum rx__op op, | |
5520 const char *expr1, | |
5521 const char *expr2, | |
5522 const char *file, | |
5523 int line, | |
5524 enum rx_severity severity, | |
5525 const char *failure_fmt, | |
5526 ...) | |
5527 { | |
5528 int result; | |
5529 char *failure_msg; | |
5530 char *diagnostic_msg; | |
5531 | |
5532 RX_ASSERT(context != NULL); | |
5533 RX_ASSERT(expr1 != NULL); | |
5534 RX_ASSERT(expr2 != NULL); | |
5535 RX_ASSERT(file != NULL); | |
5536 | |
5537 switch (op) { | |
5538 case RX__OP_EQUAL: | |
5539 result = x1 == x2; | |
5540 break; | |
5541 case RX__OP_NOT_EQUAL: | |
5542 result = x1 != x2; | |
5543 break; | |
5544 case RX__OP_GREATER: | |
5545 result = x1 > x2; | |
5546 break; | |
5547 case RX__OP_LESSER: | |
5548 result = x1 < x2; | |
5549 break; | |
5550 case RX__OP_GREATER_OR_EQUAL: | |
5551 result = x1 >= x2; | |
5552 break; | |
5553 case RX__OP_LESSER_OR_EQUAL: | |
5554 result = x1 <= x2; | |
5555 break; | |
5556 default: | |
5557 RX_ASSERT(0); | |
5558 result = 0; | |
5559 break; | |
5560 } | |
5561 | |
5562 if (result) { | |
5563 failure_msg = NULL; | |
5564 diagnostic_msg = NULL; | |
5565 } else { | |
5566 enum rx_status status; | |
5567 const char *op_symbol; | |
5568 | |
5569 if (failure_fmt == NULL) { | |
5570 const char *op_name; | |
5571 | |
5572 rx__op_get_name(&op_name, op); | |
5573 RX__STR_CREATE_3(status, | |
5574 failure_msg, | |
5575 "`%s` is expected to be %s `%s`", | |
5576 expr1, | |
5577 op_name, | |
5578 expr2); | |
5579 } else { | |
5580 RX__STR_CREATE_VA_LIST(status, failure_msg, failure_fmt); | |
5581 } | |
5582 | |
5583 if (status != RX_SUCCESS) { | |
5584 RX__LOG_DEBUG_2("failed to create the failure message for " | |
5585 "the integer comparison test located at %s:%d\n", | |
5586 file, | |
5587 line); | |
5588 failure_msg = NULL; | |
5589 } | |
5590 | |
5591 rx__op_get_symbol(&op_symbol, op); | |
5592 RX__STR_CREATE_3(status, | |
5593 diagnostic_msg, | |
5594 "%ld %s %ld", | |
5595 (long)x1, | |
5596 op_symbol, | |
5597 (long)x2); | |
5598 if (status != RX_SUCCESS) { | |
5599 RX__LOG_DEBUG_2("failed to create the diagnostic message for " | |
5600 "the integer comparison test located at %s:%d\n", | |
5601 file, | |
5602 line); | |
5603 diagnostic_msg = NULL; | |
5604 } | |
5605 } | |
5606 | |
5607 if (rx_handle_test_result( | |
5608 context, result, file, line, severity, failure_msg, diagnostic_msg) | |
5609 != RX_SUCCESS) { | |
5610 RX__LOG_DEBUG_2("failed to handle the test result for the integer " | |
5611 "comparison test located at %s:%d\n", | |
5612 file, | |
5613 line); | |
5614 } | |
5615 | |
5616 RX_FREE(failure_msg); | |
5617 RX_FREE(diagnostic_msg); | |
5618 | |
5619 if (!result && severity == RX_FATAL) { | |
5620 rx_abort(context); | |
5621 } | |
5622 } | |
5623 | |
5624 RX__PRINTF_CHECK(10, 0) | |
5625 RX__MAYBE_UNUSED static void | |
5626 rx__uint_assess_comparison(struct rx_context *context, | |
5627 rx__uint x1, | |
5628 rx__uint x2, | |
5629 enum rx__op op, | |
5630 const char *expr1, | |
5631 const char *expr2, | |
5632 const char *file, | |
5633 int line, | |
5634 enum rx_severity severity, | |
5635 const char *failure_fmt, | |
5636 ...) | |
5637 { | |
5638 int result; | |
5639 char *failure_msg; | |
5640 char *diagnostic_msg; | |
5641 | |
5642 RX_ASSERT(context != NULL); | |
5643 RX_ASSERT(expr1 != NULL); | |
5644 RX_ASSERT(expr2 != NULL); | |
5645 RX_ASSERT(file != NULL); | |
5646 | |
5647 switch (op) { | |
5648 case RX__OP_EQUAL: | |
5649 result = x1 == x2; | |
5650 break; | |
5651 case RX__OP_NOT_EQUAL: | |
5652 result = x1 != x2; | |
5653 break; | |
5654 case RX__OP_GREATER: | |
5655 result = x1 > x2; | |
5656 break; | |
5657 case RX__OP_LESSER: | |
5658 result = x1 < x2; | |
5659 break; | |
5660 case RX__OP_GREATER_OR_EQUAL: | |
5661 result = x1 >= x2; | |
5662 break; | |
5663 case RX__OP_LESSER_OR_EQUAL: | |
5664 result = x1 <= x2; | |
5665 break; | |
5666 default: | |
5667 RX_ASSERT(0); | |
5668 result = 0; | |
5669 break; | |
5670 } | |
5671 | |
5672 if (result) { | |
5673 failure_msg = NULL; | |
5674 diagnostic_msg = NULL; | |
5675 } else { | |
5676 enum rx_status status; | |
5677 const char *op_symbol; | |
5678 | |
5679 if (failure_fmt == NULL) { | |
5680 const char *op_name; | |
5681 | |
5682 rx__op_get_name(&op_name, op); | |
5683 RX__STR_CREATE_3(status, | |
5684 failure_msg, | |
5685 "`%s` is expected to be %s `%s`", | |
5686 expr1, | |
5687 op_name, | |
5688 expr2); | |
5689 } else { | |
5690 RX__STR_CREATE_VA_LIST(status, failure_msg, failure_fmt); | |
5691 } | |
5692 | |
5693 if (status != RX_SUCCESS) { | |
5694 RX__LOG_DEBUG_2("failed to create the failure message for " | |
5695 "the unsigned integer comparison test located at " | |
5696 "%s:%d\n", | |
5697 file, | |
5698 line); | |
5699 failure_msg = NULL; | |
5700 } | |
5701 | |
5702 rx__op_get_symbol(&op_symbol, op); | |
5703 RX__STR_CREATE_3(status, | |
5704 diagnostic_msg, | |
5705 "%lu %s %lu", | |
5706 (unsigned long)x1, | |
5707 op_symbol, | |
5708 (unsigned long)x2); | |
5709 if (status != RX_SUCCESS) { | |
5710 RX__LOG_DEBUG_2("failed to create the diagnostic message for " | |
5711 "the unsigned integer comparison test located at " | |
5712 "%s:%d\n", | |
5713 file, | |
5714 line); | |
5715 diagnostic_msg = NULL; | |
5716 } | |
5717 } | |
5718 | |
5719 if (rx_handle_test_result( | |
5720 context, result, file, line, severity, failure_msg, diagnostic_msg) | |
5721 != RX_SUCCESS) { | |
5722 RX__LOG_DEBUG_2("failed to handle the test result for the unsigned " | |
5723 "integer comparison test located at %s:%d\n", | |
5724 file, | |
5725 line); | |
5726 } | |
5727 | |
5728 RX_FREE(failure_msg); | |
5729 RX_FREE(diagnostic_msg); | |
5730 | |
5731 if (!result && severity == RX_FATAL) { | |
5732 rx_abort(context); | |
5733 } | |
5734 } | |
5735 | |
5736 RX__PRINTF_CHECK(10, 0) | |
5737 RX__MAYBE_UNUSED static void | |
5738 rx__real_assess_comparison(struct rx_context *context, | |
5739 rx__real x1, | |
5740 rx__real x2, | |
5741 enum rx__op op, | |
5742 const char *expr1, | |
5743 const char *expr2, | |
5744 const char *file, | |
5745 int line, | |
5746 enum rx_severity severity, | |
5747 const char *failure_fmt, | |
5748 ...) | |
5749 { | |
5750 int result; | |
5751 char *failure_msg; | |
5752 char *diagnostic_msg; | |
5753 | |
5754 RX_ASSERT(context != NULL); | |
5755 RX_ASSERT(expr1 != NULL); | |
5756 RX_ASSERT(expr2 != NULL); | |
5757 RX_ASSERT(file != NULL); | |
5758 | |
5759 switch (op) { | |
5760 #if defined(__GNUC__) | |
5761 #pragma GCC diagnostic push | |
5762 #pragma GCC diagnostic ignored "-Wfloat-equal" | |
5763 #endif | |
5764 case RX__OP_EQUAL: | |
5765 result = x1 == x2; | |
5766 break; | |
5767 case RX__OP_NOT_EQUAL: | |
5768 result = x1 != x2; | |
5769 break; | |
5770 #if defined(__GNUC__) | |
5771 #pragma GCC diagnostic pop | |
5772 #endif | |
5773 case RX__OP_GREATER: | |
5774 result = x1 > x2; | |
5775 break; | |
5776 case RX__OP_LESSER: | |
5777 result = x1 < x2; | |
5778 break; | |
5779 case RX__OP_GREATER_OR_EQUAL: | |
5780 result = x1 >= x2; | |
5781 break; | |
5782 case RX__OP_LESSER_OR_EQUAL: | |
5783 result = x1 <= x2; | |
5784 break; | |
5785 default: | |
5786 RX_ASSERT(0); | |
5787 result = 0; | |
5788 break; | |
5789 } | |
5790 | |
5791 if (result) { | |
5792 failure_msg = NULL; | |
5793 diagnostic_msg = NULL; | |
5794 } else { | |
5795 enum rx_status status; | |
5796 const char *op_symbol; | |
5797 | |
5798 if (failure_fmt == NULL) { | |
5799 const char *op_name; | |
5800 | |
5801 rx__op_get_name(&op_name, op); | |
5802 RX__STR_CREATE_3(status, | |
5803 failure_msg, | |
5804 "`%s` is expected to be %s `%s`", | |
5805 expr1, | |
5806 op_name, | |
5807 expr2); | |
5808 } else { | |
5809 RX__STR_CREATE_VA_LIST(status, failure_msg, failure_fmt); | |
5810 } | |
5811 | |
5812 if (status != RX_SUCCESS) { | |
5813 RX__LOG_DEBUG_2("failed to create the failure message for " | |
5814 "the real comparison test located at %s:%d\n", | |
5815 file, | |
5816 line); | |
5817 failure_msg = NULL; | |
5818 } | |
5819 | |
5820 rx__op_get_symbol(&op_symbol, op); | |
5821 RX__STR_CREATE_3( | |
5822 status, diagnostic_msg, "%Lf %s %Lf", x1, op_symbol, x2); | |
5823 if (status != RX_SUCCESS) { | |
5824 RX__LOG_DEBUG_2("failed to create the diagnostic message for " | |
5825 "the real comparison test located at %s:%d\n", | |
5826 file, | |
5827 line); | |
5828 diagnostic_msg = NULL; | |
5829 } | |
5830 } | |
5831 | |
5832 if (rx_handle_test_result( | |
5833 context, result, file, line, severity, failure_msg, diagnostic_msg) | |
5834 != RX_SUCCESS) { | |
5835 RX__LOG_DEBUG_2("failed to handle the test result for the real " | |
5836 "comparison test located at %s:%d\n", | |
5837 file, | |
5838 line); | |
5839 } | |
5840 | |
5841 RX_FREE(failure_msg); | |
5842 RX_FREE(diagnostic_msg); | |
5843 | |
5844 if (!result && severity == RX_FATAL) { | |
5845 rx_abort(context); | |
5846 } | |
5847 } | |
5848 | |
5849 RX__PRINTF_CHECK(11, 0) | |
5850 RX__MAYBE_UNUSED static void | |
5851 rx__real_assess_fuzzy_comparison(struct rx_context *context, | |
5852 rx__real x1, | |
5853 rx__real x2, | |
5854 rx__real tol, | |
5855 enum rx__op op, | |
5856 const char *expr1, | |
5857 const char *expr2, | |
5858 const char *file, | |
5859 int line, | |
5860 enum rx_severity severity, | |
5861 const char *failure_fmt, | |
5862 ...) | |
5863 { | |
5864 int result; | |
5865 char *failure_msg; | |
5866 char *diagnostic_msg; | |
5867 | |
5868 RX_ASSERT(context != NULL); | |
5869 RX_ASSERT(expr1 != NULL); | |
5870 RX_ASSERT(expr2 != NULL); | |
5871 RX_ASSERT(file != NULL); | |
5872 | |
5873 switch (op) { | |
5874 case RX__OP_EQUAL: | |
5875 rx__real_are_equal_fuzzy(&result, x1, x2, tol); | |
5876 break; | |
5877 case RX__OP_NOT_EQUAL: | |
5878 rx__real_are_equal_fuzzy(&result, x1, x2, tol); | |
5879 result = !result; | |
5880 break; | |
5881 default: | |
5882 RX_ASSERT(0); | |
5883 result = 0; | |
5884 break; | |
5885 } | |
5886 | |
5887 if (result) { | |
5888 failure_msg = NULL; | |
5889 diagnostic_msg = NULL; | |
5890 } else { | |
5891 enum rx_status status; | |
5892 const char *op_symbol; | |
5893 | |
5894 if (failure_fmt == NULL) { | |
5895 const char *op_name; | |
5896 | |
5897 rx__op_get_name(&op_name, op); | |
5898 RX__STR_CREATE_4(status, | |
5899 failure_msg, | |
5900 "`%s` is expected to be almost %s `%s` " | |
5901 "(tolerance: %Lf)", | |
5902 expr1, | |
5903 op_name, | |
5904 expr2, | |
5905 tol); | |
5906 } else { | |
5907 RX__STR_CREATE_VA_LIST(status, failure_msg, failure_fmt); | |
5908 } | |
5909 | |
5910 if (status != RX_SUCCESS) { | |
5911 RX__LOG_DEBUG_2("failed to create the failure message for " | |
5912 "the real almost equal test located at %s:%d\n", | |
5913 file, | |
5914 line); | |
5915 failure_msg = NULL; | |
5916 } | |
5917 | |
5918 rx__op_get_symbol(&op_symbol, op); | |
5919 RX__STR_CREATE_3( | |
5920 status, diagnostic_msg, "%Lf %s %Lf", x1, op_symbol, x2); | |
5921 if (status != RX_SUCCESS) { | |
5922 RX__LOG_DEBUG_2("failed to create the diagnostic message for " | |
5923 "the real almost equal test located at %s:%d\n", | |
5924 file, | |
5925 line); | |
5926 diagnostic_msg = NULL; | |
5927 } | |
5928 } | |
5929 | |
5930 if (rx_handle_test_result( | |
5931 context, result, file, line, severity, failure_msg, diagnostic_msg) | |
5932 != RX_SUCCESS) { | |
5933 RX__LOG_DEBUG_2("failed to handle the test result for the real " | |
5934 "almost equal test located at %s:%d\n", | |
5935 file, | |
5936 line); | |
5937 } | |
5938 | |
5939 RX_FREE(failure_msg); | |
5940 RX_FREE(diagnostic_msg); | |
5941 | |
5942 if (!result && severity == RX_FATAL) { | |
5943 rx_abort(context); | |
5944 } | |
5945 } | |
5946 | |
5947 RX__PRINTF_CHECK(11, 0) | |
5948 RX__MAYBE_UNUSED static void | |
5949 rx__str_assess_comparison(struct rx_context *context, | |
5950 const char *s1, | |
5951 const char *s2, | |
5952 enum rx__str_case str_case, | |
5953 enum rx__op op, | |
5954 const char *expr1, | |
5955 const char *expr2, | |
5956 const char *file, | |
5957 int line, | |
5958 enum rx_severity severity, | |
5959 const char *failure_fmt, | |
5960 ...) | |
5961 { | |
5962 int result; | |
5963 char *failure_msg; | |
5964 char *diagnostic_msg; | |
5965 | |
5966 RX_ASSERT(context != NULL); | |
5967 RX_ASSERT(s1 != NULL); | |
5968 RX_ASSERT(s2 != NULL); | |
5969 RX_ASSERT(expr1 != NULL); | |
5970 RX_ASSERT(expr2 != NULL); | |
5971 RX_ASSERT(file != NULL); | |
5972 | |
5973 switch (op) { | |
5974 case RX__OP_EQUAL: | |
5975 str_case == RX__STR_CASE_OBEY | |
5976 ? rx__str_are_equal(&result, s1, s2) | |
5977 : rx__str_are_equal_no_case(&result, s1, s2); | |
5978 break; | |
5979 case RX__OP_NOT_EQUAL: | |
5980 str_case == RX__STR_CASE_OBEY | |
5981 ? rx__str_are_equal(&result, s1, s2) | |
5982 : rx__str_are_equal_no_case(&result, s1, s2); | |
5983 result = !result; | |
5984 break; | |
5985 default: | |
5986 RX_ASSERT(0); | |
5987 result = 0; | |
5988 break; | |
5989 } | |
5990 | |
5991 if (result) { | |
5992 failure_msg = NULL; | |
5993 diagnostic_msg = NULL; | |
5994 } else { | |
5995 enum rx_status status; | |
5996 const char *op_symbol; | |
5997 | |
5998 if (failure_fmt == NULL) { | |
5999 const char *str_case_type; | |
6000 const char *op_name; | |
6001 | |
6002 rx__str_case_get_type(&str_case_type, str_case); | |
6003 rx__op_get_name(&op_name, op); | |
6004 RX__STR_CREATE_4(status, | |
6005 failure_msg, | |
6006 "`%s` is expected to be %s `%s` (case: %s)", | |
6007 expr1, | |
6008 op_name, | |
6009 expr2, | |
6010 str_case_type); | |
6011 } else { | |
6012 RX__STR_CREATE_VA_LIST(status, failure_msg, failure_fmt); | |
6013 } | |
6014 | |
6015 if (status != RX_SUCCESS) { | |
6016 RX__LOG_DEBUG_2("failed to create the failure message for " | |
6017 "the string comparison test located at %s:%d\n", | |
6018 file, | |
6019 line); | |
6020 failure_msg = NULL; | |
6021 } | |
6022 | |
6023 rx__op_get_symbol(&op_symbol, op); | |
6024 RX__STR_CREATE_3( | |
6025 status, diagnostic_msg, "\"%s\" %s \"%s\"", s1, op_symbol, s2); | |
6026 if (status != RX_SUCCESS) { | |
6027 RX__LOG_DEBUG_2("failed to create the diagnostic message for " | |
6028 "the string comparison test located at %s:%d\n", | |
6029 file, | |
6030 line); | |
6031 diagnostic_msg = NULL; | |
6032 } | |
6033 } | |
6034 | |
6035 if (rx_handle_test_result( | |
6036 context, result, file, line, severity, failure_msg, diagnostic_msg) | |
6037 != RX_SUCCESS) { | |
6038 RX__LOG_DEBUG_2("failed to handle the test result for the string " | |
6039 "comparison test located at %s:%d\n", | |
6040 file, | |
6041 line); | |
6042 } | |
6043 | |
6044 RX_FREE(failure_msg); | |
6045 RX_FREE(diagnostic_msg); | |
6046 | |
6047 if (!result && severity == RX_FATAL) { | |
6048 rx_abort(context); | |
6049 } | |
6050 } | |
6051 | |
6052 RX__PRINTF_CHECK(10, 0) | |
6053 RX__MAYBE_UNUSED static void | |
6054 rx__ptr_assess_comparison(struct rx_context *context, | |
6055 void *x1, | |
6056 void *x2, | |
6057 enum rx__op op, | |
6058 const char *expr1, | |
6059 const char *expr2, | |
6060 const char *file, | |
6061 int line, | |
6062 enum rx_severity severity, | |
6063 const char *failure_fmt, | |
6064 ...) | |
6065 { | |
6066 int result; | |
6067 char *failure_msg; | |
6068 char *diagnostic_msg; | |
6069 | |
6070 RX_ASSERT(context != NULL); | |
6071 RX_ASSERT(expr1 != NULL); | |
6072 RX_ASSERT(expr2 != NULL); | |
6073 RX_ASSERT(file != NULL); | |
6074 | |
6075 switch (op) { | |
6076 case RX__OP_EQUAL: | |
6077 result = x1 == x2; | |
6078 break; | |
6079 case RX__OP_NOT_EQUAL: | |
6080 result = x1 != x2; | |
6081 break; | |
6082 default: | |
6083 RX_ASSERT(0); | |
6084 result = 0; | |
6085 break; | |
6086 } | |
6087 | |
6088 if (result) { | |
6089 failure_msg = NULL; | |
6090 diagnostic_msg = NULL; | |
6091 } else { | |
6092 enum rx_status status; | |
6093 const char *op_symbol; | |
6094 | |
6095 if (failure_fmt == NULL) { | |
6096 const char *op_name; | |
6097 | |
6098 rx__op_get_name(&op_name, op); | |
6099 RX__STR_CREATE_3(status, | |
6100 failure_msg, | |
6101 "`%s` is expected to be %s `%s`", | |
6102 expr1, | |
6103 op_name, | |
6104 expr2); | |
6105 } else { | |
6106 RX__STR_CREATE_VA_LIST(status, failure_msg, failure_fmt); | |
6107 } | |
6108 | |
6109 if (status != RX_SUCCESS) { | |
6110 RX__LOG_DEBUG_2("failed to create the failure message for " | |
6111 "the pointer comparison test located at " | |
6112 "%s:%d\n", | |
6113 file, | |
6114 line); | |
6115 failure_msg = NULL; | |
6116 } | |
6117 | |
6118 rx__op_get_symbol(&op_symbol, op); | |
6119 RX__STR_CREATE_3(status, | |
6120 diagnostic_msg, | |
6121 "0x%08lx %s 0x%08lx", | |
6122 (uintptr_t)x1, | |
6123 op_symbol, | |
6124 (uintptr_t)x2); | |
6125 if (status != RX_SUCCESS) { | |
6126 RX__LOG_DEBUG_2("failed to create the diagnostic message for " | |
6127 "the pointer comparison test located at " | |
6128 "%s:%d\n", | |
6129 file, | |
6130 line); | |
6131 diagnostic_msg = NULL; | |
6132 } | |
6133 } | |
6134 | |
6135 if (rx_handle_test_result( | |
6136 context, result, file, line, severity, failure_msg, diagnostic_msg) | |
6137 != RX_SUCCESS) { | |
6138 RX__LOG_DEBUG_2("failed to handle the test result for the pointer " | |
6139 "comparison test located at %s:%d\n", | |
6140 file, | |
6141 line); | |
6142 } | |
6143 | |
6144 RX_FREE(failure_msg); | |
6145 RX_FREE(diagnostic_msg); | |
6146 | |
6147 if (!result && severity == RX_FATAL) { | |
6148 rx_abort(context); | |
6149 } | |
6150 } | |
6151 | |
6152 RX__PRINTF_CHECK(8, 0) | |
6153 RX__MAYBE_UNUSED static void | |
6154 rx__ptr_assess_alignment(struct rx_context *context, | |
6155 void *x, | |
6156 size_t alignment, | |
6157 const char *expr, | |
6158 const char *file, | |
6159 int line, | |
6160 enum rx_severity severity, | |
6161 const char *failure_fmt, | |
6162 ...) | |
6163 { | |
6164 int result; | |
6165 char *failure_msg; | |
6166 char *diagnostic_msg; | |
6167 | |
6168 RX_ASSERT(context != NULL); | |
6169 RX_ASSERT(expr != NULL); | |
6170 RX_ASSERT(file != NULL); | |
6171 | |
6172 result = (uintptr_t)x % alignment == 0; | |
6173 | |
6174 if (result) { | |
6175 failure_msg = NULL; | |
6176 diagnostic_msg = NULL; | |
6177 } else { | |
6178 enum rx_status status; | |
6179 | |
6180 if (failure_fmt == NULL) { | |
6181 RX__STR_CREATE_2(status, | |
6182 failure_msg, | |
6183 "`%s` is expected to have an %lu-byte alignment", | |
6184 expr, | |
6185 (unsigned long)alignment); | |
6186 } else { | |
6187 RX__STR_CREATE_VA_LIST(status, failure_msg, failure_fmt); | |
6188 } | |
6189 | |
6190 if (status != RX_SUCCESS) { | |
6191 RX__LOG_DEBUG_2("failed to create the failure message for " | |
6192 "the pointer alignment test located at " | |
6193 "%s:%d\n", | |
6194 file, | |
6195 line); | |
6196 failure_msg = NULL; | |
6197 } | |
6198 | |
6199 RX__STR_CREATE_2(status, | |
6200 diagnostic_msg, | |
6201 "0x%08lx %% %lu != 0", | |
6202 (uintptr_t)x, | |
6203 (unsigned long)alignment); | |
6204 if (status != RX_SUCCESS) { | |
6205 RX__LOG_DEBUG_2("failed to create the diagnostic message for " | |
6206 "the pointer alignment test located at " | |
6207 "%s:%d\n", | |
6208 file, | |
6209 line); | |
6210 diagnostic_msg = NULL; | |
6211 } | |
6212 } | |
6213 | |
6214 if (rx_handle_test_result( | |
6215 context, result, file, line, severity, failure_msg, diagnostic_msg) | |
6216 != RX_SUCCESS) { | |
6217 RX__LOG_DEBUG_2("failed to handle the test result for the pointer " | |
6218 "alignment test located at %s:%d\n", | |
6219 file, | |
6220 line); | |
6221 } | |
6222 | |
6223 RX_FREE(failure_msg); | |
6224 RX_FREE(diagnostic_msg); | |
6225 | |
6226 if (!result && severity == RX_FATAL) { | |
6227 rx_abort(context); | |
6228 } | |
6229 } | |
6230 | |
6231 /* Implementation: Public API O-(''Q) | |
6232 -------------------------------------------------------------------------- */ | |
6233 | |
6234 RX__MAYBE_UNUSED RX__STORAGE void | |
6235 rx_abort(struct rx_context *context) | |
6236 { | |
6237 longjmp(context->env, 1); | |
6238 } | |
6239 | |
6240 RX__MAYBE_UNUSED RX__STORAGE enum rx_status | |
6241 rx_handle_test_result(struct rx_context *context, | |
6242 int result, | |
6243 const char *file, | |
6244 int line, | |
6245 enum rx_severity severity, | |
6246 const char *failure_msg, | |
6247 const char *diagnostic_msg) | |
6248 { | |
6249 enum rx_status status; | |
6250 struct rx_summary *summary; | |
6251 struct rx_failure *failure; | |
6252 size_t failure_count; | |
6253 | |
6254 RX_ASSERT(context != NULL); | |
6255 RX_ASSERT(context->summary != NULL); | |
6256 RX_ASSERT(context->summary->failures != NULL); | |
6257 RX_ASSERT(file != NULL); | |
6258 | |
6259 summary = context->summary; | |
6260 | |
6261 ++summary->assessed_count; | |
6262 | |
6263 if (result) { | |
6264 return RX_SUCCESS; | |
6265 } | |
6266 | |
6267 status | |
6268 = rx__test_failure_array_extend_back(&failure, &summary->failures, 1); | |
6269 if (status != RX_SUCCESS) { | |
6270 summary->error = "failed to extend the test failure array\0"; | |
6271 RX__LOG_ERROR_2("failed to extend the test failure array for the test " | |
6272 "located at %s:%d\n", | |
6273 file, | |
6274 line); | |
6275 return status; | |
6276 } | |
6277 | |
6278 rx__test_failure_array_get_size(&failure_count, summary->failures); | |
6279 summary->failure_count = failure_count; | |
6280 | |
6281 { | |
6282 char *buf; | |
6283 | |
6284 status = rx__str_copy(&buf, file); | |
6285 if (status != RX_SUCCESS) { | |
6286 RX__LOG_ERROR_2("failed to allocate the file name for the test " | |
6287 "located at %s:%d\n", | |
6288 file, | |
6289 line); | |
6290 failure->file = NULL; | |
6291 } else { | |
6292 failure->file = buf; | |
6293 } | |
6294 } | |
6295 | |
6296 failure->line = line; | |
6297 failure->severity = severity; | |
6298 | |
6299 if (failure_msg == NULL) { | |
6300 failure->msg = NULL; | |
6301 } else { | |
6302 char *buf; | |
6303 | |
6304 status = rx__str_copy(&buf, failure_msg); | |
6305 if (status != RX_SUCCESS) { | |
6306 RX__LOG_ERROR_2("failed to allocate the failure message for " | |
6307 "the test located at %s:%d\n", | |
6308 file, | |
6309 line); | |
6310 failure->msg = NULL; | |
6311 } else { | |
6312 failure->msg = buf; | |
6313 } | |
6314 } | |
6315 | |
6316 if (diagnostic_msg == NULL) { | |
6317 failure->diagnostic_msg = NULL; | |
6318 } else { | |
6319 char *buf; | |
6320 | |
6321 status = rx__str_copy(&buf, diagnostic_msg); | |
6322 if (status != RX_SUCCESS) { | |
6323 RX__LOG_ERROR_2("failed to allocate the diagnostic message for " | |
6324 "the test located at %s:%d\n", | |
6325 file, | |
6326 line); | |
6327 failure->diagnostic_msg = NULL; | |
6328 } else { | |
6329 failure->diagnostic_msg = buf; | |
6330 } | |
6331 } | |
6332 | |
6333 return RX_SUCCESS; | |
6334 } | |
6335 | |
6336 RX__MAYBE_UNUSED RX__STORAGE enum rx_status | |
6337 rx_summary_initialize(struct rx_summary *summary, | |
6338 const struct rx_test_case *test_case) | |
6339 { | |
6340 enum rx_status status; | |
6341 | |
6342 RX_ASSERT(summary != NULL); | |
6343 RX_ASSERT(test_case != NULL); | |
6344 | |
6345 memset(summary, 0, sizeof *summary); | |
6346 | |
6347 status = rx__test_failure_array_create(&summary->failures, 0); | |
6348 if (status != RX_SUCCESS) { | |
6349 RX__LOG_ERROR_2("failed to create the test failure array " | |
6350 "(suite: \"%s\", case: \"%s\")\n", | |
6351 test_case->suite_name, | |
6352 test_case->name); | |
6353 return status; | |
6354 } | |
6355 | |
6356 summary->test_case = test_case; | |
6357 return RX_SUCCESS; | |
6358 } | |
6359 | |
6360 RX__MAYBE_UNUSED RX__STORAGE void | |
6361 rx_summary_terminate(struct rx_summary *summary) | |
6362 { | |
6363 size_t i; | |
6364 | |
6365 RX_ASSERT(summary != NULL); | |
6366 RX_ASSERT(summary->failures != NULL); | |
6367 | |
6368 for (i = 0; i < summary->failure_count; ++i) { | |
6369 const struct rx_failure *failure; | |
6370 | |
6371 failure = &summary->failures[i]; | |
6372 | |
6373 RX_FREE((void *)(uintptr_t)failure->file); | |
6374 RX_FREE((void *)(uintptr_t)failure->msg); | |
6375 RX_FREE((void *)(uintptr_t)failure->diagnostic_msg); | |
6376 } | |
6377 | |
6378 rx__test_failure_array_destroy(summary->failures); | |
6379 } | |
6380 | |
6381 RX__MAYBE_UNUSED RX__STORAGE void | |
6382 rx_summary_print(const struct rx_summary *summary) | |
6383 { | |
6384 size_t i; | |
6385 int passed; | |
6386 const char *style_begin; | |
6387 const char *style_end; | |
6388 | |
6389 RX_ASSERT(summary != NULL); | |
6390 RX_ASSERT(summary->test_case != NULL); | |
6391 RX_ASSERT(summary->test_case->suite_name != NULL); | |
6392 RX_ASSERT(summary->test_case->name != NULL); | |
6393 RX_ASSERT(summary->failures != NULL); | |
6394 | |
6395 passed = summary->failure_count == 0; | |
6396 | |
6397 #if RX__LOG_STYLING | |
6398 if (RX__ISATTY(RX__FILENO(stderr))) { | |
6399 rx__log_style_get_ansi_code( | |
6400 &style_begin, | |
6401 passed ? RX__LOG_STYLE_BRIGHT_GREEN : RX__LOG_STYLE_BRIGHT_RED); | |
6402 rx__log_style_get_ansi_code(&style_end, RX__LOG_STYLE_RESET); | |
6403 } else { | |
6404 style_begin = style_end = ""; | |
6405 } | |
6406 #else | |
6407 style_begin = style_end = ""; | |
6408 #endif | |
6409 | |
6410 fprintf(stderr, | |
6411 "[%s%s%s] \"%s\" / \"%s\" (%f ms)\n", | |
6412 style_begin, | |
6413 passed ? "PASSED" : "FAILED", | |
6414 style_end, | |
6415 summary->test_case->suite_name, | |
6416 summary->test_case->name, | |
6417 (double)summary->elapsed * (1000.0 / RX__TICKS_PER_SECOND)); | |
6418 | |
6419 for (i = 0; i < summary->failure_count; ++i) { | |
6420 const struct rx_failure *failure; | |
6421 const char *failure_msg; | |
6422 | |
6423 failure = &summary->failures[i]; | |
6424 failure_msg = failure->msg == NULL ? "" : failure->msg; | |
6425 | |
6426 if (failure->diagnostic_msg != NULL) { | |
6427 fprintf(stderr, | |
6428 "%s:%d: %s test failure: %s\n%s\n", | |
6429 failure->file, | |
6430 failure->line, | |
6431 failure->severity == RX_FATAL ? "fatal" : "nonfatal", | |
6432 failure_msg, | |
6433 failure->diagnostic_msg); | |
6434 } else { | |
6435 fprintf(stderr, | |
6436 "%s:%d: %s test failure: %s\n", | |
6437 failure->file, | |
6438 failure->line, | |
6439 failure->severity == RX_FATAL ? "fatal" : "nonfatal", | |
6440 failure_msg); | |
6441 } | |
6442 } | |
6443 } | |
6444 | |
6445 RX__MAYBE_UNUSED RX__STORAGE void | |
6446 rx_sort_summaries_by_test_suite(struct rx_summary *summaries, | |
6447 rx_size summary_count) | |
6448 { | |
6449 qsort(summaries, | |
6450 summary_count, | |
6451 sizeof *summaries, | |
6452 rx__compare_summaries_by_test_suite); | |
6453 } | |
6454 | |
6455 RX__MAYBE_UNUSED RX__STORAGE void | |
6456 rx_group_summaries_by_test_suite(rx_size *summary_group_count, | |
6457 struct rx_summary_group *summary_groups, | |
6458 rx_size summary_count, | |
6459 const struct rx_summary *summaries) | |
6460 { | |
6461 size_t i; | |
6462 struct rx_summary_group *it; | |
6463 | |
6464 RX_ASSERT(summary_group_count != NULL); | |
6465 | |
6466 if (summary_count == 0) { | |
6467 *summary_group_count = 0; | |
6468 return; | |
6469 } | |
6470 | |
6471 RX_ASSERT(summaries != NULL); | |
6472 | |
6473 if (summary_groups == NULL) { | |
6474 *summary_group_count = 1; | |
6475 for (i = 0; i < summary_count - 1; ++i) { | |
6476 *summary_group_count += (rx_size)( | |
6477 rx__compare_summaries_by_test_suite(&summaries[i], | |
6478 &summaries[i + 1]) | |
6479 != 0); | |
6480 } | |
6481 | |
6482 return; | |
6483 } | |
6484 | |
6485 it = summary_groups; | |
6486 it->count = 0; | |
6487 it->array = summaries; | |
6488 for (i = 0; i < summary_count - 1; ++i) { | |
6489 ++it->count; | |
6490 | |
6491 if (rx__compare_summaries_by_test_suite(&summaries[i], | |
6492 &summaries[i + 1]) | |
6493 != 0) { | |
6494 ++it; | |
6495 it->count = 0; | |
6496 it->array = &summaries[i + 1]; | |
6497 } | |
6498 } | |
6499 | |
6500 ++it->count; | |
6501 } | |
6502 | |
6503 RX__MAYBE_UNUSED RX__STORAGE enum rx_status | |
6504 rx_test_case_run(struct rx_summary *summary, | |
6505 const struct rx_test_case *test_case) | |
6506 { | |
6507 enum rx_status status; | |
6508 struct rx_context context; | |
6509 void *data; | |
6510 uint64_t time_begin; | |
6511 uint64_t time_end; | |
6512 | |
6513 RX_ASSERT(summary != NULL); | |
6514 RX_ASSERT(test_case != NULL); | |
6515 RX_ASSERT(test_case->suite_name != NULL); | |
6516 RX_ASSERT(test_case->name != NULL); | |
6517 RX_ASSERT(test_case->run != NULL); | |
6518 | |
6519 if (test_case->config.skip) { | |
6520 summary->skipped = 1; | |
6521 return RX_SUCCESS; | |
6522 } | |
6523 | |
6524 status = RX_SUCCESS; | |
6525 context.summary = summary; | |
6526 | |
6527 if (test_case->config.fixture.size > 0) { | |
6528 data = RX_MALLOC(test_case->config.fixture.size); | |
6529 if (data == NULL) { | |
6530 summary->error = "failed to allocate the data\0"; | |
6531 RX__LOG_ERROR_2("failed to allocate the data" | |
6532 "(suite: \"%s\", case: \"%s\")\n", | |
6533 test_case->suite_name, | |
6534 test_case->name); | |
6535 return RX_ERROR_ALLOCATION; | |
6536 } | |
6537 } else { | |
6538 data = NULL; | |
6539 } | |
6540 | |
6541 if (test_case->config.fixture.config.set_up != NULL) { | |
6542 status = test_case->config.fixture.config.set_up(&context, data); | |
6543 if (status != RX_SUCCESS) { | |
6544 summary->error = "failed to set-up the fixture\0"; | |
6545 RX__LOG_ERROR_2("failed to set-up the fixture " | |
6546 "(suite: \"%s\", case: \"%s\")\n", | |
6547 test_case->suite_name, | |
6548 test_case->name); | |
6549 goto data_cleanup; | |
6550 } | |
6551 } | |
6552 | |
6553 if (rx__get_real_time(&time_begin) != RX_SUCCESS) { | |
6554 time_begin = (uint64_t)-1; | |
6555 } | |
6556 | |
6557 if (setjmp(context.env) == 0) { | |
6558 test_case->run(&context, data); | |
6559 } | |
6560 | |
6561 if (time_begin == (uint64_t)-1 | |
6562 || rx__get_real_time(&time_end) != RX_SUCCESS) { | |
6563 RX__LOG_ERROR_2("failed to measure the time elapsed " | |
6564 "(suite: \"%s\", case: \"%s\")\n", | |
6565 test_case->suite_name, | |
6566 test_case->name); | |
6567 summary->elapsed = 0; | |
6568 } else { | |
6569 RX_ASSERT(time_end >= time_begin); | |
6570 summary->elapsed = (rx_uint64)(time_end - time_begin); | |
6571 } | |
6572 | |
6573 if (test_case->config.fixture.config.tear_down != NULL) { | |
6574 test_case->config.fixture.config.tear_down(&context, data); | |
6575 } | |
6576 | |
6577 data_cleanup: | |
6578 RX_FREE(data); | |
6579 return status; | |
6580 } | |
6581 | |
6582 RX__MAYBE_UNUSED RX__STORAGE void | |
6583 rx_enumerate_test_cases(rx_size *test_case_count, | |
6584 struct rx_test_case *test_cases) | |
6585 { | |
6586 size_t i; | |
6587 const struct rx__test_case_desc * const *c_it; | |
6588 | |
6589 RX_ASSERT(test_case_count != NULL); | |
6590 | |
6591 if (test_cases == NULL) { | |
6592 *test_case_count = 0; | |
6593 for (c_it = RX__TEST_CASE_SECTION_BEGIN; | |
6594 c_it != RX__TEST_CASE_SECTION_END; | |
6595 ++c_it) { | |
6596 *test_case_count += (rx_size)(*c_it != NULL); | |
6597 } | |
6598 | |
6599 return; | |
6600 } | |
6601 | |
6602 i = 0; | |
6603 for (c_it = RX__TEST_CASE_SECTION_BEGIN; | |
6604 c_it != RX__TEST_CASE_SECTION_END; | |
6605 ++c_it) { | |
6606 const struct rx__test_suite_desc * const *s_it; | |
6607 struct rx__test_case_config_blueprint config_blueprint; | |
6608 struct rx_test_case *test_case; | |
6609 | |
6610 if (*c_it == NULL) { | |
6611 continue; | |
6612 } | |
6613 | |
6614 /* Find the corresponding test suite description, if any. */ | |
6615 for (s_it = RX__TEST_SUITE_SECTION_BEGIN; | |
6616 s_it != RX__TEST_SUITE_SECTION_END; | |
6617 ++s_it) { | |
6618 if (*s_it == NULL) { | |
6619 continue; | |
6620 } | |
6621 | |
6622 if (strcmp((*s_it)->name, (*c_it)->suite_name) == 0) { | |
6623 break; | |
6624 } | |
6625 } | |
6626 | |
6627 memset(&config_blueprint, 0, sizeof config_blueprint); | |
6628 | |
6629 if (s_it != RX__TEST_SUITE_SECTION_END | |
6630 && (*s_it)->config_desc != NULL) { | |
6631 /* Inherit the config from the test suite's description. */ | |
6632 (*s_it)->config_desc->update(&config_blueprint); | |
6633 } | |
6634 | |
6635 if ((*c_it)->config_desc != NULL) { | |
6636 /* Inherit the config from the test case's description. */ | |
6637 (*c_it)->config_desc->update(&config_blueprint); | |
6638 } | |
6639 | |
6640 test_case = &test_cases[i]; | |
6641 | |
6642 test_case->suite_name = (*c_it)->suite_name; | |
6643 test_case->name = (*c_it)->name; | |
6644 test_case->run = (*c_it)->run; | |
6645 | |
6646 test_case->config.skip = config_blueprint.skip; | |
6647 | |
6648 memset(&test_case->config.fixture, 0, sizeof test_case->config.fixture); | |
6649 | |
6650 if (config_blueprint.fixture != NULL) { | |
6651 test_case->config.fixture.size = config_blueprint.fixture->size; | |
6652 | |
6653 if (config_blueprint.fixture->update != NULL) { | |
6654 config_blueprint.fixture->update( | |
6655 &test_case->config.fixture.config); | |
6656 } | |
6657 } | |
6658 | |
6659 ++i; | |
6660 } | |
6661 | |
6662 RX_ASSERT(i == *test_case_count); | |
6663 | |
6664 /* Objects that are defined in a custom memory section can only be retrieved | |
6665 in an undefined order, so these need to be manually sorted afterwards | |
6666 in a sensible way. */ | |
6667 qsort(test_cases, | |
6668 *test_case_count, | |
6669 sizeof *test_cases, | |
6670 rx__compare_test_cases); | |
6671 } | |
6672 | |
6673 RX__MAYBE_UNUSED RX__STORAGE enum rx_status | |
6674 rx_run(rx_size test_case_count, const struct rx_test_case *test_cases) | |
6675 { | |
6676 if (test_cases != NULL) { | |
6677 return rx__run_test_cases(test_case_count, test_cases); | |
6678 } | |
6679 | |
6680 /* If no test cases are explicitly passed, fallback to discovering the | |
6681 ones defined through the automatic registration framework. */ | |
6682 return rx__run_registered_test_cases(); | |
6683 } | |
6684 | |
6685 RX__MAYBE_UNUSED RX__STORAGE enum rx_status | |
6686 rx_main(rx_size test_case_count, | |
6687 const struct rx_test_case *test_cases, | |
6688 int argc, | |
6689 const char **argv) | |
6690 { | |
6691 RX__UNUSED(argc); | |
6692 RX__UNUSED(argv); | |
6693 | |
6694 return rx_run(test_case_count, test_cases); | |
6695 } | |
6696 | |
6697 #endif /* REXO_REXO_H */ |