WIP: re-writing tests
This commit is contained in:
@@ -28,90 +28,115 @@
|
||||
|
||||
// Internal Prototypes
|
||||
|
||||
static void tests(TestState *);
|
||||
decl_test(initial_test_count);
|
||||
decl_test(initial_pass_count);
|
||||
decl_test(initial_fail_count);
|
||||
decl_test(initial_pend_count);
|
||||
decl_test(initial_first_log);
|
||||
decl_test(initial_last_log);
|
||||
decl_test(initial_ptr);
|
||||
decl_test(initial_context);
|
||||
decl_test(initial_full_context);
|
||||
decl_test(initial_depth);
|
||||
decl_test(initial_report);
|
||||
static TestResult initial_test_count(TestState *, void *);
|
||||
static TestResult initial_pass_count(TestState *, void *);
|
||||
static TestResult initial_fail_count(TestState *, void *);
|
||||
static TestResult initial_pend_count(TestState *, void *);
|
||||
static TestResult initial_first_log(TestState *, void *);
|
||||
static TestResult initial_last_log(TestState *, void *);
|
||||
static TestResult initial_ptr(TestState *, void *);
|
||||
static TestResult initial_context(TestState *, void *);
|
||||
static TestResult initial_full_context(TestState *, void *);
|
||||
static TestResult initial_depth(TestState *, void *);
|
||||
static TestResult initial_report(TestState *, void *);
|
||||
|
||||
// Public Functions
|
||||
|
||||
void
|
||||
test_initial_state(TestState *s)
|
||||
test_initial_state(TestState *s, void *ptr)
|
||||
{
|
||||
single_test_context(s, "run", initial_test_count);
|
||||
single_test_context(s, "passsed", initial_pass_count);
|
||||
single_test_context(s, "failed", initial_fail_count);
|
||||
single_test_context(s, "pending", initial_pend_count);
|
||||
single_test_context(s, "first_log", initial_first_log);
|
||||
single_test_context(s, "last_log", initial_last_log);
|
||||
single_test_context(s, "ptr", initial_ptr);
|
||||
single_test_context(s, "context", initial_context);
|
||||
single_test_context(s, "full_context", initial_full_context);
|
||||
single_test_context(s, "depth", initial_depth);
|
||||
single_test_context(s, "report()", initial_report);
|
||||
single_test_context(s, "run", initial_test_count, ptr);
|
||||
single_test_context(s, "passsed", initial_pass_count, ptr);
|
||||
single_test_context(s, "failed", initial_fail_count, ptr);
|
||||
single_test_context(s, "pending", initial_pend_count, ptr);
|
||||
single_test_context(s, "first_log", initial_first_log, ptr);
|
||||
single_test_context(s, "last_log", initial_last_log, ptr);
|
||||
single_test_context(s, "ptr", initial_ptr, ptr);
|
||||
single_test_context(s, "context", initial_context, ptr);
|
||||
single_test_context(s, "full_context", initial_full_context, ptr);
|
||||
single_test_context(s, "depth", initial_depth, ptr);
|
||||
single_test_context(s, "report()", initial_report, ptr);
|
||||
}
|
||||
|
||||
// Internal Functions
|
||||
|
||||
def_test(initial_test_count, s)
|
||||
static TestResult
|
||||
initial_test_count(
|
||||
TestState *s,
|
||||
void *ptr
|
||||
)
|
||||
{
|
||||
TestState *scpy = s->ptr;
|
||||
TestState *scpy = ptr;
|
||||
if (scpy->run == 0) return test_success;
|
||||
append_test_log(s, "initial run was nonzero");
|
||||
return test_failure;
|
||||
}
|
||||
|
||||
def_test(initial_pass_count, s)
|
||||
static TestResult
|
||||
initial_pass_count(
|
||||
TestState *s,
|
||||
void *ptr
|
||||
)
|
||||
{
|
||||
TestState *scpy = s->ptr;
|
||||
print("\tpassed\n");
|
||||
TestState *scpy = ptr;
|
||||
if (scpy->passed == 0) return test_success;
|
||||
append_test_log(s, "initial passed was nonzero");
|
||||
return test_failure;
|
||||
}
|
||||
|
||||
def_test(initial_fail_count, s)
|
||||
static TestResult
|
||||
initial_fail_count(
|
||||
TestState *s,
|
||||
void *ptr
|
||||
)
|
||||
{
|
||||
TestState *scpy = s->ptr;
|
||||
TestState *scpy = ptr;
|
||||
if (scpy->failed == 0) return test_success;
|
||||
append_test_log(s, "initial failed was nonzero");
|
||||
return test_failure;
|
||||
}
|
||||
|
||||
def_test(initial_pend_count, s)
|
||||
static TestResult
|
||||
initial_pend_count(
|
||||
TestState *s,
|
||||
void *ptr
|
||||
)
|
||||
{
|
||||
TestState *scpy = s->ptr;
|
||||
print("\tpending\n");
|
||||
TestState *scpy = ptr;
|
||||
if (scpy->pending == 0) return test_success;
|
||||
append_test_log(s, "initial pending was nonzero");
|
||||
return test_failure;
|
||||
}
|
||||
|
||||
def_test(initial_first_log, s)
|
||||
static TestResult
|
||||
initial_first_log(
|
||||
TestState *s,
|
||||
void *ptr
|
||||
)
|
||||
{
|
||||
TestState *scpy = s->ptr;
|
||||
TestState *scpy = ptr;
|
||||
if (scpy->first_log == 0) return test_success;
|
||||
append_test_log(s, "initial first_log was not null");
|
||||
return test_failure;
|
||||
}
|
||||
|
||||
def_test(initial_last_log, s)
|
||||
static TestResult
|
||||
initial_last_log(
|
||||
TestState *s,
|
||||
void *ptr
|
||||
)
|
||||
{
|
||||
TestState *scpy = s->ptr;
|
||||
TestState *scpy = ptr;
|
||||
if (scpy->last_log == 0) return test_success;
|
||||
append_test_log(s, "initial last_log was not null");
|
||||
return test_failure;
|
||||
}
|
||||
|
||||
def_test(initial_ptr, s)
|
||||
static TestResult
|
||||
initial_ptr(
|
||||
TestState *s,
|
||||
void *ptr
|
||||
)
|
||||
{
|
||||
TestState *scpy = s->ptr;
|
||||
if (scpy->ptr == 0) return test_success;
|
||||
@@ -119,31 +144,47 @@ def_test(initial_ptr, s)
|
||||
return test_failure;
|
||||
}
|
||||
|
||||
def_test(initial_context, s)
|
||||
static TestResult
|
||||
initial_context(
|
||||
TestState *s,
|
||||
void *ptr
|
||||
)
|
||||
{
|
||||
TestState *scpy = s->ptr;
|
||||
TestState *scpy = ptr;
|
||||
if (scpy->context == 0) return test_success;
|
||||
append_test_log(s, "initial context was not null");
|
||||
return test_failure;
|
||||
}
|
||||
|
||||
def_test(initial_full_context, s)
|
||||
static TestResult
|
||||
initial_full_context(
|
||||
TestState *s,
|
||||
void *ptr
|
||||
)
|
||||
{
|
||||
TestState *scpy = s->ptr;
|
||||
TestState *scpy = ptr;
|
||||
if (scpy->context == 0) return test_success;
|
||||
append_test_log(s, "initial full_context was not null");
|
||||
return test_failure;
|
||||
}
|
||||
|
||||
def_test(initial_depth, s)
|
||||
static TestResult
|
||||
initial_depth(
|
||||
TestState *s,
|
||||
void *ptr
|
||||
)
|
||||
{
|
||||
TestState *scpy = s->ptr;
|
||||
TestState *scpy = ptr;
|
||||
if (scpy->depth == 0) return test_success;
|
||||
append_test_log(s, "initial depth was not zero");
|
||||
return test_failure;
|
||||
}
|
||||
|
||||
def_test(initial_report, s)
|
||||
static TestResult
|
||||
initial_report(
|
||||
TestState *s,
|
||||
void *ptr
|
||||
)
|
||||
{
|
||||
TestState *scpy = s->ptr;
|
||||
if (scpy->report != 0) return test_success;
|
||||
|
||||
Reference in New Issue
Block a user