added context info to TestState

This commit is contained in:
jlamothe
2023-11-14 23:08:19 +00:00
parent 1d306f32c0
commit 85a6d49b38
4 changed files with 116 additions and 14 deletions

15
9unit.c
View File

@@ -68,7 +68,7 @@ run_tests(void (*tests)(TestState *))
{
if (!tests) return;
TestState s;
init_TestState(&s);
memset(&s, 0, sizeof(TestState));
(*tests)(&s);
print_log(&s);
printf("Tests run: %d\n", s.run);
@@ -111,19 +111,6 @@ append_test_log(TestState *s, const char *msg)
// Internal Functions
static void
init_TestState(TestState *s)
{
if (!s) return;
s->run = 0;
s->passed = 0;
s->failed = 0;
s->pending = 0;
s->first_log = 0;
s->last_log = 0;
s->ptr = 0;
}
static void
print_log(TestState *s)
{