check what happens when a test fails
This commit is contained in:
parent
2ea0da9a6f
commit
e55a392035
|
@ -29,8 +29,10 @@
|
|||
// Internal Prototypes
|
||||
|
||||
static void test_passing(TestState *);
|
||||
static void test_failing(TestState *);
|
||||
static void mk_sample_state(TestState *);
|
||||
decl_test(always_passes);
|
||||
decl_test(always_fails);
|
||||
|
||||
// Public Functions
|
||||
|
||||
|
@ -39,6 +41,7 @@ test_run_test(TestState *s)
|
|||
{
|
||||
print("run_test()\n");
|
||||
test_passing(s);
|
||||
test_failing(s);
|
||||
}
|
||||
|
||||
// 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
|
||||
mk_sample_state(TestState *s)
|
||||
{
|
||||
|
@ -84,4 +113,9 @@ decl_test(always_passes)
|
|||
return test_success;
|
||||
}
|
||||
|
||||
decl_test(always_fails)
|
||||
{
|
||||
return test_failure;
|
||||
}
|
||||
|
||||
//jl
|
||||
|
|
Loading…
Reference in New Issue
Block a user