This is the mail archive of the mailing list for the glibc project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] support: Implement TEST_COMPARE_STRING

On Mon, 05 Nov 2018, Florian Weimer wrote:

>2018-11-05  Florian Weimer  <>
>	* support/check.h (TEST_COMPARE_STRING): Define.
>	(support_test_compare_string): Declare.
>	* support/Makefile (libsupport-routines): Add
>	support_test_compare_string.
>	(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).

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]