Usermode - More hackery to get glib compiling
[tpg/acess2.git] / Usermode / Applications / gui_terminal_src / UTEST / test_common.h
1 #ifndef _TEST_COMMON_H
2 #define _TEST_COMMON_H
3
4 typedef struct
5 {
6         const char      *Name;
7          int    (*Setup)(void);
8         void    (*Run)(void);
9         void    (*Teardown)(void);
10 } tTEST;
11
12 extern tTEST    gaTests[];
13 extern int      giNumTests;
14
15 extern void     TestFailure(const char *ReasonFmt, ...) __attribute__((noreturn));
16
17 #define TEST_ASSERT(expr) do{ \
18         if( !(expr) )   TestFailure("Assertion %s", #expr );\
19 } while(0)
20
21 #define TEST_ASSERT_R(a,r,b) do{ \
22         if( !((a) r (b)) )      TestFailure("Assertion %s(%i) %s %s(%i)", #a, (a), #r, #b, (b) );\
23 } while(0)
24 #define TEST_ASSERT_SR(a,r,b) do{ \
25         if( !(strcmp((a),(b)) r 0) )    TestFailure("Assertion %s(\"%s\") %s %s(\"%s\")", #a, (a), #r, #b, (b) );\
26 } while(0)
27
28 #endif

UCC git Repository :: git.ucc.asn.au