Compare commits

...
2 Commits
Author SHA1 Message Date
jlamothe 1fcbeaef5b check what happens when a test is pending 2023-11-09 23:51:51 +00:00
jlamothe e55a392035 check what happens when a test fails 2023-11-09 23:39:13 +00:00
+71 -3
View File
@@ -28,9 +28,13 @@
// Internal Prototypes // Internal Prototypes
static void test_passing(TestState *); static void test_pass(TestState *);
static void test_fail(TestState *);
static void test_pend(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);
decl_test(always_pends);
// Public Functions // Public Functions
@@ -38,13 +42,15 @@ void
test_run_test(TestState *s) test_run_test(TestState *s)
{ {
print("run_test()\n"); print("run_test()\n");
test_passing(s); test_pass(s);
test_fail(s);
test_pend(s);
} }
// Internal Functions // Internal Functions
static void static void
test_passing(TestState *s) test_pass(TestState *s)
{ {
TestState expected, actual; TestState expected, actual;
print("\tpassing\n"); print("\tpassing\n");
@@ -69,6 +75,58 @@ test_passing(TestState *s)
); );
} }
static void
test_fail(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
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 static void
mk_sample_state(TestState *s) mk_sample_state(TestState *s)
{ {
@@ -84,4 +142,14 @@ decl_test(always_passes)
return test_success; return test_success;
} }
decl_test(always_fails)
{
return test_failure;
}
decl_test(always_pends)
{
return test_pending;
}
//jl //jl