Line | |
---|
1 | #ifndef UTEST_H |
---|
2 | #define UTEST_H |
---|
3 | |
---|
4 | /* |
---|
5 | o---------------------------------------------------------------------o |
---|
6 | | |
---|
7 | | Numdiff |
---|
8 | | |
---|
9 | | Copyright (c) 2012+ laurent.deniau@cern.ch |
---|
10 | | Gnu General Public License |
---|
11 | | |
---|
12 | o---------------------------------------------------------------------o |
---|
13 | |
---|
14 | Purpose: |
---|
15 | manage unit tests |
---|
16 | display results |
---|
17 | |
---|
18 | o---------------------------------------------------------------------o |
---|
19 | */ |
---|
20 | |
---|
21 | #include <stdio.h> |
---|
22 | |
---|
23 | // ----- types |
---|
24 | |
---|
25 | struct utest; |
---|
26 | |
---|
27 | // ----- interface |
---|
28 | |
---|
29 | #define T struct utest |
---|
30 | |
---|
31 | T* utest_alloc (FILE*); |
---|
32 | void utest_free (T*); |
---|
33 | void utest_title (T*, const char*); |
---|
34 | void utest_init (T*, const char*); |
---|
35 | void utest_fini (T*); |
---|
36 | void utest_stat (T*); |
---|
37 | |
---|
38 | // return the number of failed tests, prefer the UTEST macro |
---|
39 | int utest_test (T*, int pass, const char *cond, const char *file, int line); |
---|
40 | |
---|
41 | #undef T |
---|
42 | |
---|
43 | // ----- macros |
---|
44 | |
---|
45 | // assume T* to be named "utest" |
---|
46 | #define UTEST(cond) utest_test(utest, (cond), #cond, __FILE__, __LINE__) |
---|
47 | |
---|
48 | #endif |
---|
Note: See
TracBrowser
for help on using the repository browser.