OlinCoin
Test
src
includes
tests
minunit.h
1
/* minunit.h
2
3
From: http://www.jera.com/techinfo/jtns/jtn002.html
4
5
License: "You may use the code in this tech note for any purpose,
6
with the understanding that it comes with NO WARRANTY."
7
8
Note on why the macros are wrapped in a do..while statement:
9
http://www.eskimo.com/~scs/C-faq/q10.4.html
10
11
*/
12
13
/* mu_assert: If test is false, returns message.
14
15
Note that because this is a macro, it returns from whatever
16
function it is used in.
17
*/
18
#define mu_assert(message, test) do { if (!(test)) return message; } while (0)
19
20
21
/* mu_run_test: Runs the given test function.
22
23
If the function returns a non-null message, mu_run_test returns
24
the same message.
25
26
*/
27
#define mu_run_test(test) do { char *message = test(); tests_run++; \
28
if (message) return message; } while (0)
29
30
/* Note from Allen: I'm not sure why this is here.
31
`tests_run` is only used in the testing module, and I
32
don't see a reason it should be accessible from the
33
unit under test.
34
35
extern int tests_run;
36
37
*/
Generated by
1.9.3