Usermode/utests - Fix DNS utest, update libc utests to new format (no more EXP files)
[tpg/acess2.git] / Usermode / Libraries / _utest_include / utest_common.h
1 #ifndef _UTEST_COMMON_H_
2 #define _UTEST_COMMON_H_
3
4 #include <stdlib.h>
5
6 // --- Test assertions
7 #define TEST_REL_(_ty, _fmt, exp, rel, have) do { \
8         _ty a = (exp);\
9         _ty b = (have);\
10         if( !(a rel b) ) { \
11                 fprintf(stderr, "TEST_REL_INT("#exp" {%"_fmt"} "#rel" "#have" {%"_fmt"}) FAILED\n", \
12                         a, b); \
13                 return 1; \
14         } \
15 } while(0)
16 #define TEST_REL_INT(exp, rel, have)    TEST_REL_(int, "i", exp, rel, have)
17 #define TEST_REL_PTR(exp, rel, have)    TEST_REL_(const void*, "p", exp, rel, have)
18
19 // -- Header hooks (allowing inclusion of general headers)
20 #define SYSCALL(rt, name)       rt name() { fprintf(stderr, "BUG: Calling syscall '"#name"' in unit test\n"); exit(2); }
21
22 #endif
23

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