Blame common/test.h

nsz 7308b3
#include <stdio.h>
nsz 7308b3
#include <stdarg.h>
nsz 7308b3
nsz 7308b3
extern struct test {
nsz 7308b3
	int failed;
nsz 7308b3
	const char *name;
nsz 7308b3
} test__;
nsz 7308b3
nsz 7308b3
#define error(...) error__(__FILE__, __LINE__, __VA_ARGS__)
nsz 7308b3
nsz 7308b3
static void error__(const char *n, int l, const char *s, ...) {
nsz 7308b3
	va_list ap;
nsz 7308b3
nsz 7308b3
	test__.failed = 1;
nsz 7308b3
	fprintf(stderr, "- ERROR %s at %s:%d: ", test__.name, n, l);
nsz 7308b3
	va_start(ap, s);
nsz 7308b3
	vfprintf(stderr, s, ap);
nsz 7308b3
	va_end(ap);
nsz 7308b3
}