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