From 1fcbeaef5b417c30d3441d53d79e25e89abad7ee Mon Sep 17 00:00:00 2001 From: jlamothe Date: Thu, 9 Nov 2023 23:51:51 +0000 Subject: [PATCH] check what happens when a test is pending --- test/run-test.c | 46 ++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 40 insertions(+), 6 deletions(-) diff --git a/test/run-test.c b/test/run-test.c index bbfd842..1572ed9 100644 --- a/test/run-test.c +++ b/test/run-test.c @@ -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