Copying over minunit to older locations
This commit is contained in:
parent
5bf745f51d
commit
43d54aa33b
@ -8,12 +8,16 @@
|
|||||||
|
|
||||||
#define mu_suite_start() char *message = NULL
|
#define mu_suite_start() char *message = NULL
|
||||||
|
|
||||||
#define mu_assert(test, message) if (!(test)) { log_err(message); return message; }
|
#define mu_assert(test, message) if (!(test)) {\
|
||||||
|
log_err(message); return message;\
|
||||||
|
}\
|
||||||
|
assertions_made++;
|
||||||
#define mu_run_test(test) debug("\n-----%s", " " #test); \
|
#define mu_run_test(test) debug("\n-----%s", " " #test); \
|
||||||
message = test(); tests_run++; if (message) return message;
|
message = test(); tests_run++; if (message) return message;
|
||||||
|
|
||||||
#define RUN_TESTS(name) int main(int argc, char *argv[]) {\
|
#define RUN_TESTS(name) int main(int argc, char *argv[]) {\
|
||||||
argc = 1; \
|
argc = argc; \
|
||||||
|
argv = argv; \
|
||||||
debug("----- RUNNING: %s", argv[0]);\
|
debug("----- RUNNING: %s", argv[0]);\
|
||||||
printf("----\nRUNNING: %s\n", argv[0]);\
|
printf("----\nRUNNING: %s\n", argv[0]);\
|
||||||
char *result = name();\
|
char *result = name();\
|
||||||
@ -24,9 +28,11 @@
|
|||||||
printf("ALL TESTS PASSED\n");\
|
printf("ALL TESTS PASSED\n");\
|
||||||
}\
|
}\
|
||||||
printf("Tests run: %d\n", tests_run);\
|
printf("Tests run: %d\n", tests_run);\
|
||||||
|
printf("Assertions made: %d\n", assertions_made);\
|
||||||
exit(result != 0);\
|
exit(result != 0);\
|
||||||
}
|
}
|
||||||
|
|
||||||
int tests_run;
|
int tests_run;
|
||||||
|
int assertions_made;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -8,12 +8,16 @@
|
|||||||
|
|
||||||
#define mu_suite_start() char *message = NULL
|
#define mu_suite_start() char *message = NULL
|
||||||
|
|
||||||
#define mu_assert(test, message) if (!(test)) { log_err(message); return message; }
|
#define mu_assert(test, message) if (!(test)) {\
|
||||||
|
log_err(message); return message;\
|
||||||
|
}\
|
||||||
|
assertions_made++;
|
||||||
#define mu_run_test(test) debug("\n-----%s", " " #test); \
|
#define mu_run_test(test) debug("\n-----%s", " " #test); \
|
||||||
message = test(); tests_run++; if (message) return message;
|
message = test(); tests_run++; if (message) return message;
|
||||||
|
|
||||||
#define RUN_TESTS(name) int main(int argc, char *argv[]) {\
|
#define RUN_TESTS(name) int main(int argc, char *argv[]) {\
|
||||||
argc = 1; \
|
argc = argc; \
|
||||||
|
argv = argv; \
|
||||||
debug("----- RUNNING: %s", argv[0]);\
|
debug("----- RUNNING: %s", argv[0]);\
|
||||||
printf("----\nRUNNING: %s\n", argv[0]);\
|
printf("----\nRUNNING: %s\n", argv[0]);\
|
||||||
char *result = name();\
|
char *result = name();\
|
||||||
@ -24,9 +28,11 @@
|
|||||||
printf("ALL TESTS PASSED\n");\
|
printf("ALL TESTS PASSED\n");\
|
||||||
}\
|
}\
|
||||||
printf("Tests run: %d\n", tests_run);\
|
printf("Tests run: %d\n", tests_run);\
|
||||||
|
printf("Assertions made: %d\n", assertions_made);\
|
||||||
exit(result != 0);\
|
exit(result != 0);\
|
||||||
}
|
}
|
||||||
|
|
||||||
int tests_run;
|
int tests_run;
|
||||||
|
int assertions_made;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user