From f817af1a5cd0ce1ee2c8813abe6c458b2e4c52d9 Mon Sep 17 00:00:00 2001 From: jlamothe Date: Thu, 9 Nov 2023 23:04:45 +0000 Subject: [PATCH] compare first & last log pointers when comparing test states --- test/util.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/test/util.c b/test/util.c index 907eb6b..4f6f76c 100644 --- a/test/util.c +++ b/test/util.c @@ -82,6 +82,24 @@ static void compare_pending( 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 static void compare_ptr( TestState *, @@ -125,6 +143,8 @@ compare_states( compare_passed(s, prefix, context, expected, actual); compare_failed(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); } @@ -194,6 +214,38 @@ compare_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 compare_ptr( TestState *s,