1 /* Copyright 2001,2002 Roger Dingledine, Matej Pfajfar. */
2 /* See LICENSE for licensing information */
10 #define STMT_BEGIN do {
11 #define STMT_END } while (0)
15 printf("\nFile %s: line %d (%s): assertion failed.", \
18 __PRETTY_FUNCTION__); \
22 #define test_assert(expr) \
24 if(expr) { printf("."); } else { \
25 printf("\nFile %s: line %d (%s): assertion failed: (%s)\n", \
28 __PRETTY_FUNCTION__, \
33 #define test_eq(expr1, expr2) \
34 STMT_BEGIN if(expr1==expr2) { printf("."); } else { \
35 printf("\nFile %s: line %d (%s): Assertion failed: (%s==%s)\n"\
39 __PRETTY_FUNCTION__, \
41 (long)expr1, (long)expr2); \
45 #define test_neq(expr1, expr2) \
46 STMT_BEGIN if(expr1!=expr2) { printf("."); } else { \
47 printf("\nFile %s: line %d (%s): Assertion failed: (%s!=%s)\n"\
51 __PRETTY_FUNCTION__, \
53 (long)expr1, (long)expr2); \
57 #define test_streq(expr1, expr2) \
58 STMT_BEGIN if(!strcmp(expr1,expr2)) { printf("."); } else { \
59 printf("\nFile %s: line %d (%s): Assertion failed: (%s==%s)\n"\
63 __PRETTY_FUNCTION__, \
69 #define test_strneq(expr1, expr2) \
70 STMT_BEGIN if(strcmp(expr1,expr2)) { printf("."); } else { \
71 printf("\nFile %s: line %d (%s): Assertion failed: (%s!=%s)\n"\
75 __PRETTY_FUNCTION__, \
81 #define test_memeq(expr1, expr2, len) \
82 STMT_BEGIN if(!memcmp(expr1,expr2,len)) { printf("."); } else { \
83 printf("\nFile %s: line %d (%s): Assertion failed: (%s==%s)\n", \
86 __PRETTY_FUNCTION__, \
91 #define test_memneq(expr1, expr2, len) \
92 STMT_BEGIN if(memcmp(expr1,expr2,len)) { printf("."); } else { \
93 printf("\nFile %s: line %d (%s): Assertion failed: (%s!=%s)\n", \
96 __PRETTY_FUNCTION__, \