9 #define va_copy(d,s) ((d) = (s))
16 int vok_at_loc (const char *file, int line, int test, const char *fmt,
18 int ok_at_loc (const char *file, int line, int test, const char *fmt,
20 int is_at_loc (const char *file, int line, const char *got,
21 const char *expected, const char *fmt, ...);
22 int isnt_at_loc (const char *file, int line, const char *got,
23 const char *expected, const char *fmt, ...);
24 int cmp_ok_at_loc (const char *file, int line, int a, const char *op,
25 int b, const char *fmt, ...);
26 int bail_out (int ignore, const char *fmt, ...);
27 void plan (int tests);
28 int diag (const char *fmt, ...);
29 int note (const char *fmt, ...);
30 int exit_status (void);
31 void skippy (int n, const char *fmt, ...);
32 void ctodo (int ignore, const char *fmt, ...);
36 #define ok(...) ok_at_loc(__FILE__, __LINE__, __VA_ARGS__, NULL)
37 #define is(...) is_at_loc(__FILE__, __LINE__, __VA_ARGS__, NULL)
38 #define isnt(...) isnt_at_loc(__FILE__, __LINE__, __VA_ARGS__, NULL)
39 #define cmp_ok(...) cmp_ok_at_loc(__FILE__, __LINE__, __VA_ARGS__, NULL)
40 #define done_testing return exit_status()
41 #define BAIL_OUT(...) bail_out(0, ## __VA_ARGS__, NULL)
43 #define skip(test, ...) do {if (test) {skippy(__VA_ARGS__, NULL); break;}
44 #define endskip } while (0)
46 #define todo(...) ctodo(0, ## __VA_ARGS__, NULL)
47 #define endtodo cendtodo()
49 #define dies_ok(code, ...) dies_ok_common(code, 1, ## __VA_ARGS__)
50 #define lives_ok(code, ...) dies_ok_common(code, 0, ## __VA_ARGS__)
53 #define pass(...) ok_at_loc(__FILE__, __LINE__, 1, __VA_ARGS__, NULL)
54 #define fail(...) ok_at_loc(__FILE__, __LINE__, 0, __VA_ARGS__, NULL)
55 #define like(...) skippy(1, "like is not implemented on MSWin32")
56 #define unlike(...) like()
57 #define dies_ok_common(...) \
58 skippy(1, "Death detection is not supported on MSWin32")
60 #define pass(...) ok(1, ## __VA_ARGS__)
61 #define fail(...) ok(0, ## __VA_ARGS__)
62 #define like(...) like_at_loc(1, __FILE__, __LINE__, __VA_ARGS__, NULL)
63 #define unlike(...) like_at_loc(0, __FILE__, __LINE__, __VA_ARGS__, NULL)
64 int like_at_loc (int for_match, const char *file, int line,
65 const char *got, const char *expected,
66 const char *fmt, ...);
68 #include <sys/types.h>
70 int tap_test_died (int status);
71 #define dies_ok_common(code, for_death, ...) \
77 perror("fork error"); \
85 if (waitpid(cpid, NULL, 0) < 0) { \
86 perror("waitpid error"); \
89 int it_died = tap_test_died(0); \
90 if (!it_died) {code} \
91 ok(for_death ? it_died : !it_died, ## __VA_ARGS__); \