refactored single_test_context()

This commit is contained in:
jlamothe 2023-11-18 20:11:28 +00:00
parent 2011b75b7e
commit cd590339b7

20
9unit.c
View File

@ -79,7 +79,7 @@ static TestResult run_test_with_test(TestState *);
static void build_new_context(TestState *, ContextData *); static void build_new_context(TestState *, ContextData *);
static void display_context(TestState *); static void display_context(TestState *);
static void restore_context(TestState *, ContextData *); static void restore_context(TestState *, ContextData *);
static void run_single_test_context(TestState *); static void single_test_context_test(TestState *);
static void test_context_with_test(TestState *); static void test_context_with_test(TestState *);
static TestResult single_test_context_with_test(TestState *); static TestResult single_test_context_with_test(TestState *);
static void check_value_test(TestState *, void *); static void check_value_test(TestState *, void *);
@ -200,11 +200,11 @@ single_test_context(
) )
{ {
if (!s) return; if (!s) return;
SingleTestContext stc; SingleTestContext d;
stc.ptr = s->ptr; d.ptr = s->ptr;
stc.test = test; d.test = test;
s->ptr = &stc; s->ptr = &d;
test_context(s, label, run_single_test_context); test_context(s, label, single_test_context_test);
} }
void void
@ -356,11 +356,11 @@ restore_context(TestState *s, ContextData *cd)
} }
static void static void
run_single_test_context(TestState *s) single_test_context_test(TestState *s)
{ {
SingleTestContext *stc = s->ptr; SingleTestContext *d = s->ptr;
s->ptr = stc->ptr; s->ptr = d->ptr;
run_test(s, stc->test); run_test(s, d->test);
} }
static void static void