2016-07-26 09:57:05 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
#define mu_assert(message, test) do { if (!(test)) return message; } while (0)
|
2016-08-01 15:33:32 +00:00
|
|
|
#define mu_run_test(test) do { char *message; printf(" - run: %s\n", #test); \
|
|
|
|
message = test(); tests_run++; \
|
2016-07-26 09:57:05 +00:00
|
|
|
if (message) return message; } while (0)
|
|
|
|
int tests_run = 0;
|
|
|
|
static char *mu_all_tests(void);
|
|
|
|
|
|
|
|
int main(void) {
|
|
|
|
char *result = mu_all_tests();
|
2016-07-26 15:53:52 +00:00
|
|
|
if (result != NULL) {
|
|
|
|
printf("error: %s\n", result);
|
2016-07-27 09:45:53 +00:00
|
|
|
printf("!!! TEST FAILURE !!!\n");
|
2016-07-26 09:57:05 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
printf("ALL TESTS PASSED\n");
|
|
|
|
}
|
|
|
|
printf("Tests run: %d\n", tests_run);
|
|
|
|
|
|
|
|
return result != 0;
|
|
|
|
}
|
|
|
|
|