Blame src/functional/test.h

nsz 462b4f
#include <stdio.h>
nsz 462b4f
#include <stdarg.h>
nsz 462b4f
#define error(...) test_error(__FILE__, __LINE__, __VA_ARGS__)
nsz 462b4f
Szabolcs Nagy dc1a7e
/* TODO: not thread-safe nor fork-safe */
nsz 462b4f
static int test_status;
nsz 462b4f
nsz 462b4f
static int test_error(const char *n, int l, const char *s, ...)
nsz 462b4f
{
nsz 462b4f
	va_list ap;
nsz 462b4f
nsz 462b4f
	if (test_status == 0)
nsz 462b4f
		printf("FAIL\n");
nsz 462b4f
	test_status = 1;
nsz 462b4f
	printf(" ERROR %s:%d: ", n, l);
nsz 462b4f
	va_start(ap, s);
nsz 462b4f
	vprintf(s, ap);
nsz 462b4f
	va_end(ap);
nsz 462b4f
	return -1;
nsz 462b4f
}
nsz 462b4f