ircbot.c  0.3.0
Multi-platform IRC bot in pure C
minunit.h
Go to the documentation of this file.
1 
8 #ifndef IRCBOT_TESTS_MINUNIT_H_
9 #define IRCBOT_TESTS_MINUNIT_H_
10 
17 #define mu_assert(message, test) \
18  do { \
19  if (!(test)) \
20  return message; \
21  } while (0)
22 
29 #define mu_assert_or_disconnect(bot, message, test) \
30  do { \
31  if (!(test)) { \
32  bot_disconnect(bot); \
33  return message; \
34  } \
35  } while (0)
36 
42 #define mu_run_test(name, test) \
43  do { \
44  printf("%sTEST: %s%s\n", YELLOW, name, COLOR_END); \
45  char *message = test(); \
46  tests_run++; \
47  if (message) { \
48  strcpy(messages[tests_failed], message); \
49  tests_failed++; \
50  } \
51  } while (0)
52 
54 extern int tests_run;
56 extern int tests_failed;
58 extern char **messages;
64 extern char RED[];
65 extern char GREEN[];
66 extern char YELLOW[];
67 extern char COLOR_END[];
68 //}@
69 
70 #endif // IRCBOT_TESTS_MINUNIT_H_
int tests_run
Total number of tests executed.
Definition: test_main.c:17
char ** messages
List of messages from failed tests, for printing.
Definition: test_main.c:19
int tests_failed
Number of tests that failed.
Definition: test_main.c:18