-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathminunit.h
23 lines (19 loc) · 869 Bytes
/
minunit.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/* File: minunit.h
*
* Purpose: Header file for a minimum unit test API
* Simple C unit test API based on http://www.jera.com/techinfo/jtns/jtn002.html
* More extensive version is in https://github.com/siu/minunit
*/
/*--------------------------------------------------------------------
* mu_assert is a macro that returns a string if the condition expression passed to it is false.
* When using it in a sequence of assertions, a function returns a message
* as soon as encoutering a false condition (normally it means error).
*
* The space of this message cannot be allocated on the stack.
* It needs to be allocated with malloc or uses a global variable.
*/
#define mu_assert(message, condition) do { \
if (!(condition)) return message; \
} while (0)
char* mu_run_test(char * (*test_fun)());
void mu_print_test_summary(char * startmsg);