]> git.saurik.com Git - apple/ld64.git/blob - unit-tests/include/test.h
ld64-133.3.tar.gz
[apple/ld64.git] / unit-tests / include / test.h
1 #include <stdarg.h>
2 #include <stdio.h>
3
4 #define DEFINE_TEST_FUNC(name) \
5 static \
6 inline \
7 void \
8 name(const char *format, ...) \
9 { \
10 va_list args; \
11 va_start(args, format); \
12 common(stdout, #name, format, args); \
13 va_end(args); \
14 return; \
15 }
16
17 static
18 inline
19 void
20 common(FILE *file, const char *prefix, const char *format, va_list args)
21 {
22 fprintf(file, "%s \"", prefix);
23 vfprintf(file, format, args);
24 fprintf(file, "\"\n"); // should check for trailing newline
25 return;
26 }
27
28 DEFINE_TEST_FUNC(PASS);
29 DEFINE_TEST_FUNC(XPASS);
30 DEFINE_TEST_FUNC(FAIL);
31 DEFINE_TEST_FUNC(XFAIL);
32
33 DEFINE_TEST_FUNC(UNTESTED);
34 DEFINE_TEST_FUNC(UNSUPPORTED);
35 DEFINE_TEST_FUNC(UNRESOLVED);