check all counts when comparing test states
This commit is contained in:
parent
c2f8972d9c
commit
e69a2d0375
78
test/util.c
78
test/util.c
@ -47,6 +47,33 @@ static void compare_run(
|
|||||||
const TestState *
|
const TestState *
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// compare the passed value of two states
|
||||||
|
static void compare_passed(
|
||||||
|
TestState *,
|
||||||
|
const char *,
|
||||||
|
const char *,
|
||||||
|
const TestState *,
|
||||||
|
const TestState *
|
||||||
|
);
|
||||||
|
|
||||||
|
// compare the failed value of two states
|
||||||
|
static void compare_failed(
|
||||||
|
TestState *,
|
||||||
|
const char *,
|
||||||
|
const char *,
|
||||||
|
const TestState *,
|
||||||
|
const TestState *
|
||||||
|
);
|
||||||
|
|
||||||
|
// compare the pending value of two states
|
||||||
|
static void compare_pending(
|
||||||
|
TestState *,
|
||||||
|
const char *,
|
||||||
|
const char *,
|
||||||
|
const TestState *,
|
||||||
|
const TestState *
|
||||||
|
);
|
||||||
|
|
||||||
// compare two ints
|
// compare two ints
|
||||||
static void compare_ints(
|
static void compare_ints(
|
||||||
TestState *,
|
TestState *,
|
||||||
@ -69,6 +96,9 @@ compare_states(
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
compare_run(s, prefix, context, expected, actual);
|
compare_run(s, prefix, context, expected, actual);
|
||||||
|
compare_passed(s, prefix, context, expected, actual);
|
||||||
|
compare_failed(s, prefix, context, expected, actual);
|
||||||
|
compare_pending(s, prefix, context, expected, actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Local Functions
|
// Local Functions
|
||||||
@ -89,6 +119,54 @@ compare_run(
|
|||||||
compare_ints(s, full_context, expected->run, actual->run);
|
compare_ints(s, full_context, expected->run, actual->run);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
compare_passed(
|
||||||
|
TestState *s,
|
||||||
|
const char *prefix,
|
||||||
|
const char *context,
|
||||||
|
const TestState *expected,
|
||||||
|
const TestState *actual
|
||||||
|
)
|
||||||
|
{
|
||||||
|
char full_context[STR_BUF_SIZE];
|
||||||
|
print(prefix);
|
||||||
|
print("passed\n");
|
||||||
|
snprintf(full_context, STR_BUF_SIZE, "%s passed:", context);
|
||||||
|
compare_ints(s, full_context, expected->passed, actual->passed);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
compare_failed(
|
||||||
|
TestState *s,
|
||||||
|
const char *prefix,
|
||||||
|
const char *context,
|
||||||
|
const TestState *expected,
|
||||||
|
const TestState *actual
|
||||||
|
)
|
||||||
|
{
|
||||||
|
char full_context[STR_BUF_SIZE];
|
||||||
|
print(prefix);
|
||||||
|
print("failed\n");
|
||||||
|
snprintf(full_context, STR_BUF_SIZE, "%s failed:", context);
|
||||||
|
compare_ints(s, full_context, expected->failed, actual->failed);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
compare_pending(
|
||||||
|
TestState *s,
|
||||||
|
const char *prefix,
|
||||||
|
const char *context,
|
||||||
|
const TestState *expected,
|
||||||
|
const TestState *actual
|
||||||
|
)
|
||||||
|
{
|
||||||
|
char full_context[STR_BUF_SIZE];
|
||||||
|
print(prefix);
|
||||||
|
print("pending\n");
|
||||||
|
snprintf(full_context, STR_BUF_SIZE, "%s pending:", context);
|
||||||
|
compare_ints(s, full_context, expected->pending, actual->pending);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
compare_ints(
|
compare_ints(
|
||||||
TestState *s,
|
TestState *s,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user