check all counts when comparing test states

This commit is contained in:
jlamothe 2023-11-09 21:12:21 +00:00
parent c2f8972d9c
commit e69a2d0375

View File

@ -47,6 +47,33 @@ static void compare_run(
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
static void compare_ints(
TestState *,
@ -69,6 +96,9 @@ compare_states(
)
{
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
@ -89,6 +119,54 @@ compare_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
compare_ints(
TestState *s,