diff options
author | Florian Weimer <fweimer@redhat.com> | 2018-05-16 17:00:35 +0200 |
---|---|---|
committer | Florian Weimer <fweimer@redhat.com> | 2018-05-16 17:00:36 +0200 |
commit | 2afece36f6006844e87d7cb2fcb1ad8b220b2623 (patch) | |
tree | 52958dc70aaab18d73b3b3ecafc8adfacd0b7131 /support/check.h | |
parent | 9761bf4dfae04016bccaa82414719523b090dd60 (diff) | |
download | glibc-2afece36f6006844e87d7cb2fcb1ad8b220b2623.zip glibc-2afece36f6006844e87d7cb2fcb1ad8b220b2623.tar.gz glibc-2afece36f6006844e87d7cb2fcb1ad8b220b2623.tar.bz2 |
support: Add TEST_COMPARE_BLOB, support_quote_blob
The declaration of support_test_compare_blob uses unsigned long int,
to avoid including <stddef.h>.
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Diffstat (limited to 'support/check.h')
-rw-r--r-- | support/check.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/support/check.h b/support/check.h index 2192f38..b3a4645 100644 --- a/support/check.h +++ b/support/check.h @@ -64,6 +64,8 @@ __BEGIN_DECLS (1, __FILE__, __LINE__, #expr); \ }) + + int support_print_failure_impl (const char *file, int line, const char *format, ...) __attribute__ ((nonnull (1), format (printf, 3, 4))); @@ -141,6 +143,26 @@ void support_test_compare_failure (const char *file, int line, int right_size); +/* Compare [LEFT, LEFT + LEFT_LENGTH) with [RIGHT, RIGHT + + RIGHT_LENGTH) and report a test failure if the arrays are + different. LEFT_LENGTH and RIGHT_LENGTH are measured in bytes. If + the length is null, the corresponding pointer is ignored (i.e., it + can be NULL). The blobs should be reasonably short because on + mismatch, both are printed. */ +#define TEST_COMPARE_BLOB(left, left_length, right, right_length) \ + (support_test_compare_blob (left, left_length, right, right_length, \ + __FILE__, __LINE__, \ + #left, #left_length, #right, #right_length)) + +void support_test_compare_blob (const void *left, + unsigned long int left_length, + const void *right, + unsigned long int right_length, + const char *file, int line, + const char *left_exp, const char *left_len_exp, + const char *right_exp, + const char *right_len_exp); + /* Internal function called by the test driver. */ int support_report_failure (int status) __attribute__ ((weak, warn_unused_result)); |