test test_context() with a prior context

This commit is contained in:
jlamothe 2023-11-21 19:49:19 +00:00
parent ebf398fd33
commit da33bd8955

View File

@ -47,6 +47,7 @@ struct ContextData
// Internal Prototypes // Internal Prototypes
static void no_prior_context(TestState *); static void no_prior_context(TestState *);
static void prior_context(TestState *);
static void test_context_common(TestState *, ContextData *); static void test_context_common(TestState *, ContextData *);
static void init_ContextData(ContextData *); static void init_ContextData(ContextData *);
static void get_context(TestState *); static void get_context(TestState *);
@ -59,6 +60,7 @@ void
test_test_context(TestState *s) test_test_context(TestState *s)
{ {
test_context(s, "no prior context", no_prior_context); test_context(s, "no prior context", no_prior_context);
test_context(s, "prior context", prior_context);
} }
// Internal Functions // Internal Functions
@ -81,6 +83,24 @@ no_prior_context(TestState *s)
test_context_common(s, &cd); test_context_common(s, &cd);
} }
static void
prior_context(TestState *s)
{
ContextData cd;
// set initial state
cd.new_context = "my other test";
cd.initial_context = "bar";
cd.initial_full_context = "foo: bar";
cd.initial_depth = 2;
// set expectations
cd.expected_sub_full_context = "foo: bar: my other test";
cd.expected_sub_depth = 3;
test_context_common(s, &cd);
}
static void static void
test_context_common( test_context_common(
TestState *s, TestState *s,