check what happens when a test is pending

This commit is contained in:
jlamothe 2023-11-09 23:51:51 +00:00
parent e55a392035
commit 1fcbeaef5b

View File

@ -28,11 +28,13 @@
// Internal Prototypes
static void test_passing(TestState *);
static void test_failing(TestState *);
static void test_pass(TestState *);
static void test_fail(TestState *);
static void test_pend(TestState *);
static void mk_sample_state(TestState *);
decl_test(always_passes);
decl_test(always_fails);
decl_test(always_pends);
// Public Functions
@ -40,14 +42,15 @@ void
test_run_test(TestState *s)
{
print("run_test()\n");
test_passing(s);
test_failing(s);
test_pass(s);
test_fail(s);
test_pend(s);
}
// Internal Functions
static void
test_passing(TestState *s)
test_pass(TestState *s)
{
TestState expected, actual;
print("\tpassing\n");
@ -73,7 +76,7 @@ test_passing(TestState *s)
}
static void
test_failing(TestState *s)
test_fail(TestState *s)
{
TestState expected, actual;
print("\tfailing\n");
@ -98,6 +101,32 @@ test_failing(TestState *s)
);
}
static void
test_pend(TestState *s)
{
TestState expected, actual;
print("\tpending\n");
// expected result
memset(&expected, 0, sizeof(TestState));
expected.passed = 1;
expected.failed = 2;
expected.pending = 4;
expected.run = 7;
// actual result
mk_sample_state(&actual);
run_test(&actual, always_pends);
compare_states(
s,
"\t\t",
"ERROR: run_test(): pending:",
&expected,
&actual
);
}
static void
mk_sample_state(TestState *s)
{
@ -118,4 +147,9 @@ decl_test(always_fails)
return test_failure;
}
decl_test(always_pends)
{
return test_pending;
}
//jl