|
|
|
@@ -28,90 +28,115 @@
|
|
|
|
|
|
|
|
|
|
|
|
// Internal Prototypes
|
|
|
|
// Internal Prototypes
|
|
|
|
|
|
|
|
|
|
|
|
static void tests(TestState *);
|
|
|
|
static TestResult initial_test_count(TestState *, void *);
|
|
|
|
decl_test(initial_test_count);
|
|
|
|
static TestResult initial_pass_count(TestState *, void *);
|
|
|
|
decl_test(initial_pass_count);
|
|
|
|
static TestResult initial_fail_count(TestState *, void *);
|
|
|
|
decl_test(initial_fail_count);
|
|
|
|
static TestResult initial_pend_count(TestState *, void *);
|
|
|
|
decl_test(initial_pend_count);
|
|
|
|
static TestResult initial_first_log(TestState *, void *);
|
|
|
|
decl_test(initial_first_log);
|
|
|
|
static TestResult initial_last_log(TestState *, void *);
|
|
|
|
decl_test(initial_last_log);
|
|
|
|
static TestResult initial_ptr(TestState *, void *);
|
|
|
|
decl_test(initial_ptr);
|
|
|
|
static TestResult initial_context(TestState *, void *);
|
|
|
|
decl_test(initial_context);
|
|
|
|
static TestResult initial_full_context(TestState *, void *);
|
|
|
|
decl_test(initial_full_context);
|
|
|
|
static TestResult initial_depth(TestState *, void *);
|
|
|
|
decl_test(initial_depth);
|
|
|
|
static TestResult initial_report(TestState *, void *);
|
|
|
|
decl_test(initial_report);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Public Functions
|
|
|
|
// Public Functions
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
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, "run", initial_test_count, ptr);
|
|
|
|
single_test_context(s, "passsed", initial_pass_count);
|
|
|
|
single_test_context(s, "passsed", initial_pass_count, ptr);
|
|
|
|
single_test_context(s, "failed", initial_fail_count);
|
|
|
|
single_test_context(s, "failed", initial_fail_count, ptr);
|
|
|
|
single_test_context(s, "pending", initial_pend_count);
|
|
|
|
single_test_context(s, "pending", initial_pend_count, ptr);
|
|
|
|
single_test_context(s, "first_log", initial_first_log);
|
|
|
|
single_test_context(s, "first_log", initial_first_log, ptr);
|
|
|
|
single_test_context(s, "last_log", initial_last_log);
|
|
|
|
single_test_context(s, "last_log", initial_last_log, ptr);
|
|
|
|
single_test_context(s, "ptr", initial_ptr);
|
|
|
|
single_test_context(s, "ptr", initial_ptr, ptr);
|
|
|
|
single_test_context(s, "context", initial_context);
|
|
|
|
single_test_context(s, "context", initial_context, ptr);
|
|
|
|
single_test_context(s, "full_context", initial_full_context);
|
|
|
|
single_test_context(s, "full_context", initial_full_context, ptr);
|
|
|
|
single_test_context(s, "depth", initial_depth);
|
|
|
|
single_test_context(s, "depth", initial_depth, ptr);
|
|
|
|
single_test_context(s, "report()", initial_report);
|
|
|
|
single_test_context(s, "report()", initial_report, ptr);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Internal Functions
|
|
|
|
// 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;
|
|
|
|
if (scpy->run == 0) return test_success;
|
|
|
|
append_test_log(s, "initial run was nonzero");
|
|
|
|
append_test_log(s, "initial run was nonzero");
|
|
|
|
return test_failure;
|
|
|
|
return test_failure;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
def_test(initial_pass_count, s)
|
|
|
|
static TestResult
|
|
|
|
|
|
|
|
initial_pass_count(
|
|
|
|
|
|
|
|
TestState *s,
|
|
|
|
|
|
|
|
void *ptr
|
|
|
|
|
|
|
|
)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
TestState *scpy = s->ptr;
|
|
|
|
TestState *scpy = ptr;
|
|
|
|
print("\tpassed\n");
|
|
|
|
|
|
|
|
if (scpy->passed == 0) return test_success;
|
|
|
|
if (scpy->passed == 0) return test_success;
|
|
|
|
append_test_log(s, "initial passed was nonzero");
|
|
|
|
append_test_log(s, "initial passed was nonzero");
|
|
|
|
return test_failure;
|
|
|
|
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;
|
|
|
|
if (scpy->failed == 0) return test_success;
|
|
|
|
append_test_log(s, "initial failed was nonzero");
|
|
|
|
append_test_log(s, "initial failed was nonzero");
|
|
|
|
return test_failure;
|
|
|
|
return test_failure;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
def_test(initial_pend_count, s)
|
|
|
|
static TestResult
|
|
|
|
|
|
|
|
initial_pend_count(
|
|
|
|
|
|
|
|
TestState *s,
|
|
|
|
|
|
|
|
void *ptr
|
|
|
|
|
|
|
|
)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
TestState *scpy = s->ptr;
|
|
|
|
TestState *scpy = ptr;
|
|
|
|
print("\tpending\n");
|
|
|
|
|
|
|
|
if (scpy->pending == 0) return test_success;
|
|
|
|
if (scpy->pending == 0) return test_success;
|
|
|
|
append_test_log(s, "initial pending was nonzero");
|
|
|
|
append_test_log(s, "initial pending was nonzero");
|
|
|
|
return test_failure;
|
|
|
|
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;
|
|
|
|
if (scpy->first_log == 0) return test_success;
|
|
|
|
append_test_log(s, "initial first_log was not null");
|
|
|
|
append_test_log(s, "initial first_log was not null");
|
|
|
|
return test_failure;
|
|
|
|
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;
|
|
|
|
if (scpy->last_log == 0) return test_success;
|
|
|
|
append_test_log(s, "initial last_log was not null");
|
|
|
|
append_test_log(s, "initial last_log was not null");
|
|
|
|
return test_failure;
|
|
|
|
return test_failure;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
def_test(initial_ptr, s)
|
|
|
|
static TestResult
|
|
|
|
|
|
|
|
initial_ptr(
|
|
|
|
|
|
|
|
TestState *s,
|
|
|
|
|
|
|
|
void *ptr
|
|
|
|
|
|
|
|
)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
TestState *scpy = s->ptr;
|
|
|
|
TestState *scpy = s->ptr;
|
|
|
|
if (scpy->ptr == 0) return test_success;
|
|
|
|
if (scpy->ptr == 0) return test_success;
|
|
|
|
@@ -119,31 +144,47 @@ def_test(initial_ptr, s)
|
|
|
|
return test_failure;
|
|
|
|
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;
|
|
|
|
if (scpy->context == 0) return test_success;
|
|
|
|
append_test_log(s, "initial context was not null");
|
|
|
|
append_test_log(s, "initial context was not null");
|
|
|
|
return test_failure;
|
|
|
|
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;
|
|
|
|
if (scpy->context == 0) return test_success;
|
|
|
|
append_test_log(s, "initial full_context was not null");
|
|
|
|
append_test_log(s, "initial full_context was not null");
|
|
|
|
return test_failure;
|
|
|
|
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;
|
|
|
|
if (scpy->depth == 0) return test_success;
|
|
|
|
append_test_log(s, "initial depth was not zero");
|
|
|
|
append_test_log(s, "initial depth was not zero");
|
|
|
|
return test_failure;
|
|
|
|
return test_failure;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
def_test(initial_report, s)
|
|
|
|
static TestResult
|
|
|
|
|
|
|
|
initial_report(
|
|
|
|
|
|
|
|
TestState *s,
|
|
|
|
|
|
|
|
void *ptr
|
|
|
|
|
|
|
|
)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
TestState *scpy = s->ptr;
|
|
|
|
TestState *scpy = s->ptr;
|
|
|
|
if (scpy->report != 0) return test_success;
|
|
|
|
if (scpy->report != 0) return test_success;
|
|
|
|
|