partially testing run_test()
This commit is contained in:
@@ -22,11 +22,14 @@
|
||||
#include <libc.h>
|
||||
|
||||
#include "../9unit.h"
|
||||
#include "util.h"
|
||||
#include "run-test.h"
|
||||
|
||||
// Internal Prototypes
|
||||
|
||||
static void test_passing(TestState *);
|
||||
static void mk_sample_state(TestState *);
|
||||
decl_test(always_passes);
|
||||
|
||||
// Public Functions
|
||||
|
||||
@@ -39,12 +42,45 @@ test_run_test(TestState *s)
|
||||
|
||||
// Internal Functions
|
||||
|
||||
static
|
||||
void test_passing(TestState *s)
|
||||
static void
|
||||
test_passing(TestState *s)
|
||||
{
|
||||
void *oldptr = s->ptr;
|
||||
TestState expected, actual;
|
||||
print("\tpassing\n");
|
||||
s->ptr = oldptr;
|
||||
|
||||
// expected result
|
||||
memset(&expected, 0, sizeof(TestState));
|
||||
expected.passed = 2;
|
||||
expected.failed = 2;
|
||||
expected.pending = 3;
|
||||
expected.run = 7;
|
||||
|
||||
// actual result
|
||||
mk_sample_state(&actual);
|
||||
run_test(&actual, always_passes);
|
||||
|
||||
compare_states(
|
||||
s,
|
||||
"\t\t",
|
||||
"ERROR: run_test(): passing:",
|
||||
&expected,
|
||||
&actual
|
||||
);
|
||||
}
|
||||
|
||||
static void
|
||||
mk_sample_state(TestState *s)
|
||||
{
|
||||
memset(s, 0, sizeof(TestState));
|
||||
s->passed = 1;
|
||||
s->failed = 2;
|
||||
s->pending = 3;
|
||||
s->run = 6;
|
||||
}
|
||||
|
||||
decl_test(always_passes)
|
||||
{
|
||||
return test_success;
|
||||
}
|
||||
|
||||
//jl
|
||||
|
||||
Reference in New Issue
Block a user