check what happens when a test fails

This commit is contained in:
jlamothe 2023-11-09 23:39:13 +00:00
parent 2ea0da9a6f
commit e55a392035

View File

@ -29,8 +29,10 @@
// Internal Prototypes // Internal Prototypes
static void test_passing(TestState *); static void test_passing(TestState *);
static void test_failing(TestState *);
static void mk_sample_state(TestState *); static void mk_sample_state(TestState *);
decl_test(always_passes); decl_test(always_passes);
decl_test(always_fails);
// Public Functions // Public Functions
@ -39,6 +41,7 @@ test_run_test(TestState *s)
{ {
print("run_test()\n"); print("run_test()\n");
test_passing(s); test_passing(s);
test_failing(s);
} }
// Internal Functions // Internal Functions
@ -69,6 +72,32 @@ test_passing(TestState *s)
); );
} }
static void
test_failing(TestState *s)
{
TestState expected, actual;
print("\tfailing\n");
// expected result
memset(&expected, 0, sizeof(TestState));
expected.passed = 1;
expected.failed = 3;
expected.pending = 3;
expected.run = 7;
// actual result
mk_sample_state(&actual);
run_test(&actual, always_fails);
compare_states(
s,
"\t\t",
"ERROR: run_test(): failing:",
&expected,
&actual
);
}
static void static void
mk_sample_state(TestState *s) mk_sample_state(TestState *s)
{ {
@ -84,4 +113,9 @@ decl_test(always_passes)
return test_success; return test_success;
} }
decl_test(always_fails)
{
return test_failure;
}
//jl //jl