summaryrefslogtreecommitdiff
path: root/lily-test.h
diff options
context:
space:
mode:
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 */