diff --git a/docs/html/picotest_8h_source.html b/docs/html/picotest_8h_source.html index 314b2db..9398da5 100644 --- a/docs/html/picotest_8h_source.html +++ b/docs/html/picotest_8h_source.html @@ -70,7 +70,7 @@
picotest.h
-Go to the documentation of this file.
1 
48 #ifndef _PICOTEST
49 #define _PICOTEST
50 
51 #include <setjmp.h>
52 #include <stdarg.h>
53 #include <string.h>
54 
55 #if defined(_MSC_VER)
56 
62 #define _PICOTEST_PARENS
63 #endif /* defined(_MSC_VER) */
64 
78 #define PICOTEST_VERSION "1.3.0"
79 #define PICOTEST_VERSION_MAJOR 1
80 #define PICOTEST_VERSION_MINOR 3
81 #define PICOTEST_VERSION_PATCH 0
82 
104 typedef int(PicoTestProc)(const char *cond);
105 
109 typedef struct PicoTestMetadata {
110  const char *name;
111  const char *file;
112  int line;
115  const struct PicoTestMetadata *
116  *subtests;
119 
127 #define PICOTEST_EXTERN(_testName) \
128  PicoTestProc _testName; \
129  PicoTestMetadata _PICOTEST_METADATA(_testName);
130 
141 #define PICOTEST_METADATA(_testName) &_PICOTEST_METADATA(_testName)
142 
144 #define _PICOTEST_METADATA(_testName) _testName##_metadata
145 #define _PICOTEST_TEST_DECLARE(_testName, _nbSubtests, _subtests) \
146  PicoTestProc _testName; \
147  PicoTestMetadata _PICOTEST_METADATA(_testName) = { \
148  _PICOTEST_STRINGIZE(_testName), \
149  __FILE__, \
150  __LINE__, \
151  _testName, \
152  _nbSubtests, \
153  _subtests};
154 
175 typedef enum PicoTestFilterResult {
179 
182 
186 
190 
216  const char *testName,
217  const char *cond);
218 
229 static PicoTestFilterResult _picoTest_filterByName(PicoTestProc *test,
230  const char *testName,
231  const char *cond) {
232  return (strcmp(testName, cond) == 0 ? PICOTEST_FILTER_PASS
234 }
235 
245 #define PICOTEST_FILTER_DEFAULT _picoTest_filterByName
246 
271 #define PICOTEST_FILTER PICOTEST_FILTER_DEFAULT
272 
299 typedef void(PicoTestTraverseProc)(const char *name, int nb);
300 
317 #define PICOTEST_TRAVERSE(_testName, _proc) \
318  _picoTest_traverse(PICOTEST_METADATA(_testName), _proc)
319 
330 static void _picoTest_traverse(const PicoTestMetadata *metadata,
331  PicoTestTraverseProc *proc) {
332  const PicoTestMetadata **subtest = metadata->subtests;
333  proc(metadata->name, metadata->nbSubtests);
334  if (metadata->nbSubtests) {
335  for (; *subtest; subtest++) {
336  _picoTest_traverse(*subtest, proc);
337  }
338  }
339 }
340 
347 typedef enum PicoTestVisitStep {
350 
354 
366 typedef void(PicoTestVisitProc)(const PicoTestMetadata *metadata,
367  PicoTestVisitStep step);
368 
383 #define PICOTEST_VISIT(_testName, _proc) \
384  _picoTest_visit(PICOTEST_METADATA(_testName), _proc)
385 
396 static void _picoTest_visit(const PicoTestMetadata *metadata,
397  PicoTestVisitProc *proc) {
398  const PicoTestMetadata **subtest = metadata->subtests;
399  proc(metadata, PICOTEST_VISIT_ENTER);
400  if (metadata->nbSubtests) {
401  for (; *subtest; subtest++) {
402  _picoTest_visit(*subtest, proc);
403  }
404  }
405  proc(metadata, PICOTEST_VISIT_LEAVE);
406 }
407 
438 typedef void(PicoTestFailureLoggerProc)(const char *file, int line,
439  const char *type, const char *test,
440  const char *msg, va_list args);
441 
449 static void _picoTest_logFailure(const char *file, int line, const char *type,
450  const char *test, const char *msg,
451  va_list args) {}
452 
459 #define PICOTEST_FAILURE_LOGGER_DEFAULT _picoTest_logFailure
460 
480 #define PICOTEST_FAILURE_LOGGER PICOTEST_FAILURE_LOGGER_DEFAULT
481 
519 #if defined(_PICOTEST_PARENS)
520 #define PICOTEST_CASE(...) \
521  _PICOTEST_CONCATENATE(_PICOTEST_CASE_, _PICOTEST_ARGCOUNT(__VA_ARGS__)) \
522  _PICOTEST_PARENS(__VA_ARGS__)
523 #else
524 #define PICOTEST_CASE(...) \
525  _PICOTEST_CONCATENATE(_PICOTEST_CASE_, _PICOTEST_ARGCOUNT(__VA_ARGS__)) \
526  (__VA_ARGS__)
527 #endif /* defined(_PICOTEST_PARENS) */
528 
530 #define _PICOTEST_CASE_DECLARE(_testName) \
531  _PICOTEST_TEST_DECLARE(_testName, 0, NULL); \
532  static int _testName##_testCaseRunner(void); \
533  int _testName(const char *cond) { \
534  int fail = 0; \
535  PicoTestFilterResult filterResult = \
536  (cond == NULL) \
537  ? PICOTEST_FILTER_PASS \
538  : PICOTEST_FILTER(_testName, _PICOTEST_STRINGIZE(_testName), \
539  cond); \
540  switch (filterResult) { \
541  case PICOTEST_FILTER_PASS: \
542  case PICOTEST_FILTER_PASS_PROPAGATE: \
543  fail += _testName##_testCaseRunner(); \
544  break; \
545  } \
546  return fail; \
547  }
548 
549 #define _PICOTEST_CASE_RUNNER_BEGIN(_testName) \
550  static int _testName##_testCaseRunner() { \
551  int abort; \
552  jmp_buf failureEnv; \
553  jmp_buf *oldEnv = _picoTest_failureEnv; \
554  int fail, oldFail = _picoTest_fail; \
555  _picoTest_failureEnv = &failureEnv; \
556  _picoTest_fail = 0; \
557  PICOTEST_CASE_ENTER(_PICOTEST_STRINGIZE(_testName)); \
558  abort = setjmp(failureEnv);
559 
560 #define _PICOTEST_CASE_RUNNER_END(_testName) \
561  fail = _picoTest_fail; \
562  PICOTEST_CASE_LEAVE(_PICOTEST_STRINGIZE(_testName), fail); \
563  _picoTest_failureEnv = oldEnv; \
564  _picoTest_fail = oldFail; \
565  return fail; \
566  }
567 
568 #define _PICOTEST_CASE_1(_testName) \
569  _PICOTEST_CASE_DECLARE(_testName) \
570  static void _testName##_testCase(void); \
571  _PICOTEST_CASE_RUNNER_BEGIN(_testName) \
572  if (!abort) { \
573  _testName##_testCase(); \
574  } \
575  _PICOTEST_CASE_RUNNER_END(_testName) \
576  static void _testName##_testCase(void)
577 
578 #define _PICOTEST_CASE_2(_testName, _fixtureName) \
579  _PICOTEST_CASE_DECLARE(_testName) \
580  static void _testName##_testCase(void); \
581  _PICOTEST_CASE_RUNNER_BEGIN(_testName) \
582  if (!abort) { \
583  _PICOTEST_FIXTURE_CALL_SETUP(_fixtureName, _testName, NULL); \
584  _testName##_testCase(); \
585  } \
586  _PICOTEST_FIXTURE_CALL_TEARDOWN(_fixtureName, _testName, NULL, \
587  _picoTest_fail); \
588  _PICOTEST_CASE_RUNNER_END(_testName) \
589  static void _testName##_testCase()
590 
591 #define _PICOTEST_CASE_3(_testName, _fixtureName, _context) \
592  _PICOTEST_CASE_DECLARE(_testName) \
593  static void _testName##_testCase(struct _fixtureName##_Context *); \
594  _PICOTEST_CASE_RUNNER_BEGIN(_testName) { \
595  struct _fixtureName##_Context context; \
596  if (!abort) { \
597  _PICOTEST_FIXTURE_CALL_SETUP(_fixtureName, _testName, &context); \
598  _testName##_testCase(&context); \
599  } \
600  _PICOTEST_FIXTURE_CALL_TEARDOWN(_fixtureName, _testName, &context, \
601  _picoTest_fail); \
602  } \
603  _PICOTEST_CASE_RUNNER_END(_testName) \
604  static void _testName##_testCase(struct _fixtureName##_Context *_context)
605 
632 typedef void(PicoTestCaseEnterProc)(const char *testName);
633 
640 #define PICOTEST_CASE_ENTER_DEFAULT(testName)
641 
662 #define PICOTEST_CASE_ENTER PICOTEST_CASE_ENTER_DEFAULT
663 
680 typedef void(PicoTestCaseLeaveProc)(const char *testName, int fail);
681 
688 #define PICOTEST_CASE_LEAVE_DEFAULT(testName, fail)
689 
710 #define PICOTEST_CASE_LEAVE PICOTEST_CASE_LEAVE_DEFAULT
711 
750 #define PICOTEST_ASSERT(x, /* msg, */...) \
751  { _PICOTEST_ASSERT(x, #x, ##__VA_ARGS__); }
752 
754 #define _PICOTEST_ASSERT(x, ...) \
755  PICOTEST_ASSERT_BEFORE("ASSERT", #x); \
756  { \
757  int _PICOTEST_FAIL = !(x); \
758  PICOTEST_ASSERT_AFTER("ASSERT", #x, _PICOTEST_FAIL); \
759  if (_PICOTEST_FAIL) { \
760  PICOTEST_FAILURE("ASSERT", ##__VA_ARGS__); \
761  PICOTEST_ABORT(); \
762  } \
763  }
764 
787 #define PICOTEST_VERIFY(x, /* msg, */...) \
788  { _PICOTEST_VERIFY(x, #x, ##__VA_ARGS__); }
789 
791 #define _PICOTEST_VERIFY(x, ...) \
792  PICOTEST_ASSERT_BEFORE("VERIFY", #x); \
793  { \
794  int _PICOTEST_FAIL = !(x); \
795  PICOTEST_ASSERT_AFTER("VERIFY", #x, _PICOTEST_FAIL); \
796  if (_PICOTEST_FAIL) { \
797  PICOTEST_FAILURE("VERIFY", ##__VA_ARGS__); \
798  } \
799  }
800 
815 #define PICOTEST_FAILURE(type, test, /* msg, */...) \
816  _PICOTEST_FAILURE(type, test, ##__VA_ARGS__)
817 
819 #define _PICOTEST_FAILURE(type, ...) \
820  _picoTest_fail++; \
821  _picoTest_assertFailed(PICOTEST_FAILURE_LOGGER, __FILE__, __LINE__, type, \
822  _PICOTEST_ARGCOUNT(__VA_ARGS__), __VA_ARGS__); \
823 
830 static int _picoTest_fail = 0;
831 
838 static jmp_buf *_picoTest_failureEnv = NULL;
839 
847 #define PICOTEST_ABORT() longjmp(*_picoTest_failureEnv, 1)
848 
863 static void _picoTest_assertFailed(PicoTestFailureLoggerProc *proc,
864  const char *file, int line, const char *type,
865  int count, const char *test, ...) {
866  if (count > 1) {
867  /* Extra args after **test** */
868  va_list args;
869  const char *msg;
870  va_start(args, test);
871  msg = va_arg(args, const char *);
872  proc(file, line, type, test, msg, args);
873  } else {
874  proc(file, line, type, test, NULL, NULL);
875  }
876 }
877 
904 typedef void(PicoTestAssertBeforeProc)(const char *type, const char *test);
905 
912 #define PICOTEST_ASSERT_BEFORE_DEFAULT(type, test)
913 
934 #define PICOTEST_ASSERT_BEFORE PICOTEST_ASSERT_BEFORE_DEFAULT
935 
953 typedef void(PicoTestAssertAfterProc)(const char *type, const char *test,
954  int fail);
955 
962 #define PICOTEST_ASSERT_AFTER_DEFAULT(type, test, fail)
963 
984 #define PICOTEST_ASSERT_AFTER PICOTEST_ASSERT_AFTER_DEFAULT
985 
1023 #define PICOTEST_FIXTURE_CONTEXT(_fixtureName) struct _fixtureName##_Context
1024 
1053 #if defined(_PICOTEST_PARENS)
1054 #define PICOTEST_FIXTURE_SETUP(...) \
1055  _PICOTEST_CONCATENATE(_PICOTEST_FIXTURE_SETUP_, \
1056  _PICOTEST_ARGCOUNT(__VA_ARGS__)) \
1057  _PICOTEST_PARENS(__VA_ARGS__)
1058 #else
1059 #define PICOTEST_FIXTURE_SETUP(...) \
1060  _PICOTEST_CONCATENATE(_PICOTEST_FIXTURE_SETUP_, \
1061  _PICOTEST_ARGCOUNT(__VA_ARGS__)) \
1062  (__VA_ARGS__)
1063 #endif /* defined(_PICOTEST_PARENS) */
1064 
1066 #define _PICOTEST_FIXTURE_SETUP_1(_fixtureName) \
1067  static void _fixtureName##_setup(void *_fixtureName##_DUMMY)
1068 
1069 #define _PICOTEST_FIXTURE_SETUP_2(_fixtureName, _context) \
1070  static void _fixtureName##_setup(struct _fixtureName##_Context *_context)
1071 
1072 #define _PICOTEST_FIXTURE_CALL_SETUP(_fixtureName, _testName, context) \
1073  PICOTEST_FIXTURE_BEFORE_SETUP(_PICOTEST_STRINGIZE(_fixtureName), \
1074  _PICOTEST_STRINGIZE(_testName)); \
1075  _fixtureName##_setup(context); \
1076  PICOTEST_FIXTURE_AFTER_SETUP(_PICOTEST_STRINGIZE(_fixtureName), \
1077  _PICOTEST_STRINGIZE(_testName));
1078 
1108 #if defined(_PICOTEST_PARENS)
1109 #define PICOTEST_FIXTURE_TEARDOWN(...) \
1110  _PICOTEST_CONCATENATE(_PICOTEST_FIXTURE_TEARDOWN_, \
1111  _PICOTEST_ARGCOUNT(__VA_ARGS__)) \
1112  _PICOTEST_PARENS(__VA_ARGS__)
1113 #else
1114 #define PICOTEST_FIXTURE_TEARDOWN(...) \
1115  _PICOTEST_CONCATENATE(_PICOTEST_FIXTURE_TEARDOWN_, \
1116  _PICOTEST_ARGCOUNT(__VA_ARGS__)) \
1117  (__VA_ARGS__)
1118 #endif /* defined(_PICOTEST_PARENS) */
1119 
1121 #define _PICOTEST_FIXTURE_TEARDOWN_1(_fixtureName) \
1122  static void _fixtureName##_teardown(int PICOTEST_FAIL, \
1123  void *_fixtureName##_DUMMY)
1124 
1125 #define _PICOTEST_FIXTURE_TEARDOWN_2(_fixtureName, _context) \
1126  static void _fixtureName##_teardown( \
1127  int PICOTEST_FAIL, struct _fixtureName##_Context *_context)
1128 
1129 #define _PICOTEST_FIXTURE_CALL_TEARDOWN(_fixtureName, _testName, context, \
1130  fail) \
1131  PICOTEST_FIXTURE_BEFORE_TEARDOWN(_PICOTEST_STRINGIZE(_fixtureName), \
1132  _PICOTEST_STRINGIZE(_testName), fail); \
1133  _fixtureName##_teardown(fail, context); \
1134  PICOTEST_FIXTURE_AFTER_TEARDOWN(_PICOTEST_STRINGIZE(_fixtureName), \
1135  _PICOTEST_STRINGIZE(_testName), fail); \
1136 
1164 typedef void(PicoTestFixtureBeforeSetupProc)(const char *fixtureName,
1165  const char *testName);
1166 
1173 #define PICOTEST_FIXTURE_BEFORE_SETUP_DEFAULT(fixtureName, testName)
1174 
1195 #define PICOTEST_FIXTURE_BEFORE_SETUP PICOTEST_FIXTURE_BEFORE_SETUP_DEFAULT
1196 
1213 typedef void(PicoTestFixtureAfterSetupProc)(const char *fixtureName,
1214  const char *testName);
1215 
1222 #define PICOTEST_FIXTURE_AFTER_SETUP_DEFAULT(fixtureName, testName)
1223 
1244 #define PICOTEST_FIXTURE_AFTER_SETUP PICOTEST_FIXTURE_AFTER_SETUP_DEFAULT
1245 
1263 typedef void(PicoTestFixtureBeforeTeardownProc)(const char *fixtureName,
1264  const char *testName, int fail);
1265 
1272 #define PICOTEST_FIXTURE_BEFORE_TEARDOWN_DEFAULT(fixtureName, testName, fail)
1273 
1294 #define PICOTEST_FIXTURE_BEFORE_TEARDOWN \
1295  PICOTEST_FIXTURE_BEFORE_TEARDOWN_DEFAULT
1296 
1314 typedef void(PicoTestFixtureAfterTeardownProc)(const char *fixtureName,
1315  const char *testName, int fail);
1316 
1323 #define PICOTEST_FIXTURE_AFTER_TEARDOWN_DEFAULT(fixtureName, testName, fail)
1324 
1345 #define PICOTEST_FIXTURE_AFTER_TEARDOWN PICOTEST_FIXTURE_AFTER_TEARDOWN_DEFAULT
1346 
1386 #define PICOTEST_SUITE(_suiteName, ...) \
1387  _PICOTEST_FOR_EACH(_PICOTEST_SUITE_DECLARE_SUBTEST, __VA_ARGS__) \
1388  static PicoTestMetadata *_suiteName##_subtests[] = {_PICOTEST_FOR_EACH( \
1389  _PICOTEST_SUITE_ENUMERATE_SUBTEST, __VA_ARGS__) NULL}; \
1390  _PICOTEST_TEST_DECLARE(_suiteName, _PICOTEST_ARGCOUNT(__VA_ARGS__), \
1391  _suiteName##_subtests); \
1392  static int _suiteName##_testSuiteRunner(const char *cond) { \
1393  const int nb = _PICOTEST_ARGCOUNT(__VA_ARGS__); \
1394  PicoTestMetadata **subtest = _suiteName##_subtests; \
1395  int fail = 0; \
1396  PICOTEST_SUITE_ENTER(_PICOTEST_STRINGIZE(_suiteName), nb); \
1397  for (; *subtest; subtest++) { \
1398  const int index = (int)(subtest - _suiteName##_subtests); \
1399  int sfail = 0; \
1400  PICOTEST_SUITE_BEFORE_SUBTEST(_PICOTEST_STRINGIZE(_suiteName), nb, \
1401  fail, index, (*subtest)->name); \
1402  sfail = (*subtest)->test(cond); \
1403  fail += sfail; \
1404  PICOTEST_SUITE_AFTER_SUBTEST(_PICOTEST_STRINGIZE(_suiteName), nb, \
1405  fail, index, (*subtest)->name, \
1406  sfail); \
1407  } \
1408  PICOTEST_SUITE_LEAVE(_PICOTEST_STRINGIZE(_suiteName), nb, fail); \
1409  return fail; \
1410  } \
1411  int _suiteName(const char *cond) { \
1412  int fail = 0; \
1413  PicoTestFilterResult filterResult = \
1414  (cond == NULL) \
1415  ? PICOTEST_FILTER_PASS \
1416  : PICOTEST_FILTER(_suiteName, _PICOTEST_STRINGIZE(_suiteName), \
1417  cond); \
1418  switch (filterResult) { \
1419  case PICOTEST_FILTER_PASS: \
1420  cond = NULL; \
1421  case PICOTEST_FILTER_PASS_PROPAGATE: \
1422  fail += _suiteName##_testSuiteRunner(cond); \
1423  break; \
1424  case PICOTEST_FILTER_SKIP: \
1425  break; \
1426  case PICOTEST_FILTER_SKIP_PROPAGATE: { \
1427  PicoTestMetadata **subtest = _suiteName##_subtests; \
1428  for (; *subtest; subtest++) { \
1429  fail += (*subtest)->test(cond); \
1430  } \
1431  } break; \
1432  } \
1433  return fail; \
1434  }
1435 
1437 #define _PICOTEST_SUITE_DECLARE_SUBTEST(_testName) \
1438  PicoTestMetadata _PICOTEST_METADATA(_testName);
1439 #define _PICOTEST_SUITE_ENUMERATE_SUBTEST(_testName) \
1440  PICOTEST_METADATA(_testName),
1441 
1470 typedef void(PicoTestSuiteEnterProc)(const char *suiteName, int nb);
1471 
1478 #define PICOTEST_SUITE_ENTER_DEFAULT(suiteName, nb)
1479 
1500 #define PICOTEST_SUITE_ENTER PICOTEST_SUITE_ENTER_DEFAULT
1501 
1518 typedef void(PicoTestSuiteLeaveProc)(const char *suiteName, int nb, int fail);
1519 
1526 #define PICOTEST_SUITE_LEAVE_DEFAULT(suiteName, nb, fail)
1527 
1550 #define PICOTEST_SUITE_LEAVE PICOTEST_SUITE_LEAVE_DEFAULT
1551 
1572 typedef void(PicoTestSuiteBeforeSubtestProc)(const char *suiteName, int nb,
1573  int fail, int index,
1574  const char *testName);
1575 
1582 #define PICOTEST_SUITE_BEFORE_SUBTEST_DEFAULT(suiteName, nb, fail, index, \
1583  testName)
1584 
1605 #define PICOTEST_SUITE_BEFORE_SUBTEST PICOTEST_SUITE_BEFORE_SUBTEST_DEFAULT
1606 
1629 typedef void(PicoTestSuiteAfterSubtestProc)(const char *suiteName, int nb,
1630  int fail, int index,
1631  const char *testName, int sfail);
1632 
1639 #define PICOTEST_SUITE_AFTER_SUBTEST_DEFAULT(suiteName, nb, fail, index, \
1640  testName, sfail)
1641 
1662 #define PICOTEST_SUITE_AFTER_SUBTEST PICOTEST_SUITE_AFTER_SUBTEST_DEFAULT
1663 
1685 #define _PICOTEST_STRINGIZE(arg) #arg
1686 
1690 #define _PICOTEST_CONCATENATE(arg1, arg2) _PICOTEST_CONCATENATE1(arg1, arg2)
1691 
1693 #define _PICOTEST_CONCATENATE1(arg1, arg2) _PICOTEST_CONCATENATE2(arg1, arg2)
1694 #define _PICOTEST_CONCATENATE2(arg1, arg2) arg1##arg2
1695 
1717 #if defined(_PICOTEST_PARENS)
1718 #define _PICOTEST_ARGCOUNT(...) \
1719  _PICOTEST_LASTARG _PICOTEST_PARENS( \
1720  __VA_ARGS__, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, \
1721  49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, \
1722  32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, \
1723  15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0)
1724 #else
1725 #define _PICOTEST_ARGCOUNT(...) \
1726  _PICOTEST_LASTARG(__VA_ARGS__, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, \
1727  52, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, \
1728  38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, \
1729  24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, \
1730  10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0)
1731 #endif /* defined(_PICOTEST_PARENS) */
1732 
1734 #define _PICOTEST_LASTARG( \
1735  _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, \
1736  _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, \
1737  _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, \
1738  _47, _48, _49, _50, _51, _52, _53, _54, _55, _56, _57, _58, _59, _60, _61, \
1739  _62, _63, N, ...) \
1740  N
1741 
1753 #if defined(_PICOTEST_PARENS)
1754 #define _PICOTEST_FOR_EACH(what, ...) \
1755  _PICOTEST_CONCATENATE(_PICOTEST_FOR_EACH_, \
1756  _PICOTEST_ARGCOUNT(__VA_ARGS__)) \
1757  _PICOTEST_PARENS(what, __VA_ARGS__)
1758 #else
1759 #define _PICOTEST_FOR_EACH(what, ...) \
1760  _PICOTEST_CONCATENATE(_PICOTEST_FOR_EACH_, \
1761  _PICOTEST_ARGCOUNT(__VA_ARGS__)) \
1762  (what, __VA_ARGS__)
1763 #endif /* defined(_PICOTEST_PARENS) */
1764 
1766 #if defined(_PICOTEST_PARENS)
1767 #define _PICOTEST_FOR_EACH_1(what, x) what(x)
1768 #define _PICOTEST_FOR_EACH_2(what, x, ...) \
1769  what(x) _PICOTEST_FOR_EACH_1 _PICOTEST_PARENS(what, __VA_ARGS__)
1770 #define _PICOTEST_FOR_EACH_3(what, x, ...) \
1771  what(x) _PICOTEST_FOR_EACH_2 _PICOTEST_PARENS(what, __VA_ARGS__)
1772 #define _PICOTEST_FOR_EACH_4(what, x, ...) \
1773  what(x) _PICOTEST_FOR_EACH_3 _PICOTEST_PARENS(what, __VA_ARGS__)
1774 #define _PICOTEST_FOR_EACH_5(what, x, ...) \
1775  what(x) _PICOTEST_FOR_EACH_4 _PICOTEST_PARENS(what, __VA_ARGS__)
1776 #define _PICOTEST_FOR_EACH_6(what, x, ...) \
1777  what(x) _PICOTEST_FOR_EACH_5 _PICOTEST_PARENS(what, __VA_ARGS__)
1778 #define _PICOTEST_FOR_EACH_7(what, x, ...) \
1779  what(x) _PICOTEST_FOR_EACH_6 _PICOTEST_PARENS(what, __VA_ARGS__)
1780 #define _PICOTEST_FOR_EACH_8(what, x, ...) \
1781  what(x) _PICOTEST_FOR_EACH_7 _PICOTEST_PARENS(what, __VA_ARGS__)
1782 #define _PICOTEST_FOR_EACH_9(what, x, ...) \
1783  what(x) _PICOTEST_FOR_EACH_8 _PICOTEST_PARENS(what, __VA_ARGS__)
1784 #define _PICOTEST_FOR_EACH_10(what, x, ...) \
1785  what(x) _PICOTEST_FOR_EACH_9 _PICOTEST_PARENS(what, __VA_ARGS__)
1786 #define _PICOTEST_FOR_EACH_11(what, x, ...) \
1787  what(x) _PICOTEST_FOR_EACH_10 _PICOTEST_PARENS(what, __VA_ARGS__)
1788 #define _PICOTEST_FOR_EACH_12(what, x, ...) \
1789  what(x) _PICOTEST_FOR_EACH_11 _PICOTEST_PARENS(what, __VA_ARGS__)
1790 #define _PICOTEST_FOR_EACH_13(what, x, ...) \
1791  what(x) _PICOTEST_FOR_EACH_12 _PICOTEST_PARENS(what, __VA_ARGS__)
1792 #define _PICOTEST_FOR_EACH_14(what, x, ...) \
1793  what(x) _PICOTEST_FOR_EACH_13 _PICOTEST_PARENS(what, __VA_ARGS__)
1794 #define _PICOTEST_FOR_EACH_15(what, x, ...) \
1795  what(x) _PICOTEST_FOR_EACH_14 _PICOTEST_PARENS(what, __VA_ARGS__)
1796 #define _PICOTEST_FOR_EACH_16(what, x, ...) \
1797  what(x) _PICOTEST_FOR_EACH_15 _PICOTEST_PARENS(what, __VA_ARGS__)
1798 #define _PICOTEST_FOR_EACH_17(what, x, ...) \
1799  what(x) _PICOTEST_FOR_EACH_16 _PICOTEST_PARENS(what, __VA_ARGS__)
1800 #define _PICOTEST_FOR_EACH_18(what, x, ...) \
1801  what(x) _PICOTEST_FOR_EACH_17 _PICOTEST_PARENS(what, __VA_ARGS__)
1802 #define _PICOTEST_FOR_EACH_19(what, x, ...) \
1803  what(x) _PICOTEST_FOR_EACH_18 _PICOTEST_PARENS(what, __VA_ARGS__)
1804 #define _PICOTEST_FOR_EACH_20(what, x, ...) \
1805  what(x) _PICOTEST_FOR_EACH_19 _PICOTEST_PARENS(what, __VA_ARGS__)
1806 #define _PICOTEST_FOR_EACH_21(what, x, ...) \
1807  what(x) _PICOTEST_FOR_EACH_20 _PICOTEST_PARENS(what, __VA_ARGS__)
1808 #define _PICOTEST_FOR_EACH_22(what, x, ...) \
1809  what(x) _PICOTEST_FOR_EACH_21 _PICOTEST_PARENS(what, __VA_ARGS__)
1810 #define _PICOTEST_FOR_EACH_23(what, x, ...) \
1811  what(x) _PICOTEST_FOR_EACH_22 _PICOTEST_PARENS(what, __VA_ARGS__)
1812 #define _PICOTEST_FOR_EACH_24(what, x, ...) \
1813  what(x) _PICOTEST_FOR_EACH_23 _PICOTEST_PARENS(what, __VA_ARGS__)
1814 #define _PICOTEST_FOR_EACH_25(what, x, ...) \
1815  what(x) _PICOTEST_FOR_EACH_24 _PICOTEST_PARENS(what, __VA_ARGS__)
1816 #define _PICOTEST_FOR_EACH_26(what, x, ...) \
1817  what(x) _PICOTEST_FOR_EACH_25 _PICOTEST_PARENS(what, __VA_ARGS__)
1818 #define _PICOTEST_FOR_EACH_27(what, x, ...) \
1819  what(x) _PICOTEST_FOR_EACH_26 _PICOTEST_PARENS(what, __VA_ARGS__)
1820 #define _PICOTEST_FOR_EACH_28(what, x, ...) \
1821  what(x) _PICOTEST_FOR_EACH_27 _PICOTEST_PARENS(what, __VA_ARGS__)
1822 #define _PICOTEST_FOR_EACH_29(what, x, ...) \
1823  what(x) _PICOTEST_FOR_EACH_28 _PICOTEST_PARENS(what, __VA_ARGS__)
1824 #define _PICOTEST_FOR_EACH_30(what, x, ...) \
1825  what(x) _PICOTEST_FOR_EACH_29 _PICOTEST_PARENS(what, __VA_ARGS__)
1826 #define _PICOTEST_FOR_EACH_31(what, x, ...) \
1827  what(x) _PICOTEST_FOR_EACH_30 _PICOTEST_PARENS(what, __VA_ARGS__)
1828 #define _PICOTEST_FOR_EACH_32(what, x, ...) \
1829  what(x) _PICOTEST_FOR_EACH_31 _PICOTEST_PARENS(what, __VA_ARGS__)
1830 #define _PICOTEST_FOR_EACH_33(what, x, ...) \
1831  what(x) _PICOTEST_FOR_EACH_32 _PICOTEST_PARENS(what, __VA_ARGS__)
1832 #define _PICOTEST_FOR_EACH_34(what, x, ...) \
1833  what(x) _PICOTEST_FOR_EACH_33 _PICOTEST_PARENS(what, __VA_ARGS__)
1834 #define _PICOTEST_FOR_EACH_35(what, x, ...) \
1835  what(x) _PICOTEST_FOR_EACH_34 _PICOTEST_PARENS(what, __VA_ARGS__)
1836 #define _PICOTEST_FOR_EACH_36(what, x, ...) \
1837  what(x) _PICOTEST_FOR_EACH_35 _PICOTEST_PARENS(what, __VA_ARGS__)
1838 #define _PICOTEST_FOR_EACH_37(what, x, ...) \
1839  what(x) _PICOTEST_FOR_EACH_36 _PICOTEST_PARENS(what, __VA_ARGS__)
1840 #define _PICOTEST_FOR_EACH_38(what, x, ...) \
1841  what(x) _PICOTEST_FOR_EACH_37 _PICOTEST_PARENS(what, __VA_ARGS__)
1842 #define _PICOTEST_FOR_EACH_39(what, x, ...) \
1843  what(x) _PICOTEST_FOR_EACH_38 _PICOTEST_PARENS(what, __VA_ARGS__)
1844 #define _PICOTEST_FOR_EACH_40(what, x, ...) \
1845  what(x) _PICOTEST_FOR_EACH_39 _PICOTEST_PARENS(what, __VA_ARGS__)
1846 #define _PICOTEST_FOR_EACH_41(what, x, ...) \
1847  what(x) _PICOTEST_FOR_EACH_40 _PICOTEST_PARENS(what, __VA_ARGS__)
1848 #define _PICOTEST_FOR_EACH_42(what, x, ...) \
1849  what(x) _PICOTEST_FOR_EACH_41 _PICOTEST_PARENS(what, __VA_ARGS__)
1850 #define _PICOTEST_FOR_EACH_43(what, x, ...) \
1851  what(x) _PICOTEST_FOR_EACH_42 _PICOTEST_PARENS(what, __VA_ARGS__)
1852 #define _PICOTEST_FOR_EACH_44(what, x, ...) \
1853  what(x) _PICOTEST_FOR_EACH_43 _PICOTEST_PARENS(what, __VA_ARGS__)
1854 #define _PICOTEST_FOR_EACH_45(what, x, ...) \
1855  what(x) _PICOTEST_FOR_EACH_44 _PICOTEST_PARENS(what, __VA_ARGS__)
1856 #define _PICOTEST_FOR_EACH_46(what, x, ...) \
1857  what(x) _PICOTEST_FOR_EACH_45 _PICOTEST_PARENS(what, __VA_ARGS__)
1858 #define _PICOTEST_FOR_EACH_47(what, x, ...) \
1859  what(x) _PICOTEST_FOR_EACH_46 _PICOTEST_PARENS(what, __VA_ARGS__)
1860 #define _PICOTEST_FOR_EACH_48(what, x, ...) \
1861  what(x) _PICOTEST_FOR_EACH_47 _PICOTEST_PARENS(what, __VA_ARGS__)
1862 #define _PICOTEST_FOR_EACH_49(what, x, ...) \
1863  what(x) _PICOTEST_FOR_EACH_48 _PICOTEST_PARENS(what, __VA_ARGS__)
1864 #define _PICOTEST_FOR_EACH_50(what, x, ...) \
1865  what(x) _PICOTEST_FOR_EACH_49 _PICOTEST_PARENS(what, __VA_ARGS__)
1866 #define _PICOTEST_FOR_EACH_51(what, x, ...) \
1867  what(x) _PICOTEST_FOR_EACH_50 _PICOTEST_PARENS(what, __VA_ARGS__)
1868 #define _PICOTEST_FOR_EACH_52(what, x, ...) \
1869  what(x) _PICOTEST_FOR_EACH_51 _PICOTEST_PARENS(what, __VA_ARGS__)
1870 #define _PICOTEST_FOR_EACH_53(what, x, ...) \
1871  what(x) _PICOTEST_FOR_EACH_52 _PICOTEST_PARENS(what, __VA_ARGS__)
1872 #define _PICOTEST_FOR_EACH_54(what, x, ...) \
1873  what(x) _PICOTEST_FOR_EACH_53 _PICOTEST_PARENS(what, __VA_ARGS__)
1874 #define _PICOTEST_FOR_EACH_55(what, x, ...) \
1875  what(x) _PICOTEST_FOR_EACH_54 _PICOTEST_PARENS(what, __VA_ARGS__)
1876 #define _PICOTEST_FOR_EACH_56(what, x, ...) \
1877  what(x) _PICOTEST_FOR_EACH_55 _PICOTEST_PARENS(what, __VA_ARGS__)
1878 #define _PICOTEST_FOR_EACH_57(what, x, ...) \
1879  what(x) _PICOTEST_FOR_EACH_56 _PICOTEST_PARENS(what, __VA_ARGS__)
1880 #define _PICOTEST_FOR_EACH_58(what, x, ...) \
1881  what(x) _PICOTEST_FOR_EACH_57 _PICOTEST_PARENS(what, __VA_ARGS__)
1882 #define _PICOTEST_FOR_EACH_59(what, x, ...) \
1883  what(x) _PICOTEST_FOR_EACH_58 _PICOTEST_PARENS(what, __VA_ARGS__)
1884 #define _PICOTEST_FOR_EACH_60(what, x, ...) \
1885  what(x) _PICOTEST_FOR_EACH_59 _PICOTEST_PARENS(what, __VA_ARGS__)
1886 #define _PICOTEST_FOR_EACH_61(what, x, ...) \
1887  what(x) _PICOTEST_FOR_EACH_60 _PICOTEST_PARENS(what, __VA_ARGS__)
1888 #define _PICOTEST_FOR_EACH_62(what, x, ...) \
1889  what(x) _PICOTEST_FOR_EACH_61 _PICOTEST_PARENS(what, __VA_ARGS__)
1890 #define _PICOTEST_FOR_EACH_63(what, x, ...) \
1891  what(x) _PICOTEST_FOR_EACH_62 _PICOTEST_PARENS(what, __VA_ARGS__)
1892 #else
1893 #define _PICOTEST_FOR_EACH_1(what, x) what(x)
1894 #define _PICOTEST_FOR_EACH_2(what, x, ...) \
1895  what(x) _PICOTEST_FOR_EACH_1(what, __VA_ARGS__)
1896 #define _PICOTEST_FOR_EACH_3(what, x, ...) \
1897  what(x) _PICOTEST_FOR_EACH_2(what, __VA_ARGS__)
1898 #define _PICOTEST_FOR_EACH_4(what, x, ...) \
1899  what(x) _PICOTEST_FOR_EACH_3(what, __VA_ARGS__)
1900 #define _PICOTEST_FOR_EACH_5(what, x, ...) \
1901  what(x) _PICOTEST_FOR_EACH_4(what, __VA_ARGS__)
1902 #define _PICOTEST_FOR_EACH_6(what, x, ...) \
1903  what(x) _PICOTEST_FOR_EACH_5(what, __VA_ARGS__)
1904 #define _PICOTEST_FOR_EACH_7(what, x, ...) \
1905  what(x) _PICOTEST_FOR_EACH_6(what, __VA_ARGS__)
1906 #define _PICOTEST_FOR_EACH_8(what, x, ...) \
1907  what(x) _PICOTEST_FOR_EACH_7(what, __VA_ARGS__)
1908 #define _PICOTEST_FOR_EACH_9(what, x, ...) \
1909  what(x) _PICOTEST_FOR_EACH_8(what, __VA_ARGS__)
1910 #define _PICOTEST_FOR_EACH_10(what, x, ...) \
1911  what(x) _PICOTEST_FOR_EACH_9(what, __VA_ARGS__)
1912 #define _PICOTEST_FOR_EACH_11(what, x, ...) \
1913  what(x) _PICOTEST_FOR_EACH_10(what, __VA_ARGS__)
1914 #define _PICOTEST_FOR_EACH_12(what, x, ...) \
1915  what(x) _PICOTEST_FOR_EACH_11(what, __VA_ARGS__)
1916 #define _PICOTEST_FOR_EACH_13(what, x, ...) \
1917  what(x) _PICOTEST_FOR_EACH_12(what, __VA_ARGS__)
1918 #define _PICOTEST_FOR_EACH_14(what, x, ...) \
1919  what(x) _PICOTEST_FOR_EACH_13(what, __VA_ARGS__)
1920 #define _PICOTEST_FOR_EACH_15(what, x, ...) \
1921  what(x) _PICOTEST_FOR_EACH_14(what, __VA_ARGS__)
1922 #define _PICOTEST_FOR_EACH_16(what, x, ...) \
1923  what(x) _PICOTEST_FOR_EACH_15(what, __VA_ARGS__)
1924 #define _PICOTEST_FOR_EACH_17(what, x, ...) \
1925  what(x) _PICOTEST_FOR_EACH_16(what, __VA_ARGS__)
1926 #define _PICOTEST_FOR_EACH_18(what, x, ...) \
1927  what(x) _PICOTEST_FOR_EACH_17(what, __VA_ARGS__)
1928 #define _PICOTEST_FOR_EACH_19(what, x, ...) \
1929  what(x) _PICOTEST_FOR_EACH_18(what, __VA_ARGS__)
1930 #define _PICOTEST_FOR_EACH_20(what, x, ...) \
1931  what(x) _PICOTEST_FOR_EACH_19(what, __VA_ARGS__)
1932 #define _PICOTEST_FOR_EACH_21(what, x, ...) \
1933  what(x) _PICOTEST_FOR_EACH_20(what, __VA_ARGS__)
1934 #define _PICOTEST_FOR_EACH_22(what, x, ...) \
1935  what(x) _PICOTEST_FOR_EACH_21(what, __VA_ARGS__)
1936 #define _PICOTEST_FOR_EACH_23(what, x, ...) \
1937  what(x) _PICOTEST_FOR_EACH_22(what, __VA_ARGS__)
1938 #define _PICOTEST_FOR_EACH_24(what, x, ...) \
1939  what(x) _PICOTEST_FOR_EACH_23(what, __VA_ARGS__)
1940 #define _PICOTEST_FOR_EACH_25(what, x, ...) \
1941  what(x) _PICOTEST_FOR_EACH_24(what, __VA_ARGS__)
1942 #define _PICOTEST_FOR_EACH_26(what, x, ...) \
1943  what(x) _PICOTEST_FOR_EACH_25(what, __VA_ARGS__)
1944 #define _PICOTEST_FOR_EACH_27(what, x, ...) \
1945  what(x) _PICOTEST_FOR_EACH_26(what, __VA_ARGS__)
1946 #define _PICOTEST_FOR_EACH_28(what, x, ...) \
1947  what(x) _PICOTEST_FOR_EACH_27(what, __VA_ARGS__)
1948 #define _PICOTEST_FOR_EACH_29(what, x, ...) \
1949  what(x) _PICOTEST_FOR_EACH_28(what, __VA_ARGS__)
1950 #define _PICOTEST_FOR_EACH_30(what, x, ...) \
1951  what(x) _PICOTEST_FOR_EACH_29(what, __VA_ARGS__)
1952 #define _PICOTEST_FOR_EACH_31(what, x, ...) \
1953  what(x) _PICOTEST_FOR_EACH_30(what, __VA_ARGS__)
1954 #define _PICOTEST_FOR_EACH_32(what, x, ...) \
1955  what(x) _PICOTEST_FOR_EACH_31(what, __VA_ARGS__)
1956 #define _PICOTEST_FOR_EACH_33(what, x, ...) \
1957  what(x) _PICOTEST_FOR_EACH_32(what, __VA_ARGS__)
1958 #define _PICOTEST_FOR_EACH_34(what, x, ...) \
1959  what(x) _PICOTEST_FOR_EACH_33(what, __VA_ARGS__)
1960 #define _PICOTEST_FOR_EACH_35(what, x, ...) \
1961  what(x) _PICOTEST_FOR_EACH_34(what, __VA_ARGS__)
1962 #define _PICOTEST_FOR_EACH_36(what, x, ...) \
1963  what(x) _PICOTEST_FOR_EACH_35(what, __VA_ARGS__)
1964 #define _PICOTEST_FOR_EACH_37(what, x, ...) \
1965  what(x) _PICOTEST_FOR_EACH_36(what, __VA_ARGS__)
1966 #define _PICOTEST_FOR_EACH_38(what, x, ...) \
1967  what(x) _PICOTEST_FOR_EACH_37(what, __VA_ARGS__)
1968 #define _PICOTEST_FOR_EACH_39(what, x, ...) \
1969  what(x) _PICOTEST_FOR_EACH_38(what, __VA_ARGS__)
1970 #define _PICOTEST_FOR_EACH_40(what, x, ...) \
1971  what(x) _PICOTEST_FOR_EACH_39(what, __VA_ARGS__)
1972 #define _PICOTEST_FOR_EACH_41(what, x, ...) \
1973  what(x) _PICOTEST_FOR_EACH_40(what, __VA_ARGS__)
1974 #define _PICOTEST_FOR_EACH_42(what, x, ...) \
1975  what(x) _PICOTEST_FOR_EACH_41(what, __VA_ARGS__)
1976 #define _PICOTEST_FOR_EACH_43(what, x, ...) \
1977  what(x) _PICOTEST_FOR_EACH_42(what, __VA_ARGS__)
1978 #define _PICOTEST_FOR_EACH_44(what, x, ...) \
1979  what(x) _PICOTEST_FOR_EACH_43(what, __VA_ARGS__)
1980 #define _PICOTEST_FOR_EACH_45(what, x, ...) \
1981  what(x) _PICOTEST_FOR_EACH_44(what, __VA_ARGS__)
1982 #define _PICOTEST_FOR_EACH_46(what, x, ...) \
1983  what(x) _PICOTEST_FOR_EACH_45(what, __VA_ARGS__)
1984 #define _PICOTEST_FOR_EACH_47(what, x, ...) \
1985  what(x) _PICOTEST_FOR_EACH_46(what, __VA_ARGS__)
1986 #define _PICOTEST_FOR_EACH_48(what, x, ...) \
1987  what(x) _PICOTEST_FOR_EACH_47(what, __VA_ARGS__)
1988 #define _PICOTEST_FOR_EACH_49(what, x, ...) \
1989  what(x) _PICOTEST_FOR_EACH_48(what, __VA_ARGS__)
1990 #define _PICOTEST_FOR_EACH_50(what, x, ...) \
1991  what(x) _PICOTEST_FOR_EACH_49(what, __VA_ARGS__)
1992 #define _PICOTEST_FOR_EACH_51(what, x, ...) \
1993  what(x) _PICOTEST_FOR_EACH_50(what, __VA_ARGS__)
1994 #define _PICOTEST_FOR_EACH_52(what, x, ...) \
1995  what(x) _PICOTEST_FOR_EACH_51(what, __VA_ARGS__)
1996 #define _PICOTEST_FOR_EACH_53(what, x, ...) \
1997  what(x) _PICOTEST_FOR_EACH_52(what, __VA_ARGS__)
1998 #define _PICOTEST_FOR_EACH_54(what, x, ...) \
1999  what(x) _PICOTEST_FOR_EACH_53(what, __VA_ARGS__)
2000 #define _PICOTEST_FOR_EACH_55(what, x, ...) \
2001  what(x) _PICOTEST_FOR_EACH_54(what, __VA_ARGS__)
2002 #define _PICOTEST_FOR_EACH_56(what, x, ...) \
2003  what(x) _PICOTEST_FOR_EACH_55(what, __VA_ARGS__)
2004 #define _PICOTEST_FOR_EACH_57(what, x, ...) \
2005  what(x) _PICOTEST_FOR_EACH_56(what, __VA_ARGS__)
2006 #define _PICOTEST_FOR_EACH_58(what, x, ...) \
2007  what(x) _PICOTEST_FOR_EACH_57(what, __VA_ARGS__)
2008 #define _PICOTEST_FOR_EACH_59(what, x, ...) \
2009  what(x) _PICOTEST_FOR_EACH_58(what, __VA_ARGS__)
2010 #define _PICOTEST_FOR_EACH_60(what, x, ...) \
2011  what(x) _PICOTEST_FOR_EACH_59(what, __VA_ARGS__)
2012 #define _PICOTEST_FOR_EACH_61(what, x, ...) \
2013  what(x) _PICOTEST_FOR_EACH_60(what, __VA_ARGS__)
2014 #define _PICOTEST_FOR_EACH_62(what, x, ...) \
2015  what(x) _PICOTEST_FOR_EACH_61(what, __VA_ARGS__)
2016 #define _PICOTEST_FOR_EACH_63(what, x, ...) \
2017  what(x) _PICOTEST_FOR_EACH_62(what, __VA_ARGS__)
2018 #endif /* defined(_PICOTEST_PARENS) */
2019 
2025 #endif /* _PICOTEST */
Test matches the condition, run this test and all its subtests.
Definition: picotest.h:181
+Go to the documentation of this file.
1 
48 #ifndef _PICOTEST
49 #define _PICOTEST
50 
51 #include <setjmp.h>
52 #include <stdarg.h>
53 #include <string.h>
54 
55 #if defined(_MSC_VER)
56 
62 #define _PICOTEST_PARENS
63 #endif /* defined(_MSC_VER) */
64 
78 #define PICOTEST_VERSION "1.4.0"
79 #define PICOTEST_VERSION_MAJOR 1
80 #define PICOTEST_VERSION_MINOR 4
81 #define PICOTEST_VERSION_PATCH 0
82 
104 typedef int(PicoTestProc)(const char *cond);
105 
109 typedef struct PicoTestMetadata {
110  const char *name;
111  const char *file;
112  int line;
115  const struct PicoTestMetadata *
116  *subtests;
119 
127 #define PICOTEST_EXTERN(_testName) \
128  PicoTestProc _testName; \
129  PicoTestMetadata _PICOTEST_METADATA(_testName);
130 
141 #define PICOTEST_METADATA(_testName) &_PICOTEST_METADATA(_testName)
142 
144 #define _PICOTEST_METADATA(_testName) _testName##_metadata
145 #define _PICOTEST_TEST_DECLARE(_testName, _nbSubtests, _subtests) \
146  PicoTestProc _testName; \
147  PicoTestMetadata _PICOTEST_METADATA(_testName) = { \
148  _PICOTEST_STRINGIZE(_testName), \
149  __FILE__, \
150  __LINE__, \
151  _testName, \
152  _nbSubtests, \
153  _subtests};
154 
175 typedef enum PicoTestFilterResult {
179 
182 
186 
190 
216  const char *testName,
217  const char *cond);
218 
229 static PicoTestFilterResult _picoTest_filterByName(PicoTestProc *test,
230  const char *testName,
231  const char *cond) {
232  return (strcmp(testName, cond) == 0 ? PICOTEST_FILTER_PASS
234 }
235 
245 #define PICOTEST_FILTER_DEFAULT _picoTest_filterByName
246 
271 #define PICOTEST_FILTER PICOTEST_FILTER_DEFAULT
272 
299 typedef void(PicoTestTraverseProc)(const char *name, int nb);
300 
317 #define PICOTEST_TRAVERSE(_testName, _proc) \
318  _picoTest_traverse(PICOTEST_METADATA(_testName), _proc)
319 
330 static void _picoTest_traverse(const PicoTestMetadata *metadata,
331  PicoTestTraverseProc *proc) {
332  const PicoTestMetadata **subtest = metadata->subtests;
333  proc(metadata->name, metadata->nbSubtests);
334  if (metadata->nbSubtests) {
335  for (; *subtest; subtest++) {
336  _picoTest_traverse(*subtest, proc);
337  }
338  }
339 }
340 
347 typedef enum PicoTestVisitStep {
350 
354 
366 typedef void(PicoTestVisitProc)(const PicoTestMetadata *metadata,
367  PicoTestVisitStep step);
368 
383 #define PICOTEST_VISIT(_testName, _proc) \
384  _picoTest_visit(PICOTEST_METADATA(_testName), _proc)
385 
396 static void _picoTest_visit(const PicoTestMetadata *metadata,
397  PicoTestVisitProc *proc) {
398  const PicoTestMetadata **subtest = metadata->subtests;
399  proc(metadata, PICOTEST_VISIT_ENTER);
400  if (metadata->nbSubtests) {
401  for (; *subtest; subtest++) {
402  _picoTest_visit(*subtest, proc);
403  }
404  }
405  proc(metadata, PICOTEST_VISIT_LEAVE);
406 }
407 
438 typedef void(PicoTestFailureLoggerProc)(const char *file, int line,
439  const char *type, const char *test,
440  const char *msg, va_list args);
441 
449 static void _picoTest_logFailure(const char *file, int line, const char *type,
450  const char *test, const char *msg,
451  va_list args) {}
452 
459 #define PICOTEST_FAILURE_LOGGER_DEFAULT _picoTest_logFailure
460 
480 #define PICOTEST_FAILURE_LOGGER PICOTEST_FAILURE_LOGGER_DEFAULT
481 
519 #if defined(_PICOTEST_PARENS)
520 #define PICOTEST_CASE(...) \
521  _PICOTEST_CONCATENATE(_PICOTEST_CASE_, _PICOTEST_ARGCOUNT(__VA_ARGS__)) \
522  _PICOTEST_PARENS(__VA_ARGS__)
523 #else
524 #define PICOTEST_CASE(...) \
525  _PICOTEST_CONCATENATE(_PICOTEST_CASE_, _PICOTEST_ARGCOUNT(__VA_ARGS__)) \
526  (__VA_ARGS__)
527 #endif /* defined(_PICOTEST_PARENS) */
528 
530 #define _PICOTEST_CASE_DECLARE(_testName) \
531  _PICOTEST_TEST_DECLARE(_testName, 0, NULL); \
532  static int _testName##_testCaseRunner(void); \
533  int _testName(const char *cond) { \
534  int fail = 0; \
535  PicoTestFilterResult filterResult = \
536  (cond == NULL) \
537  ? PICOTEST_FILTER_PASS \
538  : PICOTEST_FILTER(_testName, _PICOTEST_STRINGIZE(_testName), \
539  cond); \
540  switch (filterResult) { \
541  case PICOTEST_FILTER_PASS: \
542  case PICOTEST_FILTER_PASS_PROPAGATE: \
543  fail += _testName##_testCaseRunner(); \
544  break; \
545  } \
546  return fail; \
547  }
548 
549 #define _PICOTEST_CASE_RUNNER_BEGIN(_testName) \
550  static int _testName##_testCaseRunner() { \
551  int abort; \
552  jmp_buf failureEnv; \
553  jmp_buf *oldEnv = _picoTest_failureEnv; \
554  int fail, oldFail = _picoTest_fail; \
555  _picoTest_failureEnv = &failureEnv; \
556  _picoTest_fail = 0; \
557  PICOTEST_CASE_ENTER(_PICOTEST_STRINGIZE(_testName)); \
558  abort = setjmp(failureEnv);
559 
560 #define _PICOTEST_CASE_RUNNER_END(_testName) \
561  fail = _picoTest_fail; \
562  PICOTEST_CASE_LEAVE(_PICOTEST_STRINGIZE(_testName), fail); \
563  _picoTest_failureEnv = oldEnv; \
564  _picoTest_fail = oldFail; \
565  return fail; \
566  }
567 
568 #define _PICOTEST_CASE_1(_testName) \
569  _PICOTEST_CASE_DECLARE(_testName) \
570  static void _testName##_testCase(void); \
571  _PICOTEST_CASE_RUNNER_BEGIN(_testName) \
572  if (!abort) { \
573  _testName##_testCase(); \
574  } \
575  _PICOTEST_CASE_RUNNER_END(_testName) \
576  static void _testName##_testCase(void)
577 
578 #define _PICOTEST_CASE_2(_testName, _fixtureName) \
579  _PICOTEST_CASE_DECLARE(_testName) \
580  static void _testName##_testCase(void); \
581  _PICOTEST_CASE_RUNNER_BEGIN(_testName) \
582  if (!abort) { \
583  _PICOTEST_FIXTURE_CALL_SETUP(_fixtureName, _testName, NULL); \
584  _testName##_testCase(); \
585  } \
586  _PICOTEST_FIXTURE_CALL_TEARDOWN(_fixtureName, _testName, NULL, \
587  _picoTest_fail); \
588  _PICOTEST_CASE_RUNNER_END(_testName) \
589  static void _testName##_testCase()
590 
591 #define _PICOTEST_CASE_3(_testName, _fixtureName, _context) \
592  _PICOTEST_CASE_DECLARE(_testName) \
593  static void _testName##_testCase(struct _fixtureName##_Context *); \
594  _PICOTEST_CASE_RUNNER_BEGIN(_testName) { \
595  struct _fixtureName##_Context context; \
596  if (!abort) { \
597  _PICOTEST_FIXTURE_CALL_SETUP(_fixtureName, _testName, &context); \
598  _testName##_testCase(&context); \
599  } \
600  _PICOTEST_FIXTURE_CALL_TEARDOWN(_fixtureName, _testName, &context, \
601  _picoTest_fail); \
602  } \
603  _PICOTEST_CASE_RUNNER_END(_testName) \
604  static void _testName##_testCase(struct _fixtureName##_Context *_context)
605 
632 typedef void(PicoTestCaseEnterProc)(const char *testName);
633 
640 #define PICOTEST_CASE_ENTER_DEFAULT(testName)
641 
662 #define PICOTEST_CASE_ENTER PICOTEST_CASE_ENTER_DEFAULT
663 
680 typedef void(PicoTestCaseLeaveProc)(const char *testName, int fail);
681 
688 #define PICOTEST_CASE_LEAVE_DEFAULT(testName, fail)
689 
710 #define PICOTEST_CASE_LEAVE PICOTEST_CASE_LEAVE_DEFAULT
711 
750 #define PICOTEST_ASSERT(x, /* msg, */...) \
751  { _PICOTEST_ASSERT(x, #x, ##__VA_ARGS__); }
752 
754 #define _PICOTEST_ASSERT(x, ...) \
755  PICOTEST_ASSERT_BEFORE("ASSERT", #x); \
756  { \
757  int _PICOTEST_FAIL = !(x); \
758  PICOTEST_ASSERT_AFTER("ASSERT", #x, _PICOTEST_FAIL); \
759  if (_PICOTEST_FAIL) { \
760  PICOTEST_FAILURE("ASSERT", ##__VA_ARGS__); \
761  PICOTEST_ABORT(); \
762  } \
763  }
764 
787 #define PICOTEST_VERIFY(x, /* msg, */...) \
788  { _PICOTEST_VERIFY(x, #x, ##__VA_ARGS__); }
789 
791 #define _PICOTEST_VERIFY(x, ...) \
792  PICOTEST_ASSERT_BEFORE("VERIFY", #x); \
793  { \
794  int _PICOTEST_FAIL = !(x); \
795  PICOTEST_ASSERT_AFTER("VERIFY", #x, _PICOTEST_FAIL); \
796  if (_PICOTEST_FAIL) { \
797  PICOTEST_FAILURE("VERIFY", ##__VA_ARGS__); \
798  } \
799  }
800 
815 #define PICOTEST_FAILURE(type, test, /* msg, */...) \
816  _PICOTEST_FAILURE(type, test, ##__VA_ARGS__)
817 
819 #define _PICOTEST_FAILURE(type, ...) \
820  _picoTest_fail++; \
821  _picoTest_assertFailed(PICOTEST_FAILURE_LOGGER, __FILE__, __LINE__, type, \
822  _PICOTEST_ARGCOUNT(__VA_ARGS__), __VA_ARGS__); \
823 
830 static int _picoTest_fail = 0;
831 
838 static jmp_buf *_picoTest_failureEnv = NULL;
839 
847 #define PICOTEST_ABORT() longjmp(*_picoTest_failureEnv, 1)
848 
863 static void _picoTest_assertFailed(PicoTestFailureLoggerProc *proc,
864  const char *file, int line, const char *type,
865  int count, const char *test, ...) {
866  if (count > 1) {
867  /* Extra args after **test** */
868  va_list args;
869  const char *msg;
870  va_start(args, test);
871  msg = va_arg(args, const char *);
872  proc(file, line, type, test, msg, args);
873  } else {
874  proc(file, line, type, test, NULL, NULL);
875  }
876 }
877 
904 typedef void(PicoTestAssertBeforeProc)(const char *type, const char *test);
905 
912 #define PICOTEST_ASSERT_BEFORE_DEFAULT(type, test)
913 
934 #define PICOTEST_ASSERT_BEFORE PICOTEST_ASSERT_BEFORE_DEFAULT
935 
953 typedef void(PicoTestAssertAfterProc)(const char *type, const char *test,
954  int fail);
955 
962 #define PICOTEST_ASSERT_AFTER_DEFAULT(type, test, fail)
963 
984 #define PICOTEST_ASSERT_AFTER PICOTEST_ASSERT_AFTER_DEFAULT
985 
1023 #define PICOTEST_FIXTURE_CONTEXT(_fixtureName) struct _fixtureName##_Context
1024 
1053 #if defined(_PICOTEST_PARENS)
1054 #define PICOTEST_FIXTURE_SETUP(...) \
1055  _PICOTEST_CONCATENATE(_PICOTEST_FIXTURE_SETUP_, \
1056  _PICOTEST_ARGCOUNT(__VA_ARGS__)) \
1057  _PICOTEST_PARENS(__VA_ARGS__)
1058 #else
1059 #define PICOTEST_FIXTURE_SETUP(...) \
1060  _PICOTEST_CONCATENATE(_PICOTEST_FIXTURE_SETUP_, \
1061  _PICOTEST_ARGCOUNT(__VA_ARGS__)) \
1062  (__VA_ARGS__)
1063 #endif /* defined(_PICOTEST_PARENS) */
1064 
1066 #define _PICOTEST_FIXTURE_SETUP_1(_fixtureName) \
1067  static void _fixtureName##_setup(void *_fixtureName##_DUMMY)
1068 
1069 #define _PICOTEST_FIXTURE_SETUP_2(_fixtureName, _context) \
1070  static void _fixtureName##_setup(struct _fixtureName##_Context *_context)
1071 
1072 #define _PICOTEST_FIXTURE_CALL_SETUP(_fixtureName, _testName, context) \
1073  PICOTEST_FIXTURE_BEFORE_SETUP(_PICOTEST_STRINGIZE(_fixtureName), \
1074  _PICOTEST_STRINGIZE(_testName)); \
1075  _fixtureName##_setup(context); \
1076  PICOTEST_FIXTURE_AFTER_SETUP(_PICOTEST_STRINGIZE(_fixtureName), \
1077  _PICOTEST_STRINGIZE(_testName));
1078 
1108 #if defined(_PICOTEST_PARENS)
1109 #define PICOTEST_FIXTURE_TEARDOWN(...) \
1110  _PICOTEST_CONCATENATE(_PICOTEST_FIXTURE_TEARDOWN_, \
1111  _PICOTEST_ARGCOUNT(__VA_ARGS__)) \
1112  _PICOTEST_PARENS(__VA_ARGS__)
1113 #else
1114 #define PICOTEST_FIXTURE_TEARDOWN(...) \
1115  _PICOTEST_CONCATENATE(_PICOTEST_FIXTURE_TEARDOWN_, \
1116  _PICOTEST_ARGCOUNT(__VA_ARGS__)) \
1117  (__VA_ARGS__)
1118 #endif /* defined(_PICOTEST_PARENS) */
1119 
1121 #define _PICOTEST_FIXTURE_TEARDOWN_1(_fixtureName) \
1122  static void _fixtureName##_teardown(int PICOTEST_FAIL, \
1123  void *_fixtureName##_DUMMY)
1124 
1125 #define _PICOTEST_FIXTURE_TEARDOWN_2(_fixtureName, _context) \
1126  static void _fixtureName##_teardown( \
1127  int PICOTEST_FAIL, struct _fixtureName##_Context *_context)
1128 
1129 #define _PICOTEST_FIXTURE_CALL_TEARDOWN(_fixtureName, _testName, context, \
1130  fail) \
1131  PICOTEST_FIXTURE_BEFORE_TEARDOWN(_PICOTEST_STRINGIZE(_fixtureName), \
1132  _PICOTEST_STRINGIZE(_testName), fail); \
1133  _fixtureName##_teardown(fail, context); \
1134  PICOTEST_FIXTURE_AFTER_TEARDOWN(_PICOTEST_STRINGIZE(_fixtureName), \
1135  _PICOTEST_STRINGIZE(_testName), fail); \
1136 
1164 typedef void(PicoTestFixtureBeforeSetupProc)(const char *fixtureName,
1165  const char *testName);
1166 
1173 #define PICOTEST_FIXTURE_BEFORE_SETUP_DEFAULT(fixtureName, testName)
1174 
1195 #define PICOTEST_FIXTURE_BEFORE_SETUP PICOTEST_FIXTURE_BEFORE_SETUP_DEFAULT
1196 
1213 typedef void(PicoTestFixtureAfterSetupProc)(const char *fixtureName,
1214  const char *testName);
1215 
1222 #define PICOTEST_FIXTURE_AFTER_SETUP_DEFAULT(fixtureName, testName)
1223 
1244 #define PICOTEST_FIXTURE_AFTER_SETUP PICOTEST_FIXTURE_AFTER_SETUP_DEFAULT
1245 
1263 typedef void(PicoTestFixtureBeforeTeardownProc)(const char *fixtureName,
1264  const char *testName, int fail);
1265 
1272 #define PICOTEST_FIXTURE_BEFORE_TEARDOWN_DEFAULT(fixtureName, testName, fail)
1273 
1294 #define PICOTEST_FIXTURE_BEFORE_TEARDOWN \
1295  PICOTEST_FIXTURE_BEFORE_TEARDOWN_DEFAULT
1296 
1314 typedef void(PicoTestFixtureAfterTeardownProc)(const char *fixtureName,
1315  const char *testName, int fail);
1316 
1323 #define PICOTEST_FIXTURE_AFTER_TEARDOWN_DEFAULT(fixtureName, testName, fail)
1324 
1345 #define PICOTEST_FIXTURE_AFTER_TEARDOWN PICOTEST_FIXTURE_AFTER_TEARDOWN_DEFAULT
1346 
1386 #define PICOTEST_SUITE(_suiteName, ...) \
1387  _PICOTEST_FOR_EACH(_PICOTEST_SUITE_DECLARE_SUBTEST, __VA_ARGS__) \
1388  static PicoTestMetadata *_suiteName##_subtests[] = {_PICOTEST_FOR_EACH( \
1389  _PICOTEST_SUITE_ENUMERATE_SUBTEST, __VA_ARGS__) NULL}; \
1390  _PICOTEST_TEST_DECLARE(_suiteName, _PICOTEST_ARGCOUNT(__VA_ARGS__), \
1391  _suiteName##_subtests); \
1392  static int _suiteName##_testSuiteRunner(const char *cond) { \
1393  const int nb = _PICOTEST_ARGCOUNT(__VA_ARGS__); \
1394  PicoTestMetadata **subtest = _suiteName##_subtests; \
1395  int fail = 0; \
1396  PICOTEST_SUITE_ENTER(_PICOTEST_STRINGIZE(_suiteName), nb); \
1397  for (; *subtest; subtest++) { \
1398  const int index = (int)(subtest - _suiteName##_subtests); \
1399  int sfail = 0; \
1400  PICOTEST_SUITE_BEFORE_SUBTEST(_PICOTEST_STRINGIZE(_suiteName), nb, \
1401  fail, index, (*subtest)->name); \
1402  sfail = (*subtest)->test(cond); \
1403  fail += sfail; \
1404  PICOTEST_SUITE_AFTER_SUBTEST(_PICOTEST_STRINGIZE(_suiteName), nb, \
1405  fail, index, (*subtest)->name, \
1406  sfail); \
1407  } \
1408  PICOTEST_SUITE_LEAVE(_PICOTEST_STRINGIZE(_suiteName), nb, fail); \
1409  return fail; \
1410  } \
1411  int _suiteName(const char *cond) { \
1412  int fail = 0; \
1413  PicoTestFilterResult filterResult = \
1414  (cond == NULL) \
1415  ? PICOTEST_FILTER_PASS \
1416  : PICOTEST_FILTER(_suiteName, _PICOTEST_STRINGIZE(_suiteName), \
1417  cond); \
1418  switch (filterResult) { \
1419  case PICOTEST_FILTER_PASS: \
1420  cond = NULL; \
1421  case PICOTEST_FILTER_PASS_PROPAGATE: \
1422  fail += _suiteName##_testSuiteRunner(cond); \
1423  break; \
1424  case PICOTEST_FILTER_SKIP: \
1425  break; \
1426  case PICOTEST_FILTER_SKIP_PROPAGATE: { \
1427  PicoTestMetadata **subtest = _suiteName##_subtests; \
1428  for (; *subtest; subtest++) { \
1429  fail += (*subtest)->test(cond); \
1430  } \
1431  } break; \
1432  } \
1433  return fail; \
1434  }
1435 
1437 #define _PICOTEST_SUITE_DECLARE_SUBTEST(_testName) \
1438  PicoTestMetadata _PICOTEST_METADATA(_testName);
1439 #define _PICOTEST_SUITE_ENUMERATE_SUBTEST(_testName) \
1440  PICOTEST_METADATA(_testName),
1441 
1470 typedef void(PicoTestSuiteEnterProc)(const char *suiteName, int nb);
1471 
1478 #define PICOTEST_SUITE_ENTER_DEFAULT(suiteName, nb)
1479 
1500 #define PICOTEST_SUITE_ENTER PICOTEST_SUITE_ENTER_DEFAULT
1501 
1518 typedef void(PicoTestSuiteLeaveProc)(const char *suiteName, int nb, int fail);
1519 
1526 #define PICOTEST_SUITE_LEAVE_DEFAULT(suiteName, nb, fail)
1527 
1550 #define PICOTEST_SUITE_LEAVE PICOTEST_SUITE_LEAVE_DEFAULT
1551 
1572 typedef void(PicoTestSuiteBeforeSubtestProc)(const char *suiteName, int nb,
1573  int fail, int index,
1574  const char *testName);
1575 
1582 #define PICOTEST_SUITE_BEFORE_SUBTEST_DEFAULT(suiteName, nb, fail, index, \
1583  testName)
1584 
1605 #define PICOTEST_SUITE_BEFORE_SUBTEST PICOTEST_SUITE_BEFORE_SUBTEST_DEFAULT
1606 
1629 typedef void(PicoTestSuiteAfterSubtestProc)(const char *suiteName, int nb,
1630  int fail, int index,
1631  const char *testName, int sfail);
1632 
1639 #define PICOTEST_SUITE_AFTER_SUBTEST_DEFAULT(suiteName, nb, fail, index, \
1640  testName, sfail)
1641 
1662 #define PICOTEST_SUITE_AFTER_SUBTEST PICOTEST_SUITE_AFTER_SUBTEST_DEFAULT
1663 
1685 #define _PICOTEST_STRINGIZE(arg) #arg
1686 
1690 #define _PICOTEST_CONCATENATE(arg1, arg2) _PICOTEST_CONCATENATE1(arg1, arg2)
1691 
1693 #define _PICOTEST_CONCATENATE1(arg1, arg2) _PICOTEST_CONCATENATE2(arg1, arg2)
1694 #define _PICOTEST_CONCATENATE2(arg1, arg2) arg1##arg2
1695 
1717 #if defined(_PICOTEST_PARENS)
1718 #define _PICOTEST_ARGCOUNT(...) \
1719  _PICOTEST_LASTARG _PICOTEST_PARENS( \
1720  __VA_ARGS__, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, \
1721  49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, \
1722  32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, \
1723  15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0)
1724 #else
1725 #define _PICOTEST_ARGCOUNT(...) \
1726  _PICOTEST_LASTARG(__VA_ARGS__, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, \
1727  52, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, \
1728  38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, \
1729  24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, \
1730  10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0)
1731 #endif /* defined(_PICOTEST_PARENS) */
1732 
1734 #define _PICOTEST_LASTARG( \
1735  _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, \
1736  _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, \
1737  _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, \
1738  _47, _48, _49, _50, _51, _52, _53, _54, _55, _56, _57, _58, _59, _60, _61, \
1739  _62, _63, N, ...) \
1740  N
1741 
1753 #if defined(_PICOTEST_PARENS)
1754 #define _PICOTEST_FOR_EACH(what, ...) \
1755  _PICOTEST_CONCATENATE(_PICOTEST_FOR_EACH_, \
1756  _PICOTEST_ARGCOUNT(__VA_ARGS__)) \
1757  _PICOTEST_PARENS(what, __VA_ARGS__)
1758 #else
1759 #define _PICOTEST_FOR_EACH(what, ...) \
1760  _PICOTEST_CONCATENATE(_PICOTEST_FOR_EACH_, \
1761  _PICOTEST_ARGCOUNT(__VA_ARGS__)) \
1762  (what, __VA_ARGS__)
1763 #endif /* defined(_PICOTEST_PARENS) */
1764 
1766 #if defined(_PICOTEST_PARENS)
1767 #define _PICOTEST_FOR_EACH_1(what, x) what(x)
1768 #define _PICOTEST_FOR_EACH_2(what, x, ...) \
1769  what(x) _PICOTEST_FOR_EACH_1 _PICOTEST_PARENS(what, __VA_ARGS__)
1770 #define _PICOTEST_FOR_EACH_3(what, x, ...) \
1771  what(x) _PICOTEST_FOR_EACH_2 _PICOTEST_PARENS(what, __VA_ARGS__)
1772 #define _PICOTEST_FOR_EACH_4(what, x, ...) \
1773  what(x) _PICOTEST_FOR_EACH_3 _PICOTEST_PARENS(what, __VA_ARGS__)
1774 #define _PICOTEST_FOR_EACH_5(what, x, ...) \
1775  what(x) _PICOTEST_FOR_EACH_4 _PICOTEST_PARENS(what, __VA_ARGS__)
1776 #define _PICOTEST_FOR_EACH_6(what, x, ...) \
1777  what(x) _PICOTEST_FOR_EACH_5 _PICOTEST_PARENS(what, __VA_ARGS__)
1778 #define _PICOTEST_FOR_EACH_7(what, x, ...) \
1779  what(x) _PICOTEST_FOR_EACH_6 _PICOTEST_PARENS(what, __VA_ARGS__)
1780 #define _PICOTEST_FOR_EACH_8(what, x, ...) \
1781  what(x) _PICOTEST_FOR_EACH_7 _PICOTEST_PARENS(what, __VA_ARGS__)
1782 #define _PICOTEST_FOR_EACH_9(what, x, ...) \
1783  what(x) _PICOTEST_FOR_EACH_8 _PICOTEST_PARENS(what, __VA_ARGS__)
1784 #define _PICOTEST_FOR_EACH_10(what, x, ...) \
1785  what(x) _PICOTEST_FOR_EACH_9 _PICOTEST_PARENS(what, __VA_ARGS__)
1786 #define _PICOTEST_FOR_EACH_11(what, x, ...) \
1787  what(x) _PICOTEST_FOR_EACH_10 _PICOTEST_PARENS(what, __VA_ARGS__)
1788 #define _PICOTEST_FOR_EACH_12(what, x, ...) \
1789  what(x) _PICOTEST_FOR_EACH_11 _PICOTEST_PARENS(what, __VA_ARGS__)
1790 #define _PICOTEST_FOR_EACH_13(what, x, ...) \
1791  what(x) _PICOTEST_FOR_EACH_12 _PICOTEST_PARENS(what, __VA_ARGS__)
1792 #define _PICOTEST_FOR_EACH_14(what, x, ...) \
1793  what(x) _PICOTEST_FOR_EACH_13 _PICOTEST_PARENS(what, __VA_ARGS__)
1794 #define _PICOTEST_FOR_EACH_15(what, x, ...) \
1795  what(x) _PICOTEST_FOR_EACH_14 _PICOTEST_PARENS(what, __VA_ARGS__)
1796 #define _PICOTEST_FOR_EACH_16(what, x, ...) \
1797  what(x) _PICOTEST_FOR_EACH_15 _PICOTEST_PARENS(what, __VA_ARGS__)
1798 #define _PICOTEST_FOR_EACH_17(what, x, ...) \
1799  what(x) _PICOTEST_FOR_EACH_16 _PICOTEST_PARENS(what, __VA_ARGS__)
1800 #define _PICOTEST_FOR_EACH_18(what, x, ...) \
1801  what(x) _PICOTEST_FOR_EACH_17 _PICOTEST_PARENS(what, __VA_ARGS__)
1802 #define _PICOTEST_FOR_EACH_19(what, x, ...) \
1803  what(x) _PICOTEST_FOR_EACH_18 _PICOTEST_PARENS(what, __VA_ARGS__)
1804 #define _PICOTEST_FOR_EACH_20(what, x, ...) \
1805  what(x) _PICOTEST_FOR_EACH_19 _PICOTEST_PARENS(what, __VA_ARGS__)
1806 #define _PICOTEST_FOR_EACH_21(what, x, ...) \
1807  what(x) _PICOTEST_FOR_EACH_20 _PICOTEST_PARENS(what, __VA_ARGS__)
1808 #define _PICOTEST_FOR_EACH_22(what, x, ...) \
1809  what(x) _PICOTEST_FOR_EACH_21 _PICOTEST_PARENS(what, __VA_ARGS__)
1810 #define _PICOTEST_FOR_EACH_23(what, x, ...) \
1811  what(x) _PICOTEST_FOR_EACH_22 _PICOTEST_PARENS(what, __VA_ARGS__)
1812 #define _PICOTEST_FOR_EACH_24(what, x, ...) \
1813  what(x) _PICOTEST_FOR_EACH_23 _PICOTEST_PARENS(what, __VA_ARGS__)
1814 #define _PICOTEST_FOR_EACH_25(what, x, ...) \
1815  what(x) _PICOTEST_FOR_EACH_24 _PICOTEST_PARENS(what, __VA_ARGS__)
1816 #define _PICOTEST_FOR_EACH_26(what, x, ...) \
1817  what(x) _PICOTEST_FOR_EACH_25 _PICOTEST_PARENS(what, __VA_ARGS__)
1818 #define _PICOTEST_FOR_EACH_27(what, x, ...) \
1819  what(x) _PICOTEST_FOR_EACH_26 _PICOTEST_PARENS(what, __VA_ARGS__)
1820 #define _PICOTEST_FOR_EACH_28(what, x, ...) \
1821  what(x) _PICOTEST_FOR_EACH_27 _PICOTEST_PARENS(what, __VA_ARGS__)
1822 #define _PICOTEST_FOR_EACH_29(what, x, ...) \
1823  what(x) _PICOTEST_FOR_EACH_28 _PICOTEST_PARENS(what, __VA_ARGS__)
1824 #define _PICOTEST_FOR_EACH_30(what, x, ...) \
1825  what(x) _PICOTEST_FOR_EACH_29 _PICOTEST_PARENS(what, __VA_ARGS__)
1826 #define _PICOTEST_FOR_EACH_31(what, x, ...) \
1827  what(x) _PICOTEST_FOR_EACH_30 _PICOTEST_PARENS(what, __VA_ARGS__)
1828 #define _PICOTEST_FOR_EACH_32(what, x, ...) \
1829  what(x) _PICOTEST_FOR_EACH_31 _PICOTEST_PARENS(what, __VA_ARGS__)
1830 #define _PICOTEST_FOR_EACH_33(what, x, ...) \
1831  what(x) _PICOTEST_FOR_EACH_32 _PICOTEST_PARENS(what, __VA_ARGS__)
1832 #define _PICOTEST_FOR_EACH_34(what, x, ...) \
1833  what(x) _PICOTEST_FOR_EACH_33 _PICOTEST_PARENS(what, __VA_ARGS__)
1834 #define _PICOTEST_FOR_EACH_35(what, x, ...) \
1835  what(x) _PICOTEST_FOR_EACH_34 _PICOTEST_PARENS(what, __VA_ARGS__)
1836 #define _PICOTEST_FOR_EACH_36(what, x, ...) \
1837  what(x) _PICOTEST_FOR_EACH_35 _PICOTEST_PARENS(what, __VA_ARGS__)
1838 #define _PICOTEST_FOR_EACH_37(what, x, ...) \
1839  what(x) _PICOTEST_FOR_EACH_36 _PICOTEST_PARENS(what, __VA_ARGS__)
1840 #define _PICOTEST_FOR_EACH_38(what, x, ...) \
1841  what(x) _PICOTEST_FOR_EACH_37 _PICOTEST_PARENS(what, __VA_ARGS__)
1842 #define _PICOTEST_FOR_EACH_39(what, x, ...) \
1843  what(x) _PICOTEST_FOR_EACH_38 _PICOTEST_PARENS(what, __VA_ARGS__)
1844 #define _PICOTEST_FOR_EACH_40(what, x, ...) \
1845  what(x) _PICOTEST_FOR_EACH_39 _PICOTEST_PARENS(what, __VA_ARGS__)
1846 #define _PICOTEST_FOR_EACH_41(what, x, ...) \
1847  what(x) _PICOTEST_FOR_EACH_40 _PICOTEST_PARENS(what, __VA_ARGS__)
1848 #define _PICOTEST_FOR_EACH_42(what, x, ...) \
1849  what(x) _PICOTEST_FOR_EACH_41 _PICOTEST_PARENS(what, __VA_ARGS__)
1850 #define _PICOTEST_FOR_EACH_43(what, x, ...) \
1851  what(x) _PICOTEST_FOR_EACH_42 _PICOTEST_PARENS(what, __VA_ARGS__)
1852 #define _PICOTEST_FOR_EACH_44(what, x, ...) \
1853  what(x) _PICOTEST_FOR_EACH_43 _PICOTEST_PARENS(what, __VA_ARGS__)
1854 #define _PICOTEST_FOR_EACH_45(what, x, ...) \
1855  what(x) _PICOTEST_FOR_EACH_44 _PICOTEST_PARENS(what, __VA_ARGS__)
1856 #define _PICOTEST_FOR_EACH_46(what, x, ...) \
1857  what(x) _PICOTEST_FOR_EACH_45 _PICOTEST_PARENS(what, __VA_ARGS__)
1858 #define _PICOTEST_FOR_EACH_47(what, x, ...) \
1859  what(x) _PICOTEST_FOR_EACH_46 _PICOTEST_PARENS(what, __VA_ARGS__)
1860 #define _PICOTEST_FOR_EACH_48(what, x, ...) \
1861  what(x) _PICOTEST_FOR_EACH_47 _PICOTEST_PARENS(what, __VA_ARGS__)
1862 #define _PICOTEST_FOR_EACH_49(what, x, ...) \
1863  what(x) _PICOTEST_FOR_EACH_48 _PICOTEST_PARENS(what, __VA_ARGS__)
1864 #define _PICOTEST_FOR_EACH_50(what, x, ...) \
1865  what(x) _PICOTEST_FOR_EACH_49 _PICOTEST_PARENS(what, __VA_ARGS__)
1866 #define _PICOTEST_FOR_EACH_51(what, x, ...) \
1867  what(x) _PICOTEST_FOR_EACH_50 _PICOTEST_PARENS(what, __VA_ARGS__)
1868 #define _PICOTEST_FOR_EACH_52(what, x, ...) \
1869  what(x) _PICOTEST_FOR_EACH_51 _PICOTEST_PARENS(what, __VA_ARGS__)
1870 #define _PICOTEST_FOR_EACH_53(what, x, ...) \
1871  what(x) _PICOTEST_FOR_EACH_52 _PICOTEST_PARENS(what, __VA_ARGS__)
1872 #define _PICOTEST_FOR_EACH_54(what, x, ...) \
1873  what(x) _PICOTEST_FOR_EACH_53 _PICOTEST_PARENS(what, __VA_ARGS__)
1874 #define _PICOTEST_FOR_EACH_55(what, x, ...) \
1875  what(x) _PICOTEST_FOR_EACH_54 _PICOTEST_PARENS(what, __VA_ARGS__)
1876 #define _PICOTEST_FOR_EACH_56(what, x, ...) \
1877  what(x) _PICOTEST_FOR_EACH_55 _PICOTEST_PARENS(what, __VA_ARGS__)
1878 #define _PICOTEST_FOR_EACH_57(what, x, ...) \
1879  what(x) _PICOTEST_FOR_EACH_56 _PICOTEST_PARENS(what, __VA_ARGS__)
1880 #define _PICOTEST_FOR_EACH_58(what, x, ...) \
1881  what(x) _PICOTEST_FOR_EACH_57 _PICOTEST_PARENS(what, __VA_ARGS__)
1882 #define _PICOTEST_FOR_EACH_59(what, x, ...) \
1883  what(x) _PICOTEST_FOR_EACH_58 _PICOTEST_PARENS(what, __VA_ARGS__)
1884 #define _PICOTEST_FOR_EACH_60(what, x, ...) \
1885  what(x) _PICOTEST_FOR_EACH_59 _PICOTEST_PARENS(what, __VA_ARGS__)
1886 #define _PICOTEST_FOR_EACH_61(what, x, ...) \
1887  what(x) _PICOTEST_FOR_EACH_60 _PICOTEST_PARENS(what, __VA_ARGS__)
1888 #define _PICOTEST_FOR_EACH_62(what, x, ...) \
1889  what(x) _PICOTEST_FOR_EACH_61 _PICOTEST_PARENS(what, __VA_ARGS__)
1890 #define _PICOTEST_FOR_EACH_63(what, x, ...) \
1891  what(x) _PICOTEST_FOR_EACH_62 _PICOTEST_PARENS(what, __VA_ARGS__)
1892 #else
1893 #define _PICOTEST_FOR_EACH_1(what, x) what(x)
1894 #define _PICOTEST_FOR_EACH_2(what, x, ...) \
1895  what(x) _PICOTEST_FOR_EACH_1(what, __VA_ARGS__)
1896 #define _PICOTEST_FOR_EACH_3(what, x, ...) \
1897  what(x) _PICOTEST_FOR_EACH_2(what, __VA_ARGS__)
1898 #define _PICOTEST_FOR_EACH_4(what, x, ...) \
1899  what(x) _PICOTEST_FOR_EACH_3(what, __VA_ARGS__)
1900 #define _PICOTEST_FOR_EACH_5(what, x, ...) \
1901  what(x) _PICOTEST_FOR_EACH_4(what, __VA_ARGS__)
1902 #define _PICOTEST_FOR_EACH_6(what, x, ...) \
1903  what(x) _PICOTEST_FOR_EACH_5(what, __VA_ARGS__)
1904 #define _PICOTEST_FOR_EACH_7(what, x, ...) \
1905  what(x) _PICOTEST_FOR_EACH_6(what, __VA_ARGS__)
1906 #define _PICOTEST_FOR_EACH_8(what, x, ...) \
1907  what(x) _PICOTEST_FOR_EACH_7(what, __VA_ARGS__)
1908 #define _PICOTEST_FOR_EACH_9(what, x, ...) \
1909  what(x) _PICOTEST_FOR_EACH_8(what, __VA_ARGS__)
1910 #define _PICOTEST_FOR_EACH_10(what, x, ...) \
1911  what(x) _PICOTEST_FOR_EACH_9(what, __VA_ARGS__)
1912 #define _PICOTEST_FOR_EACH_11(what, x, ...) \
1913  what(x) _PICOTEST_FOR_EACH_10(what, __VA_ARGS__)
1914 #define _PICOTEST_FOR_EACH_12(what, x, ...) \
1915  what(x) _PICOTEST_FOR_EACH_11(what, __VA_ARGS__)
1916 #define _PICOTEST_FOR_EACH_13(what, x, ...) \
1917  what(x) _PICOTEST_FOR_EACH_12(what, __VA_ARGS__)
1918 #define _PICOTEST_FOR_EACH_14(what, x, ...) \
1919  what(x) _PICOTEST_FOR_EACH_13(what, __VA_ARGS__)
1920 #define _PICOTEST_FOR_EACH_15(what, x, ...) \
1921  what(x) _PICOTEST_FOR_EACH_14(what, __VA_ARGS__)
1922 #define _PICOTEST_FOR_EACH_16(what, x, ...) \
1923  what(x) _PICOTEST_FOR_EACH_15(what, __VA_ARGS__)
1924 #define _PICOTEST_FOR_EACH_17(what, x, ...) \
1925  what(x) _PICOTEST_FOR_EACH_16(what, __VA_ARGS__)
1926 #define _PICOTEST_FOR_EACH_18(what, x, ...) \
1927  what(x) _PICOTEST_FOR_EACH_17(what, __VA_ARGS__)
1928 #define _PICOTEST_FOR_EACH_19(what, x, ...) \
1929  what(x) _PICOTEST_FOR_EACH_18(what, __VA_ARGS__)
1930 #define _PICOTEST_FOR_EACH_20(what, x, ...) \
1931  what(x) _PICOTEST_FOR_EACH_19(what, __VA_ARGS__)
1932 #define _PICOTEST_FOR_EACH_21(what, x, ...) \
1933  what(x) _PICOTEST_FOR_EACH_20(what, __VA_ARGS__)
1934 #define _PICOTEST_FOR_EACH_22(what, x, ...) \
1935  what(x) _PICOTEST_FOR_EACH_21(what, __VA_ARGS__)
1936 #define _PICOTEST_FOR_EACH_23(what, x, ...) \
1937  what(x) _PICOTEST_FOR_EACH_22(what, __VA_ARGS__)
1938 #define _PICOTEST_FOR_EACH_24(what, x, ...) \
1939  what(x) _PICOTEST_FOR_EACH_23(what, __VA_ARGS__)
1940 #define _PICOTEST_FOR_EACH_25(what, x, ...) \
1941  what(x) _PICOTEST_FOR_EACH_24(what, __VA_ARGS__)
1942 #define _PICOTEST_FOR_EACH_26(what, x, ...) \
1943  what(x) _PICOTEST_FOR_EACH_25(what, __VA_ARGS__)
1944 #define _PICOTEST_FOR_EACH_27(what, x, ...) \
1945  what(x) _PICOTEST_FOR_EACH_26(what, __VA_ARGS__)
1946 #define _PICOTEST_FOR_EACH_28(what, x, ...) \
1947  what(x) _PICOTEST_FOR_EACH_27(what, __VA_ARGS__)
1948 #define _PICOTEST_FOR_EACH_29(what, x, ...) \
1949  what(x) _PICOTEST_FOR_EACH_28(what, __VA_ARGS__)
1950 #define _PICOTEST_FOR_EACH_30(what, x, ...) \
1951  what(x) _PICOTEST_FOR_EACH_29(what, __VA_ARGS__)
1952 #define _PICOTEST_FOR_EACH_31(what, x, ...) \
1953  what(x) _PICOTEST_FOR_EACH_30(what, __VA_ARGS__)
1954 #define _PICOTEST_FOR_EACH_32(what, x, ...) \
1955  what(x) _PICOTEST_FOR_EACH_31(what, __VA_ARGS__)
1956 #define _PICOTEST_FOR_EACH_33(what, x, ...) \
1957  what(x) _PICOTEST_FOR_EACH_32(what, __VA_ARGS__)
1958 #define _PICOTEST_FOR_EACH_34(what, x, ...) \
1959  what(x) _PICOTEST_FOR_EACH_33(what, __VA_ARGS__)
1960 #define _PICOTEST_FOR_EACH_35(what, x, ...) \
1961  what(x) _PICOTEST_FOR_EACH_34(what, __VA_ARGS__)
1962 #define _PICOTEST_FOR_EACH_36(what, x, ...) \
1963  what(x) _PICOTEST_FOR_EACH_35(what, __VA_ARGS__)
1964 #define _PICOTEST_FOR_EACH_37(what, x, ...) \
1965  what(x) _PICOTEST_FOR_EACH_36(what, __VA_ARGS__)
1966 #define _PICOTEST_FOR_EACH_38(what, x, ...) \
1967  what(x) _PICOTEST_FOR_EACH_37(what, __VA_ARGS__)
1968 #define _PICOTEST_FOR_EACH_39(what, x, ...) \
1969  what(x) _PICOTEST_FOR_EACH_38(what, __VA_ARGS__)
1970 #define _PICOTEST_FOR_EACH_40(what, x, ...) \
1971  what(x) _PICOTEST_FOR_EACH_39(what, __VA_ARGS__)
1972 #define _PICOTEST_FOR_EACH_41(what, x, ...) \
1973  what(x) _PICOTEST_FOR_EACH_40(what, __VA_ARGS__)
1974 #define _PICOTEST_FOR_EACH_42(what, x, ...) \
1975  what(x) _PICOTEST_FOR_EACH_41(what, __VA_ARGS__)
1976 #define _PICOTEST_FOR_EACH_43(what, x, ...) \
1977  what(x) _PICOTEST_FOR_EACH_42(what, __VA_ARGS__)
1978 #define _PICOTEST_FOR_EACH_44(what, x, ...) \
1979  what(x) _PICOTEST_FOR_EACH_43(what, __VA_ARGS__)
1980 #define _PICOTEST_FOR_EACH_45(what, x, ...) \
1981  what(x) _PICOTEST_FOR_EACH_44(what, __VA_ARGS__)
1982 #define _PICOTEST_FOR_EACH_46(what, x, ...) \
1983  what(x) _PICOTEST_FOR_EACH_45(what, __VA_ARGS__)
1984 #define _PICOTEST_FOR_EACH_47(what, x, ...) \
1985  what(x) _PICOTEST_FOR_EACH_46(what, __VA_ARGS__)
1986 #define _PICOTEST_FOR_EACH_48(what, x, ...) \
1987  what(x) _PICOTEST_FOR_EACH_47(what, __VA_ARGS__)
1988 #define _PICOTEST_FOR_EACH_49(what, x, ...) \
1989  what(x) _PICOTEST_FOR_EACH_48(what, __VA_ARGS__)
1990 #define _PICOTEST_FOR_EACH_50(what, x, ...) \
1991  what(x) _PICOTEST_FOR_EACH_49(what, __VA_ARGS__)
1992 #define _PICOTEST_FOR_EACH_51(what, x, ...) \
1993  what(x) _PICOTEST_FOR_EACH_50(what, __VA_ARGS__)
1994 #define _PICOTEST_FOR_EACH_52(what, x, ...) \
1995  what(x) _PICOTEST_FOR_EACH_51(what, __VA_ARGS__)
1996 #define _PICOTEST_FOR_EACH_53(what, x, ...) \
1997  what(x) _PICOTEST_FOR_EACH_52(what, __VA_ARGS__)
1998 #define _PICOTEST_FOR_EACH_54(what, x, ...) \
1999  what(x) _PICOTEST_FOR_EACH_53(what, __VA_ARGS__)
2000 #define _PICOTEST_FOR_EACH_55(what, x, ...) \
2001  what(x) _PICOTEST_FOR_EACH_54(what, __VA_ARGS__)
2002 #define _PICOTEST_FOR_EACH_56(what, x, ...) \
2003  what(x) _PICOTEST_FOR_EACH_55(what, __VA_ARGS__)
2004 #define _PICOTEST_FOR_EACH_57(what, x, ...) \
2005  what(x) _PICOTEST_FOR_EACH_56(what, __VA_ARGS__)
2006 #define _PICOTEST_FOR_EACH_58(what, x, ...) \
2007  what(x) _PICOTEST_FOR_EACH_57(what, __VA_ARGS__)
2008 #define _PICOTEST_FOR_EACH_59(what, x, ...) \
2009  what(x) _PICOTEST_FOR_EACH_58(what, __VA_ARGS__)
2010 #define _PICOTEST_FOR_EACH_60(what, x, ...) \
2011  what(x) _PICOTEST_FOR_EACH_59(what, __VA_ARGS__)
2012 #define _PICOTEST_FOR_EACH_61(what, x, ...) \
2013  what(x) _PICOTEST_FOR_EACH_60(what, __VA_ARGS__)
2014 #define _PICOTEST_FOR_EACH_62(what, x, ...) \
2015  what(x) _PICOTEST_FOR_EACH_61(what, __VA_ARGS__)
2016 #define _PICOTEST_FOR_EACH_63(what, x, ...) \
2017  what(x) _PICOTEST_FOR_EACH_62(what, __VA_ARGS__)
2018 #endif /* defined(_PICOTEST_PARENS) */
2019 
2025 #endif /* _PICOTEST */
Test matches the condition, run this test and all its subtests.
Definition: picotest.h:181
const struct PicoTestMetadata ** subtests
Definition: picotest.h:115
PicoTestVisitStep
Test visit step.
Definition: picotest.h:347
const char * name
Definition: picotest.h:110
diff --git a/docs/xml/picotest_8h.xml b/docs/xml/picotest_8h.xml index 10e51f0..bf0f075 100644 --- a/docs/xml/picotest_8h.xml +++ b/docs/xml/picotest_8h.xml @@ -2924,9 +2924,9 @@ PicoTest is released under the terms of the The 3-Clause BSD License: #define_PICOTEST_PARENS #endif/*defined(_MSC_VER)*/ -#definePICOTEST_VERSION"1.3.0" +#definePICOTEST_VERSION"1.4.0" #definePICOTEST_VERSION_MAJOR1 -#definePICOTEST_VERSION_MINOR3 +#definePICOTEST_VERSION_MINOR4 #definePICOTEST_VERSION_PATCH0 typedefint(PicoTestProc)(constchar*cond); diff --git a/include/picotest.h b/include/picotest.h index 928f668..ca2b2db 100644 --- a/include/picotest.h +++ b/include/picotest.h @@ -75,9 +75,9 @@ * \{ */ -#define PICOTEST_VERSION "1.3.0" +#define PICOTEST_VERSION "1.4.0" #define PICOTEST_VERSION_MAJOR 1 -#define PICOTEST_VERSION_MINOR 3 +#define PICOTEST_VERSION_MINOR 4 #define PICOTEST_VERSION_PATCH 0 /*! \} End of Version */