GenSVM
minunit.h
Go to the documentation of this file.
1 
14 #undef NDEBUG
15 #ifndef _minunit_h
16 #define _minunit_h
17 
18 #include "dbg.h"
19 #include <stdlib.h>
20 
24 #define mu_suite_start() char *message = NULL
25 
29 #define mu_assert(test, message) if (!(test)) { log_err(message); return message; }
30 
35 #define mu_run_test(test) debug("\n-----%s", " " #test); \
36  message = test(); tests_run++; if (message) return message;
37 
42 #define RUN_TESTS(name) int main(int argc, char *argv[]) {\
43  argc = 1; \
44  debug("\n-----\nRUNNING: %s", argv[0]);\
45  printf("----\nRUNNING: %s\n", argv[0]);\
46  char *result = name();\
47  if (result != 0) {\
48  printf("\033[91mFAILED:\033[0m %s\n", result);\
49  }\
50  else {\
51  printf("ALL TESTS \033[92mPASSED\033[0m\n");\
52  }\
53  printf("Tests run: %d\n", tests_run);\
54  exit(result != 0);\
55 }
56 
60 #define mu_test_missing() printf("\033[33;1mWARNING: Test missing\033[0m\n");\
61  tests_run--;
62 
67 
68 #endif
int tests_run
Definition: minunit.h:66
Debug macros for the minunit framework.