about summary refs log tree commit diff
path: root/support/check.h
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2018-11-07 12:42:44 +0100
committerFlorian Weimer <fweimer@redhat.com>2018-11-07 12:42:44 +0100
commit1df872fd74f730bcae3df201a229195445d2e18a (patch)
tree11dd30ab0bd01a98b03777be5d4a08dad2ab2c2b /support/check.h
parent295132ff052b32960207d82a950c0efbf0766857 (diff)
downloadglibc-1df872fd74f730bcae3df201a229195445d2e18a.tar.gz
glibc-1df872fd74f730bcae3df201a229195445d2e18a.tar.xz
glibc-1df872fd74f730bcae3df201a229195445d2e18a.zip
support: Implement TEST_COMPARE_STRING
Diffstat (limited to 'support/check.h')
-rw-r--r--support/check.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/support/check.h b/support/check.h
index b3a4645e92..e6765289f2 100644
--- a/support/check.h
+++ b/support/check.h
@@ -163,6 +163,19 @@ void support_test_compare_blob (const void *left,
                                 const char *right_exp,
                                 const char *right_len_exp);
 
+/* 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))
+
+void support_test_compare_string (const char *left, const char *right,
+                                  const char *file, int line,
+                                  const char *left_expr,
+                                  const char *right_expr);
+
 /* Internal function called by the test driver.  */
 int support_report_failure (int status)
   __attribute__ ((weak, warn_unused_result));