This is the mail archive of the
mailing list for the glibc project.
Re: [PATCH] support: Implement TEST_COMPARE_STRING
- From: "Gabriel F. T. Gomes" <gabriel at inconstante dot eti dot br>
- To: Florian Weimer <fweimer at redhat dot com>
- Cc: <libc-alpha at sourceware dot org>
- Date: Wed, 7 Nov 2018 08:56:53 -0200
- Subject: Re: [PATCH] support: Implement TEST_COMPARE_STRING
- References: <email@example.com>
On Mon, 05 Nov 2018, Florian Weimer wrote:
>2018-11-05 Florian Weimer <firstname.lastname@example.org>
> Implement TEST_COMPARE_STRING.
> * support/check.h (TEST_COMPARE_STRING): Define.
> (support_test_compare_string): Declare.
> * support/Makefile (libsupport-routines): Add
> (tests): Add tst-test_compare_string.
> * support/support_test_compare_string.c: New file.
> * support/tst-test_compare_string.c: Likewise.
Looks good to me with a fix to some whitespace problems.
>+/* Compare the strings LEFT and RIGHT and report a test failure if
>+ they are different. Also report failure if one of the arguments is
>+ a null pointer and the other is not. The strings should be
>+ reasonably short because on mismatch, both are printed. */
>+#define TEST_COMPARE_STRING(left, right) \
>+ (support_test_compare_string (left, right, __FILE__, __LINE__, \
>+ #left, #right))
Spaces instead of tabs.
>+void support_test_compare_string (const char *left, const char *right,
>+ const char *file, int line,
>+ const char *left_expr,
>+ const char *right_expr);
Likewise, here and throughout the patch.
>+ fputs (" ", stdout);
>+ for (size_t i = 0; i < length; ++i)
>+ printf (" %02X", blob[i]);
Thanks for adding this hex conversion. In the recently added test,
tst-ldbl-warn, it would have saved me some time in finding that a new line
wasn't being printed.
(I tried this patch on tst-ldbl-warn, by the way).