2 #include <stdio.h> /* printf(), fprintf() */
8 /* this increments when the "API" changes */
9 int mutest_api_version = 1;
11 int mutest_passed_count;
12 int mutest_failed_count;
13 void mutest_reset_counters() {
14 mutest_passed_count = 0;
15 mutest_failed_count = 0;
27 int mutest_verbose_level = 1;
28 void mutest_set_verbose_level(int val) {
29 mutest_verbose_level = val;
32 #define mu_check(exp) \
35 ++mutest_passed_count; \
36 if (mutest_verbose_level >= 5) \
37 printf("%s:%d: mu_check(%s) passed\n", \
38 __FILE__, __LINE__, #exp); \
40 ++mutest_failed_count; \
41 if (mutest_verbose_level) \
42 fprintf(stderr, "%s:%d: mu_check(%s) " \
43 "failed, resuming test case\n", \
44 __FILE__, __LINE__, #exp); \
48 #define mu_ensure(exp) \
51 ++mutest_passed_count; \
52 if (mutest_verbose_level >=5) \
53 printf("%s:%d: mu_ensure(%s) passed\n", \
54 __FILE__, __LINE__, #exp); \
56 ++mutest_failed_count; \
57 if (mutest_verbose_level) \
58 fprintf(stderr, "%s:%d: mu_ensure(%s) " \
59 "failed, aborting test case\n", \
60 __FILE__, __LINE__, #exp); \