compare first & last log pointers when comparing test states

This commit is contained in:
jlamothe 2023-11-09 23:04:45 +00:00
parent 0665b8be3e
commit f817af1a5c

View File

@ -82,6 +82,24 @@ static void compare_pending(
const TestState * const TestState *
); );
// compare the first_log value of two states
static void compare_first_log(
TestState *,
const char *,
const char *,
const TestState *,
const TestState *
);
// compare the last_log value of two states
static void compare_last_log(
TestState *,
const char *,
const char *,
const TestState *,
const TestState *
);
// compare the ptr value of two states // compare the ptr value of two states
static void compare_ptr( static void compare_ptr(
TestState *, TestState *,
@ -125,6 +143,8 @@ compare_states(
compare_passed(s, prefix, context, expected, actual); compare_passed(s, prefix, context, expected, actual);
compare_failed(s, prefix, context, expected, actual); compare_failed(s, prefix, context, expected, actual);
compare_pending(s, prefix, context, expected, actual); compare_pending(s, prefix, context, expected, actual);
compare_first_log(s, prefix, context, expected, actual);
compare_last_log(s, prefix, context, expected, actual);
compare_ptr(s, prefix, context, expected, actual); compare_ptr(s, prefix, context, expected, actual);
} }
@ -194,6 +214,38 @@ compare_pending(
compare_ints(s, full_context, expected->pending, actual->pending); compare_ints(s, full_context, expected->pending, actual->pending);
} }
static void
compare_first_log(
TestState *s,
const char *prefix,
const char *context,
const TestState *expected,
const TestState *actual
)
{
char full_context[STR_BUF_SIZE];
print(prefix);
print("first_log\n");
snprintf(full_context, STR_BUF_SIZE, "%s first_log:", context);
compare_ptrs(s, full_context, expected->first_log, actual->first_log);
}
static void
compare_last_log(
TestState *s,
const char *prefix,
const char *context,
const TestState *expected,
const TestState *actual
)
{
char full_context[STR_BUF_SIZE];
print(prefix);
print("last_log\n");
snprintf(full_context, STR_BUF_SIZE, "%s last_log:", context);
compare_ptrs(s, full_context, expected->last_log, actual->last_log);
}
static void static void
compare_ptr( compare_ptr(
TestState *s, TestState *s,