8 #define ok(...) ok_at_loc(__FILE__, __LINE__, __VA_ARGS__, NULL)
9 #define pass(...) ok(1, ## __VA_ARGS__)
10 #define fail(...) ok(0, ## __VA_ARGS__)
11 #define is(...) is_at_loc(__FILE__, __LINE__, __VA_ARGS__, NULL)
12 #define isnt(...) isnt_at_loc(__FILE__, __LINE__, __VA_ARGS__, NULL)
14 void plan (int tests);
\r
15 int ok_at_loc (const char *file,
20 int diag (const char *fmt, ...);
\r
21 int note (const char *fmt, ...);
\r
22 int exit_status (void);
\r
23 void skippy (int n, const char *fmt, ...);
24 void ctodo (int ignore, const char *fmt, ...);
26 int is_at_loc (const char *file,
32 int isnt_at_loc (const char *file,
40 # define like(...) skippy(1, "like is not implemented on MSWin32")
41 # define unlike(...) like()
43 # define like(...) like_at_loc(1, __FILE__, __LINE__, __VA_ARGS__, NULL)
44 # define unlike(...) like_at_loc(0, __FILE__, __LINE__, __VA_ARGS__, NULL)
45 int like_at_loc (int for_match,
54 #define skip(test, ...) do {if (test) {skippy(__VA_ARGS__, NULL); break;}
55 #define endskip } while (0)
57 #define todo(...) ctodo(0, ## __VA_ARGS__, NULL)
58 #define endtodo cendtodo()
60 #define dies_ok(code, ...) dies_ok_common(code, 1, ## __VA_ARGS__)
\r
61 #define lives_ok(code, ...) dies_ok_common(code, 0, ## __VA_ARGS__)
64 # define dies_ok_common(...) \
65 skippy(1, "Death detection is not supported on MSWin32")
\r
68 # include <sys/types.h>
69 # include <sys/wait.h>
70 int tap_test_died (int status);
71 # define dies_ok_common(code, for_death, ...) \
\r
74 int cpid = fork(); \
\r
77 perror("fork error"); \
\r
78 exit(EXIT_FAILURE); \
\r
79 case 0: /* child */ \
\r
80 close(1); close(2); \
\r
83 exit(EXIT_SUCCESS); \
\r
85 if (waitpid(cpid, NULL, 0) < 0) { \
\r
86 perror("waitpid error"); \
\r
87 exit(EXIT_FAILURE); \
\r
89 int it_died = tap_test_died(0); \
\r
90 if (!it_died) {code} \
\r
91 ok(for_death ? it_died : !it_died, ## __VA_ARGS__); \
\r