summaryrefslogtreecommitdiff
path: root/test/tap.c
diff options
context:
space:
mode:
authorPhil Jones <philj56@gmail.com>2022-10-18 19:33:47 +0100
committerPhil Jones <philj56@gmail.com>2022-10-18 19:53:06 +0100
commit340692299ed834f962b83b1bc0eb6f49471ca556 (patch)
treef0a1c9160397b22a662e6399e085336de3396a73 /test/tap.c
parent5482f0be746a98bdd6b2c54183b54dd2ff2a0192 (diff)
Add beginnings of test framework.
Just contains a couple of very simple UTF-8 tests for now.
Diffstat (limited to 'test/tap.c')
-rw-r--r--test/tap.c53
1 files changed, 53 insertions, 0 deletions
diff --git a/test/tap.c b/test/tap.c
new file mode 100644
index 0000000..47f7063
--- /dev/null
+++ b/test/tap.c
@@ -0,0 +1,53 @@
+#include <stdarg.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+static size_t test = 0;
+static char *todo = NULL;
+
+void tap_version(size_t version)
+{
+ printf("TAP version %zu\n", version);
+}
+
+void tap_plan()
+{
+ printf("1..%zu\n", test);
+}
+
+void tap_ok(const char *message, ...)
+{
+ va_list args;
+ va_start(args, message);
+ printf("ok %zu - ", ++test);
+ vprintf(message, args);
+ if (todo != NULL) {
+ printf(" # TODO %s", todo);
+ free(todo);
+ todo = NULL;
+ }
+ printf("\n");
+ va_end(args);
+}
+
+void tap_not_ok(const char *message, ...)
+{
+ va_list args;
+ va_start(args, message);
+ printf("not ok %zu - ", ++test);
+ vprintf(message, args);
+ if (todo != NULL) {
+ printf(" # TODO %s", todo);
+ free(todo);
+ todo = NULL;
+ }
+ printf("\n");
+ va_end(args);
+}
+
+void tap_todo(const char *message)
+{
+ todo = strdup(message);
+}
+