summaryrefslogtreecommitdiff
path: root/lily-test.h
diff options
context:
space:
mode:
authorsanine <sanine.not@pm.me>2022-12-30 21:22:50 -0600
committersanine <sanine.not@pm.me>2022-12-30 21:22:50 -0600
commitbf71f069d4861ba2285c96dd98bdf1bbe0322fc2 (patch)
tree454cdcd335a408b8a4c1c1b038b152363335dcc2 /lily-test.h
parentb8c647c9250b514a5daa11ea731691b19944aa4e (diff)
begin documentation and add lily_begin() and lily_finish()
Diffstat (limited to 'lily-test.h')
-rw-r--r--lily-test.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/lily-test.h b/lily-test.h
index ac956aa..e6925aa 100644
--- a/lily-test.h
+++ b/lily-test.h
@@ -170,6 +170,8 @@ void lily_require(int x, const char *location, const char *fmt, ...);
#define REQUIRE_GE(x, y, fmt) LILY_REQUIRE_CMP(x, >=, y, fmt)
+void lily_begin();
+void lily_finish();
void lily_run_test(void (*test)());
@@ -183,6 +185,7 @@ struct lily_global_t {
int n_assertions_failed;
int n_tests;
int n_tests_failed;
+ double epsilon;
} extern lily_g;
#ifdef LILY_IMPLEMENTATION
@@ -242,6 +245,7 @@ void lily_run_test(void (*test)())
}
if (lily_g.failed) {
+ lily_g.n_tests_failed += 1;
printf("================================================================================\n");
printf("test \"%s\" failed!\n", lily_g.test_name);
lily_test_msg_t *n = lily_g.HEAD.next;
@@ -304,6 +308,23 @@ void lily_require(int x, const char *location, const char *fmt, ...)
longjmp(lily_g.env, 1);
}
}
+
+
+void lily_begin()
+{
+ printf("================================================================================\n");
+ printf("lily-test version %d.%d.%d\n", LILY_VERSION_MAJOR, LILY_VERSION_MINOR, LILY_VERSION_PATCH);
+}
+
+
+void lily_finish()
+{
+ printf("================================================================================\n");
+ printf("ran %d tests (%d failed)\n",
+ lily_g.n_tests, lily_g.n_tests_failed);
+ printf("checked %d asserts (%d failed)\n",
+ lily_g.n_assertions, lily_g.n_assertions_failed);
+}
#endif
/* ifdef LILY_TEST_H */