new test framework (one main per test)
[libc-test] / src / multibyte / test.h
diff --git a/src/multibyte/test.h b/src/multibyte/test.h
new file mode 100644 (file)
index 0000000..a6a7706
--- /dev/null
@@ -0,0 +1,20 @@
+#include <stdio.h>
+#include <stdarg.h>
+#define error(...) test_error(__FILE__, __LINE__, __VA_ARGS__)
+
+static int test_status;
+
+static int test_error(const char *n, int l, const char *s, ...)
+{
+       va_list ap;
+
+       if (test_status == 0)
+               printf("FAIL\n");
+       test_status = 1;
+       printf(" ERROR %s:%d: ", n, l);
+       va_start(ap, s);
+       vprintf(s, ap);
+       va_end(ap);
+       return -1;
+}
+