created overridable report() function to be used in place of print()
This commit is contained in:
8
9unit.c
8
9unit.c
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user