initial commit
[libc-test] / common / test.h
1 #include <stdio.h>
2 #include <stdarg.h>
3
4 extern struct test {
5         int failed;
6         const char *name;
7 } test__;
8
9 #define error(...) error__(__FILE__, __LINE__, __VA_ARGS__)
10
11 static void error__(const char *n, int l, const char *s, ...) {
12         va_list ap;
13
14         test__.failed = 1;
15         fprintf(stderr, "- ERROR %s at %s:%d: ", test__.name, n, l);
16         va_start(ap, s);
17         vfprintf(stderr, s, ap);
18         va_end(ap);
19 }