created overridable report() function to be used in place of print()

This commit is contained in:
jlamothe
2023-11-14 23:53:43 +00:00
parent 85a6d49b38
commit cead3f67d0
5 changed files with 60 additions and 12 deletions

View File

@@ -31,6 +31,7 @@ static void init_TestState(TestState *);
static void print_log(TestState *);
static void clear_log(TestState *);
static void reindex(TestState *);
static void report(const char *);
// Public Functions
@@ -69,6 +70,7 @@ run_tests(void (*tests)(TestState *))
if (!tests) return;
TestState s;
memset(&s, 0, sizeof(TestState));
s.report = report;
(*tests)(&s);
print_log(&s);
printf("Tests run: %d\n", s.run);
@@ -161,4 +163,10 @@ reindex(TestState *s)
}
}
static void
report(const char *str)
{
print(str);
}
//jl