From: Bruno Haible Date: Sun, 1 Mar 2026 11:35:40 +0000 (+0100) Subject: tests: Use memeq, part 1. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b2a583ead5718cf7a8136ae627e6001b89d4d79a;p=thirdparty%2Fgnulib.git tests: Use memeq, part 1. Done through sed -e 's/memcmp \([(][^()]*[)]\) == 0/memeq \1/g' \ -e 's/memcmp \([(][^()]*[(][^()]*[)][^()]*[)]\) == 0/memeq \1/g' * tests/**/*.[hc]: Use memeq instead of memcmp ... == 0. * modules/*-tests (Dependencies): Add memeq. --- diff --git a/ChangeLog b/ChangeLog index 966dc91af8..3845e48908 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2026-03-01 Bruno Haible + + tests: Use memeq, part 1. + Done through + sed -e 's/memcmp \([(][^()]*[)]\) == 0/memeq \1/g' \ + -e 's/memcmp \([(][^()]*[(][^()]*[)][^()]*[)]\) == 0/memeq \1/g' + * tests/**/*.[hc]: Use memeq instead of memcmp ... == 0. + * modules/*-tests (Dependencies): Add memeq. + 2026-03-01 Bruno Haible tests: Use streq, part 4. diff --git a/modules/base32-tests b/modules/base32-tests index bdf7827e0f..ce442b0fcd 100644 --- a/modules/base32-tests +++ b/modules/base32-tests @@ -4,6 +4,7 @@ tests/macros.h Depends-on: streq +memeq configure.ac: diff --git a/modules/base64-tests b/modules/base64-tests index 57c838eed2..6822deba32 100644 --- a/modules/base64-tests +++ b/modules/base64-tests @@ -4,6 +4,7 @@ tests/macros.h Depends-on: streq +memeq configure.ac: diff --git a/modules/c-nstrftime-tests b/modules/c-nstrftime-tests index bcfad83ae5..c0f45bd91c 100644 --- a/modules/c-nstrftime-tests +++ b/modules/c-nstrftime-tests @@ -14,6 +14,7 @@ intprops setlocale strerror streq +memeq configure.ac: gt_LOCALE_FR diff --git a/modules/c32rtomb-tests b/modules/c32rtomb-tests index 5cff3ca72d..4bed97de10 100644 --- a/modules/c32rtomb-tests +++ b/modules/c32rtomb-tests @@ -23,6 +23,7 @@ mbrtoc32 setlocale localcharset streq +memeq configure.ac: gt_LOCALE_EN_UTF8 diff --git a/modules/c32snrtombs-tests b/modules/c32snrtombs-tests index d9aa7b0979..224645d520 100644 --- a/modules/c32snrtombs-tests +++ b/modules/c32snrtombs-tests @@ -15,6 +15,7 @@ m4/codeset.m4 Depends-on: setlocale mbstoc32s +memeq configure.ac: gt_LOCALE_EN_UTF8 diff --git a/modules/c32srtombs-tests b/modules/c32srtombs-tests index 01026ed6d6..fd320eed33 100644 --- a/modules/c32srtombs-tests +++ b/modules/c32srtombs-tests @@ -15,6 +15,7 @@ m4/codeset.m4 Depends-on: setlocale mbstoc32s +memeq configure.ac: gt_LOCALE_EN_UTF8 diff --git a/modules/c32stombs-tests b/modules/c32stombs-tests index 8b0d47fa02..35ad6444cc 100644 --- a/modules/c32stombs-tests +++ b/modules/c32stombs-tests @@ -15,6 +15,7 @@ m4/codeset.m4 Depends-on: setlocale mbstoc32s +memeq configure.ac: gt_LOCALE_EN_UTF8 diff --git a/modules/c32tolower-tests b/modules/c32tolower-tests index 74aa972f1e..6a99fb27ad 100644 --- a/modules/c32tolower-tests +++ b/modules/c32tolower-tests @@ -13,6 +13,7 @@ Depends-on: mbrtoc32 c32rtomb setlocale +memeq configure.ac: gt_LOCALE_EN_UTF8 diff --git a/modules/c32toupper-tests b/modules/c32toupper-tests index 18bb562af5..d2b629fd5d 100644 --- a/modules/c32toupper-tests +++ b/modules/c32toupper-tests @@ -14,6 +14,7 @@ Depends-on: mbrtoc32 c32rtomb setlocale +memeq configure.ac: gt_LOCALE_EN_UTF8 diff --git a/modules/cnd-tests b/modules/cnd-tests index 4255d8fc9b..c775a94267 100644 --- a/modules/cnd-tests +++ b/modules/cnd-tests @@ -8,6 +8,7 @@ mtx thrd gettimeofday streq +memeq configure.ac: AC_CHECK_DECLS_ONCE([alarm]) diff --git a/modules/cond-tests b/modules/cond-tests index 5047575a99..9b65c499c0 100644 --- a/modules/cond-tests +++ b/modules/cond-tests @@ -9,6 +9,7 @@ yield gettimeofday sleep streq +memeq configure.ac: diff --git a/modules/copysign-tests b/modules/copysign-tests index 5a07220eba..128e500d16 100644 --- a/modules/copysign-tests +++ b/modules/copysign-tests @@ -5,6 +5,7 @@ tests/minus-zero.h tests/macros.h Depends-on: +memeq configure.ac: diff --git a/modules/copysignf-tests b/modules/copysignf-tests index 78b042cdf6..ad71714817 100644 --- a/modules/copysignf-tests +++ b/modules/copysignf-tests @@ -5,6 +5,7 @@ tests/minus-zero.h tests/macros.h Depends-on: +memeq configure.ac: diff --git a/modules/copysignl-tests b/modules/copysignl-tests index c1f28a5f19..bca237f637 100644 --- a/modules/copysignl-tests +++ b/modules/copysignl-tests @@ -6,6 +6,7 @@ tests/macros.h Depends-on: float-h +memeq configure.ac: diff --git a/modules/crypto/sha3-buffer-tests b/modules/crypto/sha3-buffer-tests index ebb293381b..5f76bf055b 100644 --- a/modules/crypto/sha3-buffer-tests +++ b/modules/crypto/sha3-buffer-tests @@ -14,6 +14,7 @@ Depends-on: c99 getrusage gettimeofday +memeq configure.ac: diff --git a/modules/exclude-tests b/modules/exclude-tests index fbf902901b..309c53375f 100644 --- a/modules/exclude-tests +++ b/modules/exclude-tests @@ -14,6 +14,7 @@ argmatch error test-framework-sh streq +memeq configure.ac: diff --git a/modules/execute-tests b/modules/execute-tests index 68f2924f07..d5e459ec5a 100644 --- a/modules/execute-tests +++ b/modules/execute-tests @@ -19,6 +19,7 @@ bool stdint-h unistd-h streq +memeq configure.ac: dnl Test for Linux system call close_range(), declared in . diff --git a/modules/explicit_bzero-tests b/modules/explicit_bzero-tests index c6c541b4e5..edc67f61fd 100644 --- a/modules/explicit_bzero-tests +++ b/modules/explicit_bzero-tests @@ -6,6 +6,7 @@ tests/macros.h Depends-on: stdint-h vma-iter +memeq configure.ac: diff --git a/modules/fpurge-tests b/modules/fpurge-tests index 59c6e7d070..b1cb384c1b 100644 --- a/modules/fpurge-tests +++ b/modules/fpurge-tests @@ -5,6 +5,7 @@ tests/macros.h Depends-on: fflush ftell +memeq configure.ac: diff --git a/modules/freadptr-tests b/modules/freadptr-tests index fdb44af041..ef7d4327d1 100644 --- a/modules/freadptr-tests +++ b/modules/freadptr-tests @@ -8,6 +8,7 @@ tests/macros.h Depends-on: lseek unistd-h +memeq configure.ac: diff --git a/modules/freadseek-tests b/modules/freadseek-tests index 86dfeebd7e..84f29bae34 100644 --- a/modules/freadseek-tests +++ b/modules/freadseek-tests @@ -5,6 +5,7 @@ tests/macros.h Depends-on: unistd-h +memeq configure.ac: diff --git a/modules/fseeko-extra-tests b/modules/fseeko-extra-tests index e59b800e66..577644dd8b 100644 --- a/modules/fseeko-extra-tests +++ b/modules/fseeko-extra-tests @@ -9,6 +9,7 @@ Depends-on: fsync ftruncate write +memeq configure.ac: diff --git a/modules/ftell-tests b/modules/ftell-tests index 4143138da6..e67b79317a 100644 --- a/modules/ftell-tests +++ b/modules/ftell-tests @@ -9,6 +9,7 @@ m4/ungetc.m4 Depends-on: binary-io +memeq configure.ac: gl_FUNC_UNGETC_WORKS diff --git a/modules/ftello-tests b/modules/ftello-tests index d709a6ebe5..a285fecf35 100644 --- a/modules/ftello-tests +++ b/modules/ftello-tests @@ -13,6 +13,7 @@ Depends-on: binary-io fdopen ftello-extra-tests +memeq configure.ac: gl_FUNC_UNGETC_WORKS diff --git a/modules/getdelim-tests b/modules/getdelim-tests index 383d51ec42..4c8e6a5a36 100644 --- a/modules/getdelim-tests +++ b/modules/getdelim-tests @@ -5,6 +5,7 @@ tests/macros.h Depends-on: streq +memeq configure.ac: diff --git a/modules/getline-tests b/modules/getline-tests index 65c84dec77..a3c3967a3d 100644 --- a/modules/getline-tests +++ b/modules/getline-tests @@ -5,6 +5,7 @@ tests/macros.h Depends-on: streq +memeq configure.ac: diff --git a/modules/getndelim2-tests b/modules/getndelim2-tests index d2f23f2def..732794fddc 100644 --- a/modules/getndelim2-tests +++ b/modules/getndelim2-tests @@ -4,6 +4,7 @@ tests/macros.h Depends-on: streq +memeq configure.ac: diff --git a/modules/iconv-tests b/modules/iconv-tests index c1709f95de..8f42aa852e 100644 --- a/modules/iconv-tests +++ b/modules/iconv-tests @@ -5,6 +5,7 @@ tests/macros.h Depends-on: iconv_open +memeq configure.ac: diff --git a/modules/iconv_open-utf-tests b/modules/iconv_open-utf-tests index 3e3c988397..c02c38f8f8 100644 --- a/modules/iconv_open-utf-tests +++ b/modules/iconv_open-utf-tests @@ -3,6 +3,7 @@ tests/test-iconv-utf.c tests/macros.h Depends-on: +memeq configure.ac: diff --git a/modules/memset_explicit-tests b/modules/memset_explicit-tests index 2daff7ca46..b7098f4f10 100644 --- a/modules/memset_explicit-tests +++ b/modules/memset_explicit-tests @@ -6,6 +6,7 @@ tests/macros.h Depends-on: stdint-h vma-iter +memeq configure.ac: diff --git a/modules/nonblocking-pipe-tests b/modules/nonblocking-pipe-tests index 5d849decf5..ae330d470b 100644 --- a/modules/nonblocking-pipe-tests +++ b/modules/nonblocking-pipe-tests @@ -26,6 +26,7 @@ ssize_t usleep read write +memeq configure.ac: diff --git a/modules/nonblocking-socket-tests b/modules/nonblocking-socket-tests index 5def8af601..bcfeb9d7a2 100644 --- a/modules/nonblocking-socket-tests +++ b/modules/nonblocking-socket-tests @@ -36,6 +36,7 @@ ssize_t usleep read write +memeq configure.ac: diff --git a/modules/nstrftime-tests b/modules/nstrftime-tests index e30c5fcbda..2b799868e9 100644 --- a/modules/nstrftime-tests +++ b/modules/nstrftime-tests @@ -26,6 +26,7 @@ setenv setlocale strerror streq +memeq configure.ac: gt_LOCALE_FR diff --git a/modules/obstack-zprintf-gnu-tests b/modules/obstack-zprintf-gnu-tests index e5906d35db..9413992eae 100644 --- a/modules/obstack-zprintf-gnu-tests +++ b/modules/obstack-zprintf-gnu-tests @@ -3,6 +3,7 @@ tests/test-obstack-zprintf-gnu.c tests/macros.h Depends-on: +memeq configure.ac: diff --git a/modules/obstack-zprintf-posix-tests b/modules/obstack-zprintf-posix-tests index eeaf027340..c829d58de0 100644 --- a/modules/obstack-zprintf-posix-tests +++ b/modules/obstack-zprintf-posix-tests @@ -5,6 +5,7 @@ tests/macros.h Depends-on: nan +memeq configure.ac: diff --git a/modules/openpty-tests b/modules/openpty-tests index afe410a19f..dd765cacc4 100644 --- a/modules/openpty-tests +++ b/modules/openpty-tests @@ -3,6 +3,7 @@ tests/test-openpty.c tests/signature.h Depends-on: +memeq configure.ac: diff --git a/modules/pipe-filter-gi-tests b/modules/pipe-filter-gi-tests index e8b9644990..5fcc132f58 100644 --- a/modules/pipe-filter-gi-tests +++ b/modules/pipe-filter-gi-tests @@ -16,6 +16,7 @@ read-file full-write usleep streq +memeq configure.ac: diff --git a/modules/pipe-filter-ii-tests b/modules/pipe-filter-ii-tests index 1cab81f080..5ed82afe67 100644 --- a/modules/pipe-filter-ii-tests +++ b/modules/pipe-filter-ii-tests @@ -15,6 +15,7 @@ snan read-file full-write streq +memeq configure.ac: diff --git a/modules/posix_spawn-tests b/modules/posix_spawn-tests index 9f4e5ed4b4..efa9d63e10 100644 --- a/modules/posix_spawn-tests +++ b/modules/posix_spawn-tests @@ -22,6 +22,7 @@ fflush freopen waitpid streq +memeq configure.ac: diff --git a/modules/posix_spawn_file_actions_addchdir-tests b/modules/posix_spawn_file_actions_addchdir-tests index d44b3f1e82..34bc4b2a27 100644 --- a/modules/posix_spawn_file_actions_addchdir-tests +++ b/modules/posix_spawn_file_actions_addchdir-tests @@ -9,6 +9,7 @@ posix_spawn_file_actions_init posix_spawn_file_actions_destroy posix_spawnp-tests findprog +memeq configure.ac: diff --git a/modules/posix_spawnp-tests b/modules/posix_spawnp-tests index 39f591cb10..7a57cebd52 100644 --- a/modules/posix_spawnp-tests +++ b/modules/posix_spawnp-tests @@ -29,6 +29,7 @@ environ sh-filename sigprocmask waitpid +memeq configure.ac: diff --git a/modules/pthread-cond-tests b/modules/pthread-cond-tests index cb7c43afb2..bec2ce5e15 100644 --- a/modules/pthread-cond-tests +++ b/modules/pthread-cond-tests @@ -9,6 +9,7 @@ pthread-mutex nanosleep sched_yield streq +memeq configure.ac: AC_CHECK_DECLS_ONCE([alarm]) diff --git a/modules/pthread_sigmask-tests b/modules/pthread_sigmask-tests index a0b97ddf70..6083680da4 100644 --- a/modules/pthread_sigmask-tests +++ b/modules/pthread_sigmask-tests @@ -11,6 +11,7 @@ sleep pthread-thread test-xfail streq +memeq configure.ac: diff --git a/modules/ptsname-tests b/modules/ptsname-tests index ad39cf7957..1d440bac8f 100644 --- a/modules/ptsname-tests +++ b/modules/ptsname-tests @@ -6,6 +6,7 @@ tests/macros.h Depends-on: same-inode streq +memeq configure.ac: AC_CHECK_DECLS_ONCE([alarm]) diff --git a/modules/ptsname_r-tests b/modules/ptsname_r-tests index 210b664a40..4f735b2078 100644 --- a/modules/ptsname_r-tests +++ b/modules/ptsname_r-tests @@ -7,6 +7,7 @@ tests/macros.h Depends-on: same-inode streq +memeq configure.ac: AC_CHECK_DECLS_ONCE([alarm]) diff --git a/modules/quotearg-simple-tests b/modules/quotearg-simple-tests index 1c16890014..6c335fef81 100644 --- a/modules/quotearg-simple-tests +++ b/modules/quotearg-simple-tests @@ -9,6 +9,7 @@ Depends-on: c99 stdint-h streq +memeq configure.ac: dnl Check for prerequisites for memory fence checks. diff --git a/modules/quotearg-tests b/modules/quotearg-tests index 10ac964a9c..7edc378352 100644 --- a/modules/quotearg-tests +++ b/modules/quotearg-tests @@ -19,6 +19,7 @@ unsetenv setlocale localcharset streq +memeq configure.ac: gt_LOCALE_FR diff --git a/modules/read-tests b/modules/read-tests index 9a138677ca..2392733474 100644 --- a/modules/read-tests +++ b/modules/read-tests @@ -6,6 +6,7 @@ tests/macros.h Depends-on: binary-io open +memeq configure.ac: diff --git a/modules/sh-quote-tests b/modules/sh-quote-tests index 6de424781d..9f91288f55 100644 --- a/modules/sh-quote-tests +++ b/modules/sh-quote-tests @@ -4,6 +4,7 @@ tests/macros.h Depends-on: streq +memeq configure.ac: diff --git a/modules/sigprocmask-tests b/modules/sigprocmask-tests index a725808f81..254655daea 100644 --- a/modules/sigprocmask-tests +++ b/modules/sigprocmask-tests @@ -9,6 +9,7 @@ inttypes-h sleep test-xfail streq +memeq configure.ac: diff --git a/modules/snprintf-posix-tests b/modules/snprintf-posix-tests index 2c1a296a29..2080b3f2a4 100644 --- a/modules/snprintf-posix-tests +++ b/modules/snprintf-posix-tests @@ -14,6 +14,7 @@ float-h nan snan streq +memeq configure.ac: AC_REQUIRE([gl_LONG_DOUBLE_VS_DOUBLE]) diff --git a/modules/snprintf-tests b/modules/snprintf-tests index 4ed6d4ad8a..9da987fc79 100644 --- a/modules/snprintf-tests +++ b/modules/snprintf-tests @@ -5,6 +5,7 @@ tests/macros.h Depends-on: streq +memeq configure.ac: diff --git a/modules/snzprintf-posix-tests b/modules/snzprintf-posix-tests index 908d8fb2d2..0204aae608 100644 --- a/modules/snzprintf-posix-tests +++ b/modules/snzprintf-posix-tests @@ -7,6 +7,7 @@ tests/macros.h Depends-on: nan streq +memeq configure.ac: diff --git a/modules/spawn-pipe-tests b/modules/spawn-pipe-tests index 00a786bb06..2169e4a1ea 100644 --- a/modules/spawn-pipe-tests +++ b/modules/spawn-pipe-tests @@ -14,6 +14,7 @@ close msvc-inval bool stdint-h +memeq configure.ac: diff --git a/modules/sprintf-posix-tests b/modules/sprintf-posix-tests index 1df488ed05..f63808eb45 100644 --- a/modules/sprintf-posix-tests +++ b/modules/sprintf-posix-tests @@ -13,6 +13,7 @@ float-h nan snan streq +memeq configure.ac: AC_REQUIRE([gl_LONG_DOUBLE_VS_DOUBLE]) diff --git a/modules/striconv-tests b/modules/striconv-tests index fd0f583a8a..1a9bde9a4b 100644 --- a/modules/striconv-tests +++ b/modules/striconv-tests @@ -4,6 +4,7 @@ tests/macros.h Depends-on: streq +memeq configure.ac: diff --git a/modules/striconveh-tests b/modules/striconveh-tests index 2160c3958d..e93742f36d 100644 --- a/modules/striconveh-tests +++ b/modules/striconveh-tests @@ -4,6 +4,7 @@ tests/macros.h Depends-on: streq +memeq configure.ac: diff --git a/modules/striconveha-tests b/modules/striconveha-tests index c10ab366fb..b65f8e1c81 100644 --- a/modules/striconveha-tests +++ b/modules/striconveha-tests @@ -5,6 +5,7 @@ tests/macros.h Depends-on: streq +memeq configure.ac: diff --git a/modules/string-buffer-reversed-tests b/modules/string-buffer-reversed-tests index 550fe37352..1718a5e6bc 100644 --- a/modules/string-buffer-reversed-tests +++ b/modules/string-buffer-reversed-tests @@ -4,6 +4,7 @@ tests/macros.h Depends-on: streq +memeq configure.ac: diff --git a/modules/string-buffer-tests b/modules/string-buffer-tests index 490251c811..f52d7f8a1b 100644 --- a/modules/string-buffer-tests +++ b/modules/string-buffer-tests @@ -4,6 +4,7 @@ tests/macros.h Depends-on: streq +memeq configure.ac: diff --git a/modules/string-desc-quotearg-tests b/modules/string-desc-quotearg-tests index 04115df8ec..db505014ba 100644 --- a/modules/string-desc-quotearg-tests +++ b/modules/string-desc-quotearg-tests @@ -3,6 +3,7 @@ tests/test-string-desc-quotearg.c tests/macros.h Depends-on: +memeq configure.ac: diff --git a/modules/string-desc-tests b/modules/string-desc-tests index 226378c65f..ac97d81c2c 100644 --- a/modules/string-desc-tests +++ b/modules/string-desc-tests @@ -6,6 +6,7 @@ tests/macros.h Depends-on: close test-framework-sh +memeq configure.ac: diff --git a/modules/supersede-tests b/modules/supersede-tests index d4b0566b0d..7941c9c1ba 100644 --- a/modules/supersede-tests +++ b/modules/supersede-tests @@ -13,6 +13,7 @@ read-file unlink rmdir symlink +memeq configure.ac: diff --git a/modules/system-quote-tests b/modules/system-quote-tests index 6649889beb..95793726d9 100644 --- a/modules/system-quote-tests +++ b/modules/system-quote-tests @@ -12,6 +12,7 @@ bool unistd-h popen pclose +memeq configure.ac: diff --git a/modules/szprintf-posix-tests b/modules/szprintf-posix-tests index 748955fe41..be3273b75d 100644 --- a/modules/szprintf-posix-tests +++ b/modules/szprintf-posix-tests @@ -7,6 +7,7 @@ tests/macros.h Depends-on: nan streq +memeq configure.ac: diff --git a/modules/ttyname_r-tests b/modules/ttyname_r-tests index 26f209749b..9ed0304686 100644 --- a/modules/ttyname_r-tests +++ b/modules/ttyname_r-tests @@ -4,6 +4,7 @@ tests/signature.h tests/macros.h Depends-on: +memeq configure.ac: diff --git a/modules/uniconv/u16-conv-to-enc-tests b/modules/uniconv/u16-conv-to-enc-tests index 6fe964b710..4237aeaca8 100644 --- a/modules/uniconv/u16-conv-to-enc-tests +++ b/modules/uniconv/u16-conv-to-enc-tests @@ -3,6 +3,7 @@ tests/uniconv/test-u16-conv-to-enc.c tests/macros.h Depends-on: +memeq configure.ac: diff --git a/modules/uniconv/u32-conv-to-enc-tests b/modules/uniconv/u32-conv-to-enc-tests index c318d4fb7b..e8ea194229 100644 --- a/modules/uniconv/u32-conv-to-enc-tests +++ b/modules/uniconv/u32-conv-to-enc-tests @@ -3,6 +3,7 @@ tests/uniconv/test-u32-conv-to-enc.c tests/macros.h Depends-on: +memeq configure.ac: diff --git a/modules/uniconv/u8-conv-to-enc-tests b/modules/uniconv/u8-conv-to-enc-tests index e5d3434b43..007c79860b 100644 --- a/modules/uniconv/u8-conv-to-enc-tests +++ b/modules/uniconv/u8-conv-to-enc-tests @@ -4,6 +4,7 @@ tests/macros.h Depends-on: unistr/u8-strlen +memeq configure.ac: diff --git a/modules/unistdio/ulc-asnprintf-tests b/modules/unistdio/ulc-asnprintf-tests index e219cf97ce..e55f60d9f4 100644 --- a/modules/unistdio/ulc-asnprintf-tests +++ b/modules/unistdio/ulc-asnprintf-tests @@ -7,6 +7,7 @@ tests/macros.h Depends-on: unistdio/ulc-asnprintf-extra-tests streq +memeq configure.ac: diff --git a/modules/unistdio/ulc-vasnprintf-tests b/modules/unistdio/ulc-vasnprintf-tests index 8b1c46cd3b..d3c686ee3e 100644 --- a/modules/unistdio/ulc-vasnprintf-tests +++ b/modules/unistdio/ulc-vasnprintf-tests @@ -13,6 +13,7 @@ m4/codeset.m4 Depends-on: setlocale streq +memeq configure.ac: gt_LOCALE_FR diff --git a/modules/unistr/u16-chr-tests b/modules/unistr/u16-chr-tests index f2dcc14810..f1938ab79b 100644 --- a/modules/unistr/u16-chr-tests +++ b/modules/unistr/u16-chr-tests @@ -11,6 +11,7 @@ extensions unistr/u16-set unistr/u32-set unistr/u32-to-u16 +memeq configure.ac: gl_FUNC_MMAP_ANON diff --git a/modules/unistr/u16-strchr-tests b/modules/unistr/u16-strchr-tests index 05417ee5ad..16fd233d53 100644 --- a/modules/unistr/u16-strchr-tests +++ b/modules/unistr/u16-strchr-tests @@ -10,6 +10,7 @@ extensions unistr/u16-set unistr/u32-set unistr/u32-to-u16 +memeq configure.ac: gl_FUNC_MMAP_ANON diff --git a/modules/unistr/u32-chr-tests b/modules/unistr/u32-chr-tests index 191c9786da..4823ff0397 100644 --- a/modules/unistr/u32-chr-tests +++ b/modules/unistr/u32-chr-tests @@ -9,6 +9,7 @@ Depends-on: c99 extensions unistr/u32-set +memeq configure.ac: gl_FUNC_MMAP_ANON diff --git a/modules/unistr/u32-strchr-tests b/modules/unistr/u32-strchr-tests index 3408c834c9..6256d9217c 100644 --- a/modules/unistr/u32-strchr-tests +++ b/modules/unistr/u32-strchr-tests @@ -8,6 +8,7 @@ m4/mmap-anon.m4 Depends-on: extensions unistr/u32-set +memeq configure.ac: gl_FUNC_MMAP_ANON diff --git a/modules/unistr/u8-chr-tests b/modules/unistr/u8-chr-tests index c60904ce60..aaa1380084 100644 --- a/modules/unistr/u8-chr-tests +++ b/modules/unistr/u8-chr-tests @@ -11,6 +11,7 @@ extensions unistr/u8-set unistr/u32-set unistr/u32-to-u8 +memeq configure.ac: gl_FUNC_MMAP_ANON diff --git a/modules/unistr/u8-strchr-tests b/modules/unistr/u8-strchr-tests index 5043faf7ab..df7654b8c6 100644 --- a/modules/unistr/u8-strchr-tests +++ b/modules/unistr/u8-strchr-tests @@ -10,6 +10,7 @@ extensions unistr/u8-set unistr/u32-set unistr/u32-to-u8 +memeq configure.ac: gl_FUNC_MMAP_ANON diff --git a/modules/vasnprintf-posix-tests b/modules/vasnprintf-posix-tests index 44e5b64ca3..822adf7389 100644 --- a/modules/vasnprintf-posix-tests +++ b/modules/vasnprintf-posix-tests @@ -18,6 +18,7 @@ snan setlocale localeconv streq +memeq configure.ac: AC_REQUIRE([gl_LONG_DOUBLE_VS_DOUBLE]) diff --git a/modules/vasnprintf-tests b/modules/vasnprintf-tests index ff262c6d33..812b6ad5f2 100644 --- a/modules/vasnprintf-tests +++ b/modules/vasnprintf-tests @@ -5,6 +5,7 @@ tests/macros.h Depends-on: vasnprintf-extra-tests streq +memeq configure.ac: diff --git a/modules/vasprintf-posix-tests b/modules/vasprintf-posix-tests index 84bf607d4d..d30b81e96a 100644 --- a/modules/vasprintf-posix-tests +++ b/modules/vasprintf-posix-tests @@ -11,6 +11,7 @@ float-h nan snan streq +memeq configure.ac: AC_REQUIRE([gl_LONG_DOUBLE_VS_DOUBLE]) diff --git a/modules/vaszprintf-posix-tests b/modules/vaszprintf-posix-tests index 13fcfb658f..7995ea776e 100644 --- a/modules/vaszprintf-posix-tests +++ b/modules/vaszprintf-posix-tests @@ -6,6 +6,7 @@ tests/macros.h Depends-on: nan streq +memeq configure.ac: diff --git a/modules/vsnprintf-posix-tests b/modules/vsnprintf-posix-tests index 177cd1574d..ad689f1ffc 100644 --- a/modules/vsnprintf-posix-tests +++ b/modules/vsnprintf-posix-tests @@ -14,6 +14,7 @@ float-h nan snan streq +memeq configure.ac: AC_REQUIRE([gl_LONG_DOUBLE_VS_DOUBLE]) diff --git a/modules/vsnprintf-tests b/modules/vsnprintf-tests index 984ea22d04..50f4347da7 100644 --- a/modules/vsnprintf-tests +++ b/modules/vsnprintf-tests @@ -5,6 +5,7 @@ tests/macros.h Depends-on: streq +memeq configure.ac: diff --git a/modules/vsnzprintf-posix-tests b/modules/vsnzprintf-posix-tests index 3c447c05d9..e9c27093d8 100644 --- a/modules/vsnzprintf-posix-tests +++ b/modules/vsnzprintf-posix-tests @@ -7,6 +7,7 @@ tests/macros.h Depends-on: nan streq +memeq configure.ac: diff --git a/modules/vsprintf-posix-tests b/modules/vsprintf-posix-tests index 5185645ad2..c23d1b471e 100644 --- a/modules/vsprintf-posix-tests +++ b/modules/vsprintf-posix-tests @@ -13,6 +13,7 @@ float-h nan snan streq +memeq configure.ac: AC_REQUIRE([gl_LONG_DOUBLE_VS_DOUBLE]) diff --git a/modules/vszprintf-posix-tests b/modules/vszprintf-posix-tests index 7a6603c041..56a1d9d695 100644 --- a/modules/vszprintf-posix-tests +++ b/modules/vszprintf-posix-tests @@ -7,6 +7,7 @@ tests/macros.h Depends-on: nan streq +memeq configure.ac: diff --git a/modules/wcrtomb-tests b/modules/wcrtomb-tests index b1e0eaf910..3d40520d0b 100644 --- a/modules/wcrtomb-tests +++ b/modules/wcrtomb-tests @@ -22,6 +22,7 @@ btowc setlocale localcharset streq +memeq configure.ac: gt_LOCALE_EN_UTF8 diff --git a/modules/wcsnrtombs-tests b/modules/wcsnrtombs-tests index 9b8d9ff0be..5a0987b5ae 100644 --- a/modules/wcsnrtombs-tests +++ b/modules/wcsnrtombs-tests @@ -14,6 +14,7 @@ m4/codeset.m4 Depends-on: setlocale +memeq configure.ac: gt_LOCALE_EN_UTF8 diff --git a/modules/wcsrtombs-tests b/modules/wcsrtombs-tests index 514138efbb..dd0a6a6d09 100644 --- a/modules/wcsrtombs-tests +++ b/modules/wcsrtombs-tests @@ -14,6 +14,7 @@ m4/codeset.m4 Depends-on: setlocale +memeq configure.ac: gt_LOCALE_EN_UTF8 diff --git a/modules/wcstok-tests b/modules/wcstok-tests index 57ccd08724..78cb8c59b6 100644 --- a/modules/wcstok-tests +++ b/modules/wcstok-tests @@ -4,6 +4,7 @@ tests/signature.h tests/macros.h Depends-on: +memeq configure.ac: diff --git a/modules/write-tests b/modules/write-tests index 4f1036e79d..1813bd1570 100644 --- a/modules/write-tests +++ b/modules/write-tests @@ -6,6 +6,7 @@ tests/macros.h Depends-on: binary-io open +memeq configure.ac: diff --git a/modules/xmemdup0-tests b/modules/xmemdup0-tests index 24e2fe9f83..c64751b383 100644 --- a/modules/xmemdup0-tests +++ b/modules/xmemdup0-tests @@ -4,6 +4,7 @@ tests/macros.h Depends-on: streq +memeq configure.ac: diff --git a/modules/xstring-desc-tests b/modules/xstring-desc-tests index 7113d54d96..5aeb617d9f 100644 --- a/modules/xstring-desc-tests +++ b/modules/xstring-desc-tests @@ -3,6 +3,7 @@ tests/test-xstring-desc.c tests/macros.h Depends-on: +memeq configure.ac: diff --git a/tests/test-base32.c b/tests/test-base32.c index c9f2639d95..484623ba63 100644 --- a/tests/test-base32.c +++ b/tests/test-base32.c @@ -43,47 +43,47 @@ main (void) memset (out, 0x42, sizeof (out)); base32_encode (in, 1, out, 10); - ASSERT (memcmp (out, "ME======", 1) == 0); + ASSERT (memeq (out, "ME======", 1)); memset (out, 0x42, sizeof (out)); base32_encode (in, 1, out, 2); - ASSERT (memcmp (out, "ME======", 2) == 0); + ASSERT (memeq (out, "ME======", 2)); memset (out, 0x42, sizeof (out)); base32_encode (in, 1, out, 3); - ASSERT (memcmp (out, "ME======", 3) == 0); + ASSERT (memeq (out, "ME======", 3)); memset (out, 0x42, sizeof (out)); base32_encode (in, 1, out, 4); - ASSERT (memcmp (out, "ME======", 4) == 0); + ASSERT (memeq (out, "ME======", 4)); memset (out, 0x42, sizeof (out)); base32_encode (in, 1, out, 8); - ASSERT (memcmp (out, "ME======", 8) == 0); + ASSERT (memeq (out, "ME======", 8)); memset (out, 0x42, sizeof (out)); base32_encode (in, 2, out, 8); - ASSERT (memcmp (out, "MFRA====", 8) == 0); + ASSERT (memeq (out, "MFRA====", 8)); memset (out, 0x42, sizeof (out)); base32_encode (in, 3, out, 8); - ASSERT (memcmp (out, "MFRGG===", 8) == 0); + ASSERT (memeq (out, "MFRGG===", 8)); memset (out, 0x42, sizeof (out)); base32_encode (in, 4, out, 8); - ASSERT (memcmp (out, "MFRGGZA=", 8) == 0); + ASSERT (memeq (out, "MFRGGZA=", 8)); memset (out, 0x42, sizeof (out)); base32_encode (in, 5, out, 8); - ASSERT (memcmp (out, "MFRGGZDF", 8) == 0); + ASSERT (memeq (out, "MFRGGZDF", 8)); memset (out, 0x42, sizeof (out)); base32_encode (in, 6, out, 16); - ASSERT (memcmp (out, "MFRGGZDFMY======", 16) == 0); + ASSERT (memeq (out, "MFRGGZDFMY======", 16)); memset (out, 0x42, sizeof (out)); base32_encode (in, 6, out, 100); - ASSERT (memcmp (out, "MFRGGZDFMY======", 16) == 0); + ASSERT (memeq (out, "MFRGGZDFMY======", 16)); /* Decode. */ @@ -98,49 +98,49 @@ main (void) ok = base32_decode (b32in, 8, out, &len); ASSERT (ok); ASSERT (len == 1); - ASSERT (memcmp (out, "abcdefghijklmnop", 1) == 0); + ASSERT (memeq (out, "abcdefghijklmnop", 1)); memset (out, 0x42, sizeof (out)); len = 2; ok = base32_decode (b32in, 8, out, &len); ASSERT (ok); ASSERT (len == 2); - ASSERT (memcmp (out, "abcdefghijklmnop", 2) == 0); + ASSERT (memeq (out, "abcdefghijklmnop", 2)); memset (out, 0x42, sizeof (out)); len = 3; ok = base32_decode (b32in, 8, out, &len); ASSERT (ok); ASSERT (len == 3); - ASSERT (memcmp (out, "abcdefghijklmnop", 3) == 0); + ASSERT (memeq (out, "abcdefghijklmnop", 3)); memset (out, 0x42, sizeof (out)); len = 4; ok = base32_decode (b32in, 8, out, &len); ASSERT (ok); ASSERT (len == 4); - ASSERT (memcmp (out, "abcdefghijklmnop", 4) == 0); + ASSERT (memeq (out, "abcdefghijklmnop", 4)); memset (out, 0x42, sizeof (out)); len = 5; ok = base32_decode (b32in, 8, out, &len); ASSERT (ok); ASSERT (len == 5); - ASSERT (memcmp (out, "abcdefghijklmnop", 5) == 0); + ASSERT (memeq (out, "abcdefghijklmnop", 5)); memset (out, 0x42, sizeof (out)); len = 6; ok = base32_decode (b32in, 8, out, &len); ASSERT (ok); ASSERT (len == 5); - ASSERT (memcmp (out, "abcdefghijklmnop", 5) == 0); + ASSERT (memeq (out, "abcdefghijklmnop", 5)); memset (out, 0x42, sizeof (out)); len = 100; ok = base32_decode (b32in, strlen (b32in), out, &len); ASSERT (ok); ASSERT (len == 16); - ASSERT (memcmp (out, "abcdefghijklmnop", 16) == 0); + ASSERT (memeq (out, "abcdefghijklmnop", 16)); /* Allocating encode */ @@ -162,7 +162,7 @@ main (void) ok = base32_decode_ctx (&ctx, b32in, strlen (b32in), out, &len); ASSERT (ok); ASSERT (len == 16); - ASSERT (memcmp (out, "abcdefghijklmnop", len) == 0); + ASSERT (memeq (out, "abcdefghijklmnop", len)); } /* Allocating decode context function */ @@ -170,7 +170,7 @@ main (void) ok = base32_decode_alloc_ctx (NULL, b32in, strlen (b32in), &p, &len); ASSERT (ok); ASSERT (len == 16); - ASSERT (memcmp (out, "abcdefghijklmnop", len) == 0); + ASSERT (memeq (out, "abcdefghijklmnop", len)); free (p); { @@ -182,7 +182,7 @@ main (void) ok = base32_decode_alloc_ctx (&ctx, newlineb32, strlen (newlineb32), &p, &len); ASSERT (ok); ASSERT (len == strlen (in)); - ASSERT (memcmp (p, in, len) == 0); + ASSERT (memeq (p, in, len)); free (p); } @@ -193,7 +193,7 @@ main (void) ok = base32_decode_alloc_ctx (&ctx, "MFRGGZDFM\nZTWQ2LK", 17, &p, &len); ASSERT (ok); ASSERT (len == 10); - ASSERT (memcmp (p, "abcdefghij", len) == 0); + ASSERT (memeq (p, "abcdefghij", len)); free (p); base32_decode_ctx_init (&ctx); @@ -206,13 +206,13 @@ main (void) ok = base32_decode_alloc_ctx (&ctx, "RGGZDFMZ", 8, &p, &len); ASSERT (ok); ASSERT (len == 5); - ASSERT (memcmp (p, "abcde", len) == 0); + ASSERT (memeq (p, "abcde", len)); free (p); ok = base32_decode_alloc_ctx (&ctx, "TWQ2LK", 6, &p, &len); ASSERT (ok); ASSERT (len == 5); - ASSERT (memcmp (p, "fghij", len) == 0); + ASSERT (memeq (p, "fghij", len)); free (p); ok = base32_decode_alloc_ctx (&ctx, "", 0, &p, &len); diff --git a/tests/test-base64.c b/tests/test-base64.c index 3e7fb38af3..6112529d7b 100644 --- a/tests/test-base64.c +++ b/tests/test-base64.c @@ -42,39 +42,39 @@ main (void) memset (out, 0x42, sizeof (out)); base64_encode (in, 1, out, 1); - ASSERT (memcmp (out, "YQ==", 1) == 0); + ASSERT (memeq (out, "YQ==", 1)); memset (out, 0x42, sizeof (out)); base64_encode (in, 1, out, 2); - ASSERT (memcmp (out, "YQ==", 2) == 0); + ASSERT (memeq (out, "YQ==", 2)); memset (out, 0x42, sizeof (out)); base64_encode (in, 1, out, 3); - ASSERT (memcmp (out, "YQ==", 3) == 0); + ASSERT (memeq (out, "YQ==", 3)); memset (out, 0x42, sizeof (out)); base64_encode (in, 1, out, 4); - ASSERT (memcmp (out, "YQ==", 4) == 0); + ASSERT (memeq (out, "YQ==", 4)); memset (out, 0x42, sizeof (out)); base64_encode (in, 1, out, 8); - ASSERT (memcmp (out, "YQ==", 4) == 0); + ASSERT (memeq (out, "YQ==", 4)); memset (out, 0x42, sizeof (out)); base64_encode (in, 2, out, 4); - ASSERT (memcmp (out, "YWI=", 4) == 0); + ASSERT (memeq (out, "YWI=", 4)); memset (out, 0x42, sizeof (out)); base64_encode (in, 3, out, 4); - ASSERT (memcmp (out, "YWJj", 4) == 0); + ASSERT (memeq (out, "YWJj", 4)); memset (out, 0x42, sizeof (out)); base64_encode (in, 4, out, 5); - ASSERT (memcmp (out, "YWJjZA==", 5) == 0); + ASSERT (memeq (out, "YWJjZA==", 5)); memset (out, 0x42, sizeof (out)); base64_encode (in, 4, out, 100); - ASSERT (memcmp (out, "YWJjZA==", 6) == 0); + ASSERT (memeq (out, "YWJjZA==", 6)); /* Decode. */ @@ -89,35 +89,35 @@ main (void) ok = base64_decode (b64in, 4, out, &len); ASSERT (ok); ASSERT (len == 1); - ASSERT (memcmp (out, "abcdefg", 1) == 0); + ASSERT (memeq (out, "abcdefg", 1)); memset (out, 0x42, sizeof (out)); len = 2; ok = base64_decode (b64in, 4, out, &len); ASSERT (ok); ASSERT (len == 2); - ASSERT (memcmp (out, "abcdefg", 2) == 0); + ASSERT (memeq (out, "abcdefg", 2)); memset (out, 0x42, sizeof (out)); len = 3; ok = base64_decode (b64in, 4, out, &len); ASSERT (ok); ASSERT (len == 3); - ASSERT (memcmp (out, "abcdefg", 3) == 0); + ASSERT (memeq (out, "abcdefg", 3)); memset (out, 0x42, sizeof (out)); len = 4; ok = base64_decode (b64in, 4, out, &len); ASSERT (ok); ASSERT (len == 3); - ASSERT (memcmp (out, "abcdefg", 3) == 0); + ASSERT (memeq (out, "abcdefg", 3)); memset (out, 0x42, sizeof (out)); len = 100; ok = base64_decode (b64in, strlen (b64in), out, &len); ASSERT (ok); ASSERT (len == 7); - ASSERT (memcmp (out, "abcdefg", 7) == 0); + ASSERT (memeq (out, "abcdefg", 7)); /* Allocating encode */ @@ -139,7 +139,7 @@ main (void) ok = base64_decode_ctx (&ctx, b64in, strlen (b64in), out, &len); ASSERT (ok); ASSERT (len == 7); - ASSERT (memcmp (out, "abcdefg", len) == 0); + ASSERT (memeq (out, "abcdefg", len)); } /* Allocating decode context function */ @@ -147,7 +147,7 @@ main (void) ok = base64_decode_alloc_ctx (NULL, b64in, strlen (b64in), &p, &len); ASSERT (ok); ASSERT (len == 7); - ASSERT (memcmp (out, "abcdefg", len) == 0); + ASSERT (memeq (out, "abcdefg", len)); free (p); { @@ -159,7 +159,7 @@ main (void) ok = base64_decode_alloc_ctx (&ctx, newlineb64, strlen (newlineb64), &p, &len); ASSERT (ok); ASSERT (len == strlen (in)); - ASSERT (memcmp (p, in, len) == 0); + ASSERT (memeq (p, in, len)); free (p); } @@ -170,7 +170,7 @@ main (void) ok = base64_decode_alloc_ctx (&ctx, "YW\nJjZGVmZ2hp", 13, &p, &len); ASSERT (ok); ASSERT (len == 9); - ASSERT (memcmp (p, "abcdefghi", len) == 0); + ASSERT (memeq (p, "abcdefghi", len)); free (p); base64_decode_ctx_init (&ctx); @@ -183,13 +183,13 @@ main (void) ok = base64_decode_alloc_ctx (&ctx, "JjZGVmZ2", 8, &p, &len); ASSERT (ok); ASSERT (len == 6); - ASSERT (memcmp (p, "abcdef", len) == 0); + ASSERT (memeq (p, "abcdef", len)); free (p); ok = base64_decode_alloc_ctx (&ctx, "hp", 2, &p, &len); ASSERT (ok); ASSERT (len == 3); - ASSERT (memcmp (p, "ghi", len) == 0); + ASSERT (memeq (p, "ghi", len)); free (p); ok = base64_decode_alloc_ctx (&ctx, "", 0, &p, &len); diff --git a/tests/test-c32rtomb-w32.c b/tests/test-c32rtomb-w32.c index ba7964659a..e2bfda518c 100644 --- a/tests/test-c32rtomb-w32.c +++ b/tests/test-c32rtomb-w32.c @@ -145,13 +145,13 @@ test_one_locale (const char *name, int codepage) memset (buf, 'x', 8); ret = c32rtomb (buf, 0x00FC, NULL); ASSERT (ret == 1); - ASSERT (memcmp (buf, "\374", 1) == 0); + ASSERT (memeq (buf, "\374", 1)); ASSERT (buf[1] == 'x'); memset (buf, 'x', 8); ret = c32rtomb (buf, 0x00DF, NULL); ASSERT (ret == 1); - ASSERT (memcmp (buf, "\337", 1) == 0); + ASSERT (memeq (buf, "\337", 1)); ASSERT (buf[1] == 'x'); } return 0; @@ -163,19 +163,19 @@ test_one_locale (const char *name, int codepage) memset (buf, 'x', 8); ret = c32rtomb (buf, 0x0622, NULL); ASSERT (ret == 1); - ASSERT (memcmp (buf, "\302", 1) == 0); + ASSERT (memeq (buf, "\302", 1)); ASSERT (buf[1] == 'x'); memset (buf, 'x', 8); ret = c32rtomb (buf, 0x0644, NULL); ASSERT (ret == 1); - ASSERT (memcmp (buf, "\341", 1) == 0); + ASSERT (memeq (buf, "\341", 1)); ASSERT (buf[1] == 'x'); memset (buf, 'x', 8); ret = c32rtomb (buf, 0x0648, NULL); ASSERT (ret == 1); - ASSERT (memcmp (buf, "\346", 1) == 0); + ASSERT (memeq (buf, "\346", 1)); ASSERT (buf[1] == 'x'); } return 0; @@ -189,19 +189,19 @@ test_one_locale (const char *name, int codepage) memset (buf, 'x', 8); ret = c32rtomb (buf, 0x00FC, NULL); ASSERT (ret == 2); - ASSERT (memcmp (buf, "\303\274", 2) == 0); + ASSERT (memeq (buf, "\303\274", 2)); ASSERT (buf[2] == 'x'); memset (buf, 'x', 8); ret = c32rtomb (buf, 0x00DF, NULL); ASSERT (ret == 2); - ASSERT (memcmp (buf, "\303\237", 2) == 0); + ASSERT (memeq (buf, "\303\237", 2)); ASSERT (buf[2] == 'x'); memset (buf, 'x', 8); ret = c32rtomb (buf, 0x1F60B, NULL); ASSERT (ret == 4); - ASSERT (memcmp (buf, "\360\237\230\213", 4) == 0); + ASSERT (memeq (buf, "\360\237\230\213", 4)); ASSERT (buf[4] == 'x'); } return 0; @@ -213,19 +213,19 @@ test_one_locale (const char *name, int codepage) memset (buf, 'x', 8); ret = c32rtomb (buf, 0x65E5, NULL); ASSERT (ret == 2); - ASSERT (memcmp (buf, "\223\372", 2) == 0); + ASSERT (memeq (buf, "\223\372", 2)); ASSERT (buf[2] == 'x'); memset (buf, 'x', 8); ret = c32rtomb (buf, 0x672C, NULL); ASSERT (ret == 2); - ASSERT (memcmp (buf, "\226\173", 2) == 0); + ASSERT (memeq (buf, "\226\173", 2)); ASSERT (buf[2] == 'x'); memset (buf, 'x', 8); ret = c32rtomb (buf, 0x8A9E, NULL); ASSERT (ret == 2); - ASSERT (memcmp (buf, "\214\352", 2) == 0); + ASSERT (memeq (buf, "\214\352", 2)); ASSERT (buf[2] == 'x'); } return 0; @@ -237,19 +237,19 @@ test_one_locale (const char *name, int codepage) memset (buf, 'x', 8); ret = c32rtomb (buf, 0x65E5, NULL); ASSERT (ret == 2); - ASSERT (memcmp (buf, "\244\351", 2) == 0); + ASSERT (memeq (buf, "\244\351", 2)); ASSERT (buf[2] == 'x'); memset (buf, 'x', 8); ret = c32rtomb (buf, 0x672C, NULL); ASSERT (ret == 2); - ASSERT (memcmp (buf, "\245\273", 2) == 0); + ASSERT (memeq (buf, "\245\273", 2)); ASSERT (buf[2] == 'x'); memset (buf, 'x', 8); ret = c32rtomb (buf, 0x8A9E, NULL); ASSERT (ret == 2); - ASSERT (memcmp (buf, "\273\171", 2) == 0); + ASSERT (memeq (buf, "\273\171", 2)); ASSERT (buf[2] == 'x'); } return 0; @@ -261,19 +261,19 @@ test_one_locale (const char *name, int codepage) memset (buf, 'x', 8); ret = c32rtomb (buf, 0x65E5, NULL); ASSERT (ret == 2); - ASSERT (memcmp (buf, "\310\325", 2) == 0); + ASSERT (memeq (buf, "\310\325", 2)); ASSERT (buf[2] == 'x'); memset (buf, 'x', 8); ret = c32rtomb (buf, 0x672C, NULL); ASSERT (ret == 2); - ASSERT (memcmp (buf, "\261\276", 2) == 0); + ASSERT (memeq (buf, "\261\276", 2)); ASSERT (buf[2] == 'x'); memset (buf, 'x', 8); ret = c32rtomb (buf, 0x8A9E, NULL); ASSERT (ret == 2); - ASSERT (memcmp (buf, "\325\132", 2) == 0); + ASSERT (memeq (buf, "\325\132", 2)); ASSERT (buf[2] == 'x'); } return 0; @@ -287,19 +287,19 @@ test_one_locale (const char *name, int codepage) memset (buf, 'x', 8); ret = c32rtomb (buf, 0x00FC, NULL); ASSERT (ret == 2); - ASSERT (memcmp (buf, "\250\271", 2) == 0); + ASSERT (memeq (buf, "\250\271", 2)); ASSERT (buf[2] == 'x'); memset (buf, 'x', 8); ret = c32rtomb (buf, 0x00DF, NULL); ASSERT (ret == 4); - ASSERT (memcmp (buf, "\201\060\211\070", 4) == 0); + ASSERT (memeq (buf, "\201\060\211\070", 4)); ASSERT (buf[4] == 'x'); memset (buf, 'x', 8); ret = c32rtomb (buf, 0x1F60B, NULL); ASSERT (ret == 4); - ASSERT (memcmp (buf, "\224\071\375\067", 4) == 0); + ASSERT (memeq (buf, "\224\071\375\067", 4)); ASSERT (buf[4] == 'x'); } return 0; diff --git a/tests/test-c32rtomb.c b/tests/test-c32rtomb.c index 8e5cdff263..9f3c690fe1 100644 --- a/tests/test-c32rtomb.c +++ b/tests/test-c32rtomb.c @@ -46,7 +46,7 @@ check_character (const char *s, size_t n) ret = c32rtomb (buf, wc, NULL); ASSERT (ret == n); - ASSERT (memcmp (buf, s, n) == 0); + ASSERT (memeq (buf, s, n)); /* Test special calling convention, passing a NULL pointer. */ ret = c32rtomb (NULL, wc, NULL); diff --git a/tests/test-c32snrtombs.c b/tests/test-c32snrtombs.c index e053790644..7ca92903d9 100644 --- a/tests/test-c32snrtombs.c +++ b/tests/test-c32snrtombs.c @@ -69,7 +69,7 @@ main (int argc, char *argv[]) ret = c32snrtombs (buf, &src, 6, n, NULL); ASSERT (ret == (n <= 5 ? n : 5)); ASSERT (src == (n <= 5 ? input + n : NULL)); - ASSERT (memcmp (buf, original, ret) == 0); + ASSERT (memeq (buf, original, ret)); if (src == NULL) ASSERT (buf[ret] == '\0'); ASSERT (buf[ret + (src == NULL) + 0] == '_'); @@ -106,7 +106,7 @@ main (int argc, char *argv[]) n < 5 ? input + 2 : n < 9 ? input + 3 : n <= 10 ? input + (n - 5) : NULL)); - ASSERT (memcmp (buf, original, ret) == 0); + ASSERT (memeq (buf, original, ret)); if (src == NULL) ASSERT (buf[ret] == '\0'); ASSERT (buf[ret + (src == NULL) + 0] == '_'); @@ -143,7 +143,7 @@ main (int argc, char *argv[]) n < 5 ? input + 2 : n < 7 ? input + 3 : n <= 8 ? input + (n - 3) : NULL)); - ASSERT (memcmp (buf, original, ret) == 0); + ASSERT (memeq (buf, original, ret)); if (src == NULL) ASSERT (buf[ret] == '\0'); ASSERT (buf[ret + (src == NULL) + 0] == '_'); @@ -187,7 +187,7 @@ main (int argc, char *argv[]) n < 7 ? input + 2 : n < 11 ? input + 3 : n <= 12 ? input + (n - 7) : NULL)); - ASSERT (memcmp (buf, original, ret) == 0); + ASSERT (memeq (buf, original, ret)); if (src == NULL) ASSERT (buf[ret] == '\0'); ASSERT (buf[ret + (src == NULL) + 0] == '_'); diff --git a/tests/test-c32srtombs.c b/tests/test-c32srtombs.c index a59d41cab5..ae7a8b4652 100644 --- a/tests/test-c32srtombs.c +++ b/tests/test-c32srtombs.c @@ -69,7 +69,7 @@ main (int argc, char *argv[]) ret = c32srtombs (buf, &src, n, NULL); ASSERT (ret == (n <= 5 ? n : 5)); ASSERT (src == (n <= 5 ? input + n : NULL)); - ASSERT (memcmp (buf, original, ret) == 0); + ASSERT (memeq (buf, original, ret)); if (src == NULL) ASSERT (buf[ret] == '\0'); ASSERT (buf[ret + (src == NULL) + 0] == '_'); @@ -106,7 +106,7 @@ main (int argc, char *argv[]) n < 5 ? input + 2 : n < 9 ? input + 3 : n <= 10 ? input + (n - 5) : NULL)); - ASSERT (memcmp (buf, original, ret) == 0); + ASSERT (memeq (buf, original, ret)); if (src == NULL) ASSERT (buf[ret] == '\0'); ASSERT (buf[ret + (src == NULL) + 0] == '_'); @@ -143,7 +143,7 @@ main (int argc, char *argv[]) n < 5 ? input + 2 : n < 7 ? input + 3 : n <= 8 ? input + (n - 3) : NULL)); - ASSERT (memcmp (buf, original, ret) == 0); + ASSERT (memeq (buf, original, ret)); if (src == NULL) ASSERT (buf[ret] == '\0'); ASSERT (buf[ret + (src == NULL) + 0] == '_'); @@ -187,7 +187,7 @@ main (int argc, char *argv[]) n < 7 ? input + 2 : n < 11 ? input + 3 : n <= 12 ? input + (n - 7) : NULL)); - ASSERT (memcmp (buf, original, ret) == 0); + ASSERT (memeq (buf, original, ret)); if (src == NULL) ASSERT (buf[ret] == '\0'); ASSERT (buf[ret + (src == NULL) + 0] == '_'); diff --git a/tests/test-c32stombs.c b/tests/test-c32stombs.c index 03c1423ac6..8d17b566cd 100644 --- a/tests/test-c32stombs.c +++ b/tests/test-c32stombs.c @@ -64,7 +64,7 @@ main (int argc, char *argv[]) ret = c32stombs (buf, input, n); ASSERT (ret == (n <= 5 ? n : 5)); - ASSERT (memcmp (buf, original, ret) == 0); + ASSERT (memeq (buf, original, ret)); if (n > 5) ASSERT (buf[ret] == '\0'); ASSERT (buf[ret + (n > 5) + 0] == '_'); @@ -93,7 +93,7 @@ main (int argc, char *argv[]) n < 5 ? 3 : n < 9 ? 5 : n <= 10 ? n : 10)); - ASSERT (memcmp (buf, original, ret) == 0); + ASSERT (memeq (buf, original, ret)); if (n > 10) ASSERT (buf[ret] == '\0'); ASSERT (buf[ret + (n > 10) + 0] == '_'); @@ -122,7 +122,7 @@ main (int argc, char *argv[]) n < 5 ? 3 : n < 7 ? 5 : n <= 8 ? n : 8)); - ASSERT (memcmp (buf, original, ret) == 0); + ASSERT (memeq (buf, original, ret)); if (n > 8) ASSERT (buf[ret] == '\0'); ASSERT (buf[ret + (n > 8) + 0] == '_'); @@ -158,7 +158,7 @@ main (int argc, char *argv[]) n < 7 ? 3 : n < 11 ? 7 : n <= 12 ? n : 12)); - ASSERT (memcmp (buf, original, ret) == 0); + ASSERT (memeq (buf, original, ret)); if (n > 12) ASSERT (buf[ret] == '\0'); ASSERT (buf[ret + (n > 12) + 0] == '_'); diff --git a/tests/test-c32tolower.c b/tests/test-c32tolower.c index 8198a3c577..62ac907121 100644 --- a/tests/test-c32tolower.c +++ b/tests/test-c32tolower.c @@ -158,27 +158,27 @@ main (int argc, char *argv[]) /* U+00B2 SUPERSCRIPT TWO */ mb = for_character ("\262", 1); ASSERT (mb.nbytes == 1); - ASSERT (memcmp (mb.buf, "\262", 1) == 0); + ASSERT (memeq (mb.buf, "\262", 1)); /* U+00B5 MICRO SIGN */ mb = for_character ("\265", 1); ASSERT (mb.nbytes == 1); - ASSERT (memcmp (mb.buf, "\265", 1) == 0); + ASSERT (memeq (mb.buf, "\265", 1)); /* U+00C9 LATIN CAPITAL LETTER E WITH ACUTE */ mb = for_character ("\311", 1); ASSERT (mb.nbytes == 1); - ASSERT (memcmp (mb.buf, "\351", 1) == 0); + ASSERT (memeq (mb.buf, "\351", 1)); /* U+00DF LATIN SMALL LETTER SHARP S */ mb = for_character ("\337", 1); ASSERT (mb.nbytes == 1); - ASSERT (memcmp (mb.buf, "\337", 1) == 0); + ASSERT (memeq (mb.buf, "\337", 1)); /* U+00E9 LATIN SMALL LETTER E WITH ACUTE */ mb = for_character ("\351", 1); ASSERT (mb.nbytes == 1); - ASSERT (memcmp (mb.buf, "\351", 1) == 0); + ASSERT (memeq (mb.buf, "\351", 1)); /* U+00FF LATIN SMALL LETTER Y WITH DIAERESIS */ mb = for_character ("\377", 1); ASSERT (mb.nbytes == 1); - ASSERT (memcmp (mb.buf, "\377", 1) == 0); + ASSERT (memeq (mb.buf, "\377", 1)); } return test_exit_status; @@ -189,54 +189,54 @@ main (int argc, char *argv[]) /* U+00C9 LATIN CAPITAL LETTER E WITH ACUTE */ mb = for_character ("\217\252\261", 3); ASSERT (mb.nbytes == 3); - ASSERT (memcmp (mb.buf, "\217\253\261", 3) == 0); + ASSERT (memeq (mb.buf, "\217\253\261", 3)); #endif /* U+00DF LATIN SMALL LETTER SHARP S */ mb = for_character ("\217\251\316", 3); ASSERT (mb.nbytes == 3); - ASSERT (memcmp (mb.buf, "\217\251\316", 3) == 0); + ASSERT (memeq (mb.buf, "\217\251\316", 3)); /* U+00E9 LATIN SMALL LETTER E WITH ACUTE */ mb = for_character ("\217\253\261", 3); ASSERT (mb.nbytes == 3); - ASSERT (memcmp (mb.buf, "\217\253\261", 3) == 0); + ASSERT (memeq (mb.buf, "\217\253\261", 3)); /* U+00FF LATIN SMALL LETTER Y WITH DIAERESIS */ mb = for_character ("\217\253\363", 3); ASSERT (mb.nbytes == 3); - ASSERT (memcmp (mb.buf, "\217\253\363", 3) == 0); + ASSERT (memeq (mb.buf, "\217\253\363", 3)); #if !((defined __APPLE__ && defined __MACH__) || defined __DragonFly__) /* U+0141 LATIN CAPITAL LETTER L WITH STROKE */ mb = for_character ("\217\251\250", 3); ASSERT (mb.nbytes == 3); - ASSERT (memcmp (mb.buf, "\217\251\310", 3) == 0); + ASSERT (memeq (mb.buf, "\217\251\310", 3)); #endif /* U+0142 LATIN SMALL LETTER L WITH STROKE */ mb = for_character ("\217\251\310", 3); ASSERT (mb.nbytes == 3); - ASSERT (memcmp (mb.buf, "\217\251\310", 3) == 0); + ASSERT (memeq (mb.buf, "\217\251\310", 3)); #if !defined __DragonFly__ /* U+0429 CYRILLIC CAPITAL LETTER SHCHA */ mb = for_character ("\247\273", 2); ASSERT (mb.nbytes == 2); - ASSERT (memcmp (mb.buf, "\247\353", 2) == 0); + ASSERT (memeq (mb.buf, "\247\353", 2)); #endif /* U+0449 CYRILLIC SMALL LETTER SHCHA */ mb = for_character ("\247\353", 2); ASSERT (mb.nbytes == 2); - ASSERT (memcmp (mb.buf, "\247\353", 2) == 0); + ASSERT (memeq (mb.buf, "\247\353", 2)); /* U+3073 HIRAGANA LETTER BI */ mb = for_character ("\244\323", 2); ASSERT (mb.nbytes == 2); - ASSERT (memcmp (mb.buf, "\244\323", 2) == 0); + ASSERT (memeq (mb.buf, "\244\323", 2)); #if !defined __DragonFly__ /* U+FF27 FULLWIDTH LATIN CAPITAL LETTER G */ mb = for_character ("\243\307", 2); ASSERT (mb.nbytes == 2); - ASSERT (memcmp (mb.buf, "\243\347", 2) == 0); + ASSERT (memeq (mb.buf, "\243\347", 2)); #endif /* U+FF47 FULLWIDTH LATIN SMALL LETTER G */ mb = for_character ("\243\347", 2); ASSERT (mb.nbytes == 2); - ASSERT (memcmp (mb.buf, "\243\347", 2) == 0); + ASSERT (memeq (mb.buf, "\243\347", 2)); } return test_exit_status; @@ -246,85 +246,85 @@ main (int argc, char *argv[]) /* U+00B2 SUPERSCRIPT TWO */ mb = for_character ("\302\262", 2); ASSERT (mb.nbytes == 2); - ASSERT (memcmp (mb.buf, "\302\262", 2) == 0); + ASSERT (memeq (mb.buf, "\302\262", 2)); /* U+00B5 MICRO SIGN */ mb = for_character ("\302\265", 2); ASSERT (mb.nbytes == 2); - ASSERT (memcmp (mb.buf, "\302\265", 2) == 0); + ASSERT (memeq (mb.buf, "\302\265", 2)); /* U+00C9 LATIN CAPITAL LETTER E WITH ACUTE */ mb = for_character ("\303\211", 2); ASSERT (mb.nbytes == 2); - ASSERT (memcmp (mb.buf, "\303\251", 2) == 0); + ASSERT (memeq (mb.buf, "\303\251", 2)); /* U+00DF LATIN SMALL LETTER SHARP S */ mb = for_character ("\303\237", 2); ASSERT (mb.nbytes == 2); - ASSERT (memcmp (mb.buf, "\303\237", 2) == 0); + ASSERT (memeq (mb.buf, "\303\237", 2)); /* U+00E9 LATIN SMALL LETTER E WITH ACUTE */ mb = for_character ("\303\251", 2); ASSERT (mb.nbytes == 2); - ASSERT (memcmp (mb.buf, "\303\251", 2) == 0); + ASSERT (memeq (mb.buf, "\303\251", 2)); /* U+00FF LATIN SMALL LETTER Y WITH DIAERESIS */ mb = for_character ("\303\277", 2); ASSERT (mb.nbytes == 2); - ASSERT (memcmp (mb.buf, "\303\277", 2) == 0); + ASSERT (memeq (mb.buf, "\303\277", 2)); /* U+0141 LATIN CAPITAL LETTER L WITH STROKE */ mb = for_character ("\305\201", 2); ASSERT (mb.nbytes == 2); - ASSERT (memcmp (mb.buf, "\305\202", 2) == 0); + ASSERT (memeq (mb.buf, "\305\202", 2)); /* U+0142 LATIN SMALL LETTER L WITH STROKE */ mb = for_character ("\305\202", 2); ASSERT (mb.nbytes == 2); - ASSERT (memcmp (mb.buf, "\305\202", 2) == 0); + ASSERT (memeq (mb.buf, "\305\202", 2)); /* U+0429 CYRILLIC CAPITAL LETTER SHCHA */ mb = for_character ("\320\251", 2); ASSERT (mb.nbytes == 2); - ASSERT (memcmp (mb.buf, "\321\211", 2) == 0); + ASSERT (memeq (mb.buf, "\321\211", 2)); /* U+0449 CYRILLIC SMALL LETTER SHCHA */ mb = for_character ("\321\211", 2); ASSERT (mb.nbytes == 2); - ASSERT (memcmp (mb.buf, "\321\211", 2) == 0); + ASSERT (memeq (mb.buf, "\321\211", 2)); /* U+05D5 HEBREW LETTER VAV */ mb = for_character ("\327\225", 2); ASSERT (mb.nbytes == 2); - ASSERT (memcmp (mb.buf, "\327\225", 2) == 0); + ASSERT (memeq (mb.buf, "\327\225", 2)); /* U+3073 HIRAGANA LETTER BI */ mb = for_character ("\343\201\263", 3); ASSERT (mb.nbytes == 3); - ASSERT (memcmp (mb.buf, "\343\201\263", 3) == 0); + ASSERT (memeq (mb.buf, "\343\201\263", 3)); /* U+3162 HANGUL LETTER YI */ mb = for_character ("\343\205\242", 3); ASSERT (mb.nbytes == 3); - ASSERT (memcmp (mb.buf, "\343\205\242", 3) == 0); + ASSERT (memeq (mb.buf, "\343\205\242", 3)); /* U+FF27 FULLWIDTH LATIN CAPITAL LETTER G */ mb = for_character ("\357\274\247", 3); ASSERT (mb.nbytes == 3); - ASSERT (memcmp (mb.buf, "\357\275\207", 3) == 0); + ASSERT (memeq (mb.buf, "\357\275\207", 3)); /* U+FF47 FULLWIDTH LATIN SMALL LETTER G */ mb = for_character ("\357\275\207", 3); ASSERT (mb.nbytes == 3); - ASSERT (memcmp (mb.buf, "\357\275\207", 3) == 0); + ASSERT (memeq (mb.buf, "\357\275\207", 3)); /* U+FFDB HALFWIDTH HANGUL LETTER YI */ mb = for_character ("\357\277\233", 3); ASSERT (mb.nbytes == 3); - ASSERT (memcmp (mb.buf, "\357\277\233", 3) == 0); + ASSERT (memeq (mb.buf, "\357\277\233", 3)); #if !(defined __DragonFly__ || defined __sun) /* U+10419 DESERET CAPITAL LETTER EF */ mb = for_character ("\360\220\220\231", 4); ASSERT (mb.nbytes == 4); - ASSERT (memcmp (mb.buf, "\360\220\221\201", 4) == 0); + ASSERT (memeq (mb.buf, "\360\220\221\201", 4)); #endif /* U+10441 DESERET SMALL LETTER EF */ mb = for_character ("\360\220\221\201", 4); ASSERT (mb.nbytes == 4); - ASSERT (memcmp (mb.buf, "\360\220\221\201", 4) == 0); + ASSERT (memeq (mb.buf, "\360\220\221\201", 4)); /* U+E0041 TAG LATIN CAPITAL LETTER A */ mb = for_character ("\363\240\201\201", 4); ASSERT (mb.nbytes == 4); - ASSERT (memcmp (mb.buf, "\363\240\201\201", 4) == 0); + ASSERT (memeq (mb.buf, "\363\240\201\201", 4)); /* U+E0061 TAG LATIN SMALL LETTER A */ mb = for_character ("\363\240\201\241", 4); ASSERT (mb.nbytes == 4); - ASSERT (memcmp (mb.buf, "\363\240\201\241", 4) == 0); + ASSERT (memeq (mb.buf, "\363\240\201\241", 4)); } return test_exit_status; @@ -340,93 +340,93 @@ main (int argc, char *argv[]) /* U+00B2 SUPERSCRIPT TWO */ mb = for_character ("\201\060\205\065", 4); ASSERT (mb.nbytes == 4); - ASSERT (memcmp (mb.buf, "\201\060\205\065", 4) == 0); + ASSERT (memeq (mb.buf, "\201\060\205\065", 4)); /* U+00B5 MICRO SIGN */ mb = for_character ("\201\060\205\070", 4); ASSERT (mb.nbytes == 4); - ASSERT (memcmp (mb.buf, "\201\060\205\070", 4) == 0); + ASSERT (memeq (mb.buf, "\201\060\205\070", 4)); #if !((defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __DragonFly__ || defined __sun) /* U+00C9 LATIN CAPITAL LETTER E WITH ACUTE */ mb = for_character ("\201\060\207\067", 4); ASSERT (mb.nbytes == 2); - ASSERT (memcmp (mb.buf, "\250\246", 2) == 0); + ASSERT (memeq (mb.buf, "\250\246", 2)); #endif /* U+00DF LATIN SMALL LETTER SHARP S */ mb = for_character ("\201\060\211\070", 4); ASSERT (mb.nbytes == 4); - ASSERT (memcmp (mb.buf, "\201\060\211\070", 4) == 0); + ASSERT (memeq (mb.buf, "\201\060\211\070", 4)); /* U+00E9 LATIN SMALL LETTER E WITH ACUTE */ mb = for_character ("\250\246", 2); ASSERT (mb.nbytes == 2); - ASSERT (memcmp (mb.buf, "\250\246", 2) == 0); + ASSERT (memeq (mb.buf, "\250\246", 2)); /* U+00FF LATIN SMALL LETTER Y WITH DIAERESIS */ mb = for_character ("\201\060\213\067", 4); ASSERT (mb.nbytes == 4); - ASSERT (memcmp (mb.buf, "\201\060\213\067", 4) == 0); + ASSERT (memeq (mb.buf, "\201\060\213\067", 4)); #if !((defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __DragonFly__ || defined __sun) /* U+0141 LATIN CAPITAL LETTER L WITH STROKE */ mb = for_character ("\201\060\221\071", 4); ASSERT (mb.nbytes == 4); - ASSERT (memcmp (mb.buf, "\201\060\222\060", 4) == 0); + ASSERT (memeq (mb.buf, "\201\060\222\060", 4)); #endif /* U+0142 LATIN SMALL LETTER L WITH STROKE */ mb = for_character ("\201\060\222\060", 4); ASSERT (mb.nbytes == 4); - ASSERT (memcmp (mb.buf, "\201\060\222\060", 4) == 0); + ASSERT (memeq (mb.buf, "\201\060\222\060", 4)); #if !((defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __DragonFly__) /* U+0429 CYRILLIC CAPITAL LETTER SHCHA */ mb = for_character ("\247\273", 2); ASSERT (mb.nbytes == 2); - ASSERT (memcmp (mb.buf, "\247\353", 2) == 0); + ASSERT (memeq (mb.buf, "\247\353", 2)); #endif /* U+0449 CYRILLIC SMALL LETTER SHCHA */ mb = for_character ("\247\353", 2); ASSERT (mb.nbytes == 2); - ASSERT (memcmp (mb.buf, "\247\353", 2) == 0); + ASSERT (memeq (mb.buf, "\247\353", 2)); /* U+05D5 HEBREW LETTER VAV */ mb = for_character ("\201\060\371\067", 4); ASSERT (mb.nbytes == 4); - ASSERT (memcmp (mb.buf, "\201\060\371\067", 4) == 0); + ASSERT (memeq (mb.buf, "\201\060\371\067", 4)); /* U+3073 HIRAGANA LETTER BI */ mb = for_character ("\244\323", 2); ASSERT (mb.nbytes == 2); - ASSERT (memcmp (mb.buf, "\244\323", 2) == 0); + ASSERT (memeq (mb.buf, "\244\323", 2)); /* U+3162 HANGUL LETTER YI */ mb = for_character ("\201\071\256\062", 4); ASSERT (mb.nbytes == 4); - ASSERT (memcmp (mb.buf, "\201\071\256\062", 4) == 0); + ASSERT (memeq (mb.buf, "\201\071\256\062", 4)); #if !defined __DragonFly__ /* U+FF27 FULLWIDTH LATIN CAPITAL LETTER G */ mb = for_character ("\243\307", 2); ASSERT (mb.nbytes == 2); - ASSERT (memcmp (mb.buf, "\243\347", 2) == 0); + ASSERT (memeq (mb.buf, "\243\347", 2)); #endif /* U+FF47 FULLWIDTH LATIN SMALL LETTER G */ mb = for_character ("\243\347", 2); ASSERT (mb.nbytes == 2); - ASSERT (memcmp (mb.buf, "\243\347", 2) == 0); + ASSERT (memeq (mb.buf, "\243\347", 2)); /* U+FFDB HALFWIDTH HANGUL LETTER YI */ mb = for_character ("\204\061\241\071", 4); ASSERT (mb.nbytes == 4); - ASSERT (memcmp (mb.buf, "\204\061\241\071", 4) == 0); + ASSERT (memeq (mb.buf, "\204\061\241\071", 4)); #if !((defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __DragonFly__ || defined __NetBSD__ || defined __sun) /* U+10419 DESERET CAPITAL LETTER EF */ mb = for_character ("\220\060\351\071", 4); ASSERT (mb.nbytes == 4); - ASSERT (memcmp (mb.buf, "\220\060\355\071", 4) == 0); + ASSERT (memeq (mb.buf, "\220\060\355\071", 4)); #endif /* U+10441 DESERET SMALL LETTER EF */ mb = for_character ("\220\060\355\071", 4); ASSERT (mb.nbytes == 4); - ASSERT (memcmp (mb.buf, "\220\060\355\071", 4) == 0); + ASSERT (memeq (mb.buf, "\220\060\355\071", 4)); /* U+E0041 TAG LATIN CAPITAL LETTER A */ mb = for_character ("\323\066\234\063", 4); ASSERT (mb.nbytes == 4); - ASSERT (memcmp (mb.buf, "\323\066\234\063", 4) == 0); + ASSERT (memeq (mb.buf, "\323\066\234\063", 4)); /* U+E0061 TAG LATIN SMALL LETTER A */ mb = for_character ("\323\066\237\065", 4); ASSERT (mb.nbytes == 4); - ASSERT (memcmp (mb.buf, "\323\066\237\065", 4) == 0); + ASSERT (memeq (mb.buf, "\323\066\237\065", 4)); } return test_exit_status; diff --git a/tests/test-c32toupper.c b/tests/test-c32toupper.c index 9b15374bca..8d050cb058 100644 --- a/tests/test-c32toupper.c +++ b/tests/test-c32toupper.c @@ -158,30 +158,30 @@ main (int argc, char *argv[]) /* U+00B2 SUPERSCRIPT TWO */ mb = for_character ("\262", 1); ASSERT (mb.nbytes == 1); - ASSERT (memcmp (mb.buf, "\262", 1) == 0); + ASSERT (memeq (mb.buf, "\262", 1)); #if !(defined __GLIBC__ || (defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __NetBSD__ || defined __sun || defined __CYGWIN__ || (defined _WIN32 && !defined __CYGWIN__)) /* U+00B5 MICRO SIGN */ mb = for_character ("\265", 1); ASSERT (mb.nbytes == 1); - ASSERT (memcmp (mb.buf, "\265", 1) == 0); + ASSERT (memeq (mb.buf, "\265", 1)); #endif /* U+00C9 LATIN CAPITAL LETTER E WITH ACUTE */ mb = for_character ("\311", 1); ASSERT (mb.nbytes == 1); - ASSERT (memcmp (mb.buf, "\311", 1) == 0); + ASSERT (memeq (mb.buf, "\311", 1)); /* U+00DF LATIN SMALL LETTER SHARP S */ mb = for_character ("\337", 1); ASSERT (mb.nbytes == 1); - ASSERT (memcmp (mb.buf, "\337", 1) == 0); + ASSERT (memeq (mb.buf, "\337", 1)); /* U+00E9 LATIN SMALL LETTER E WITH ACUTE */ mb = for_character ("\351", 1); ASSERT (mb.nbytes == 1); - ASSERT (memcmp (mb.buf, "\311", 1) == 0); + ASSERT (memeq (mb.buf, "\311", 1)); #if !(defined __GLIBC__ || (defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __DragonFly__ || defined __NetBSD__ || defined __sun || defined __CYGWIN__ || (defined _WIN32 && !defined __CYGWIN__)) /* U+00FF LATIN SMALL LETTER Y WITH DIAERESIS */ mb = for_character ("\377", 1); ASSERT (mb.nbytes == 1); - ASSERT (memcmp (mb.buf, "\377", 1) == 0); + ASSERT (memeq (mb.buf, "\377", 1)); #endif } return test_exit_status; @@ -192,58 +192,58 @@ main (int argc, char *argv[]) /* U+00C9 LATIN CAPITAL LETTER E WITH ACUTE */ mb = for_character ("\217\252\261", 3); ASSERT (mb.nbytes == 3); - ASSERT (memcmp (mb.buf, "\217\252\261", 3) == 0); + ASSERT (memeq (mb.buf, "\217\252\261", 3)); #if !defined __NetBSD__ /* U+00DF LATIN SMALL LETTER SHARP S */ mb = for_character ("\217\251\316", 3); ASSERT (mb.nbytes == 3); - ASSERT (memcmp (mb.buf, "\217\251\316", 3) == 0); + ASSERT (memeq (mb.buf, "\217\251\316", 3)); #endif #if !((defined __APPLE__ && defined __MACH__) || defined __DragonFly__) /* U+00E9 LATIN SMALL LETTER E WITH ACUTE */ mb = for_character ("\217\253\261", 3); ASSERT (mb.nbytes == 3); - ASSERT (memcmp (mb.buf, "\217\252\261", 3) == 0); + ASSERT (memeq (mb.buf, "\217\252\261", 3)); #endif #if !((defined __APPLE__ && defined __MACH__) || defined __DragonFly__ || defined __NetBSD__) /* U+00FF LATIN SMALL LETTER Y WITH DIAERESIS */ mb = for_character ("\217\253\363", 3); ASSERT (mb.nbytes == 3); - ASSERT (memcmp (mb.buf, "\217\252\363", 3) == 0); + ASSERT (memeq (mb.buf, "\217\252\363", 3)); #endif /* U+0141 LATIN CAPITAL LETTER L WITH STROKE */ mb = for_character ("\217\251\250", 3); ASSERT (mb.nbytes == 3); - ASSERT (memcmp (mb.buf, "\217\251\250", 3) == 0); + ASSERT (memeq (mb.buf, "\217\251\250", 3)); #if !((defined __APPLE__ && defined __MACH__) || defined __DragonFly__) /* U+0142 LATIN SMALL LETTER L WITH STROKE */ mb = for_character ("\217\251\310", 3); ASSERT (mb.nbytes == 3); - ASSERT (memcmp (mb.buf, "\217\251\250", 3) == 0); + ASSERT (memeq (mb.buf, "\217\251\250", 3)); #endif /* U+0429 CYRILLIC CAPITAL LETTER SHCHA */ mb = for_character ("\247\273", 2); ASSERT (mb.nbytes == 2); - ASSERT (memcmp (mb.buf, "\247\273", 2) == 0); + ASSERT (memeq (mb.buf, "\247\273", 2)); #if !defined __DragonFly__ /* U+0449 CYRILLIC SMALL LETTER SHCHA */ mb = for_character ("\247\353", 2); ASSERT (mb.nbytes == 2); - ASSERT (memcmp (mb.buf, "\247\273", 2) == 0); + ASSERT (memeq (mb.buf, "\247\273", 2)); #endif /* U+3073 HIRAGANA LETTER BI */ mb = for_character ("\244\323", 2); ASSERT (mb.nbytes == 2); - ASSERT (memcmp (mb.buf, "\244\323", 2) == 0); + ASSERT (memeq (mb.buf, "\244\323", 2)); /* U+FF27 FULLWIDTH LATIN CAPITAL LETTER G */ mb = for_character ("\243\307", 2); ASSERT (mb.nbytes == 2); - ASSERT (memcmp (mb.buf, "\243\307", 2) == 0); + ASSERT (memeq (mb.buf, "\243\307", 2)); #if !defined __DragonFly__ /* U+FF47 FULLWIDTH LATIN SMALL LETTER G */ mb = for_character ("\243\347", 2); ASSERT (mb.nbytes == 2); - ASSERT (memcmp (mb.buf, "\243\307", 2) == 0); + ASSERT (memeq (mb.buf, "\243\307", 2)); #endif } return test_exit_status; @@ -254,89 +254,89 @@ main (int argc, char *argv[]) /* U+00B2 SUPERSCRIPT TWO */ mb = for_character ("\302\262", 2); ASSERT (mb.nbytes == 2); - ASSERT (memcmp (mb.buf, "\302\262", 2) == 0); + ASSERT (memeq (mb.buf, "\302\262", 2)); #if !(defined __GLIBC__ || defined MUSL_LIBC || (defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __DragonFly__ || defined __NetBSD__ || defined __OpenBSD__ || defined _AIX || defined __sun || defined __CYGWIN__ || (defined _WIN32 && !defined __CYGWIN__) || defined __ANDROID__ || defined __HAIKU__) /* U+00B5 MICRO SIGN */ mb = for_character ("\302\265", 2); ASSERT (mb.nbytes == 2); - ASSERT (memcmp (mb.buf, "\302\265", 2) == 0); + ASSERT (memeq (mb.buf, "\302\265", 2)); #endif /* U+00C9 LATIN CAPITAL LETTER E WITH ACUTE */ mb = for_character ("\303\211", 2); ASSERT (mb.nbytes == 2); - ASSERT (memcmp (mb.buf, "\303\211", 2) == 0); + ASSERT (memeq (mb.buf, "\303\211", 2)); #if !defined MUSL_LIBC /* U+00DF LATIN SMALL LETTER SHARP S */ mb = for_character ("\303\237", 2); ASSERT (mb.nbytes == 2); - ASSERT (memcmp (mb.buf, "\303\237", 2) == 0); + ASSERT (memeq (mb.buf, "\303\237", 2)); #endif /* U+00E9 LATIN SMALL LETTER E WITH ACUTE */ mb = for_character ("\303\251", 2); ASSERT (mb.nbytes == 2); - ASSERT (memcmp (mb.buf, "\303\211", 2) == 0); + ASSERT (memeq (mb.buf, "\303\211", 2)); /* U+00FF LATIN SMALL LETTER Y WITH DIAERESIS */ mb = for_character ("\303\277", 2); ASSERT (mb.nbytes == 2); - ASSERT (memcmp (mb.buf, "\305\270", 2) == 0); + ASSERT (memeq (mb.buf, "\305\270", 2)); /* U+0141 LATIN CAPITAL LETTER L WITH STROKE */ mb = for_character ("\305\201", 2); ASSERT (mb.nbytes == 2); - ASSERT (memcmp (mb.buf, "\305\201", 2) == 0); + ASSERT (memeq (mb.buf, "\305\201", 2)); /* U+0142 LATIN SMALL LETTER L WITH STROKE */ mb = for_character ("\305\202", 2); ASSERT (mb.nbytes == 2); - ASSERT (memcmp (mb.buf, "\305\201", 2) == 0); + ASSERT (memeq (mb.buf, "\305\201", 2)); /* U+0429 CYRILLIC CAPITAL LETTER SHCHA */ mb = for_character ("\320\251", 2); ASSERT (mb.nbytes == 2); - ASSERT (memcmp (mb.buf, "\320\251", 2) == 0); + ASSERT (memeq (mb.buf, "\320\251", 2)); /* U+0449 CYRILLIC SMALL LETTER SHCHA */ mb = for_character ("\321\211", 2); ASSERT (mb.nbytes == 2); - ASSERT (memcmp (mb.buf, "\320\251", 2) == 0); + ASSERT (memeq (mb.buf, "\320\251", 2)); /* U+05D5 HEBREW LETTER VAV */ mb = for_character ("\327\225", 2); ASSERT (mb.nbytes == 2); - ASSERT (memcmp (mb.buf, "\327\225", 2) == 0); + ASSERT (memeq (mb.buf, "\327\225", 2)); /* U+3073 HIRAGANA LETTER BI */ mb = for_character ("\343\201\263", 3); ASSERT (mb.nbytes == 3); - ASSERT (memcmp (mb.buf, "\343\201\263", 3) == 0); + ASSERT (memeq (mb.buf, "\343\201\263", 3)); /* U+3162 HANGUL LETTER YI */ mb = for_character ("\343\205\242", 3); ASSERT (mb.nbytes == 3); - ASSERT (memcmp (mb.buf, "\343\205\242", 3) == 0); + ASSERT (memeq (mb.buf, "\343\205\242", 3)); /* U+FF27 FULLWIDTH LATIN CAPITAL LETTER G */ mb = for_character ("\357\274\247", 3); ASSERT (mb.nbytes == 3); - ASSERT (memcmp (mb.buf, "\357\274\247", 3) == 0); + ASSERT (memeq (mb.buf, "\357\274\247", 3)); /* U+FF47 FULLWIDTH LATIN SMALL LETTER G */ mb = for_character ("\357\275\207", 3); ASSERT (mb.nbytes == 3); - ASSERT (memcmp (mb.buf, "\357\274\247", 3) == 0); + ASSERT (memeq (mb.buf, "\357\274\247", 3)); /* U+FFDB HALFWIDTH HANGUL LETTER YI */ mb = for_character ("\357\277\233", 3); ASSERT (mb.nbytes == 3); - ASSERT (memcmp (mb.buf, "\357\277\233", 3) == 0); + ASSERT (memeq (mb.buf, "\357\277\233", 3)); /* U+10419 DESERET CAPITAL LETTER EF */ mb = for_character ("\360\220\220\231", 4); ASSERT (mb.nbytes == 4); - ASSERT (memcmp (mb.buf, "\360\220\220\231", 4) == 0); + ASSERT (memeq (mb.buf, "\360\220\220\231", 4)); #if !(defined __DragonFly__ || defined __sun) /* U+10441 DESERET SMALL LETTER EF */ mb = for_character ("\360\220\221\201", 4); ASSERT (mb.nbytes == 4); - ASSERT (memcmp (mb.buf, "\360\220\220\231", 4) == 0); + ASSERT (memeq (mb.buf, "\360\220\220\231", 4)); #endif /* U+E0041 TAG LATIN CAPITAL LETTER A */ mb = for_character ("\363\240\201\201", 4); ASSERT (mb.nbytes == 4); - ASSERT (memcmp (mb.buf, "\363\240\201\201", 4) == 0); + ASSERT (memeq (mb.buf, "\363\240\201\201", 4)); /* U+E0061 TAG LATIN SMALL LETTER A */ mb = for_character ("\363\240\201\241", 4); ASSERT (mb.nbytes == 4); - ASSERT (memcmp (mb.buf, "\363\240\201\241", 4) == 0); + ASSERT (memeq (mb.buf, "\363\240\201\241", 4)); } return test_exit_status; @@ -352,95 +352,95 @@ main (int argc, char *argv[]) /* U+00B2 SUPERSCRIPT TWO */ mb = for_character ("\201\060\205\065", 4); ASSERT (mb.nbytes == 4); - ASSERT (memcmp (mb.buf, "\201\060\205\065", 4) == 0); + ASSERT (memeq (mb.buf, "\201\060\205\065", 4)); #if !(defined __GLIBC__ || defined __FreeBSD__ || (defined __APPLE__ && defined __MACH__) || defined __NetBSD__ || defined __CYGWIN__) /* U+00B5 MICRO SIGN */ mb = for_character ("\201\060\205\070", 4); ASSERT (mb.nbytes == 4); - ASSERT (memcmp (mb.buf, "\201\060\205\070", 4) == 0); + ASSERT (memeq (mb.buf, "\201\060\205\070", 4)); #endif /* U+00C9 LATIN CAPITAL LETTER E WITH ACUTE */ mb = for_character ("\201\060\207\067", 4); ASSERT (mb.nbytes == 4); - ASSERT (memcmp (mb.buf, "\201\060\207\067", 4) == 0); + ASSERT (memeq (mb.buf, "\201\060\207\067", 4)); /* U+00DF LATIN SMALL LETTER SHARP S */ mb = for_character ("\201\060\211\070", 4); ASSERT (mb.nbytes == 4); - ASSERT (memcmp (mb.buf, "\201\060\211\070", 4) == 0); + ASSERT (memeq (mb.buf, "\201\060\211\070", 4)); #if !((defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __DragonFly__ || defined __sun) /* U+00E9 LATIN SMALL LETTER E WITH ACUTE */ mb = for_character ("\250\246", 2); ASSERT (mb.nbytes == 4); - ASSERT (memcmp (mb.buf, "\201\060\207\067", 4) == 0); + ASSERT (memeq (mb.buf, "\201\060\207\067", 4)); /* U+00FF LATIN SMALL LETTER Y WITH DIAERESIS */ mb = for_character ("\201\060\213\067", 4); ASSERT (mb.nbytes == 4); - ASSERT (memcmp (mb.buf, "\201\060\227\060", 4) == 0); + ASSERT (memeq (mb.buf, "\201\060\227\060", 4)); #endif /* U+0141 LATIN CAPITAL LETTER L WITH STROKE */ mb = for_character ("\201\060\221\071", 4); ASSERT (mb.nbytes == 4); - ASSERT (memcmp (mb.buf, "\201\060\221\071", 4) == 0); + ASSERT (memeq (mb.buf, "\201\060\221\071", 4)); #if !((defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __DragonFly__ || defined __sun) /* U+0142 LATIN SMALL LETTER L WITH STROKE */ mb = for_character ("\201\060\222\060", 4); ASSERT (mb.nbytes == 4); - ASSERT (memcmp (mb.buf, "\201\060\221\071", 4) == 0); + ASSERT (memeq (mb.buf, "\201\060\221\071", 4)); #endif /* U+0429 CYRILLIC CAPITAL LETTER SHCHA */ mb = for_character ("\247\273", 2); ASSERT (mb.nbytes == 2); - ASSERT (memcmp (mb.buf, "\247\273", 2) == 0); + ASSERT (memeq (mb.buf, "\247\273", 2)); #if !((defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __DragonFly__) /* U+0449 CYRILLIC SMALL LETTER SHCHA */ mb = for_character ("\247\353", 2); ASSERT (mb.nbytes == 2); - ASSERT (memcmp (mb.buf, "\247\273", 2) == 0); + ASSERT (memeq (mb.buf, "\247\273", 2)); #endif /* U+05D5 HEBREW LETTER VAV */ mb = for_character ("\201\060\371\067", 4); ASSERT (mb.nbytes == 4); - ASSERT (memcmp (mb.buf, "\201\060\371\067", 4) == 0); + ASSERT (memeq (mb.buf, "\201\060\371\067", 4)); /* U+3073 HIRAGANA LETTER BI */ mb = for_character ("\244\323", 2); ASSERT (mb.nbytes == 2); - ASSERT (memcmp (mb.buf, "\244\323", 2) == 0); + ASSERT (memeq (mb.buf, "\244\323", 2)); /* U+3162 HANGUL LETTER YI */ mb = for_character ("\201\071\256\062", 4); ASSERT (mb.nbytes == 4); - ASSERT (memcmp (mb.buf, "\201\071\256\062", 4) == 0); + ASSERT (memeq (mb.buf, "\201\071\256\062", 4)); /* U+FF27 FULLWIDTH LATIN CAPITAL LETTER G */ mb = for_character ("\243\307", 2); ASSERT (mb.nbytes == 2); - ASSERT (memcmp (mb.buf, "\243\307", 2) == 0); + ASSERT (memeq (mb.buf, "\243\307", 2)); #if !defined __DragonFly__ /* U+FF47 FULLWIDTH LATIN SMALL LETTER G */ mb = for_character ("\243\347", 2); ASSERT (mb.nbytes == 2); - ASSERT (memcmp (mb.buf, "\243\307", 2) == 0); + ASSERT (memeq (mb.buf, "\243\307", 2)); #endif /* U+FFDB HALFWIDTH HANGUL LETTER YI */ mb = for_character ("\204\061\241\071", 4); ASSERT (mb.nbytes == 4); - ASSERT (memcmp (mb.buf, "\204\061\241\071", 4) == 0); + ASSERT (memeq (mb.buf, "\204\061\241\071", 4)); /* U+10419 DESERET CAPITAL LETTER EF */ mb = for_character ("\220\060\351\071", 4); ASSERT (mb.nbytes == 4); - ASSERT (memcmp (mb.buf, "\220\060\351\071", 4) == 0); + ASSERT (memeq (mb.buf, "\220\060\351\071", 4)); #if !((defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __DragonFly__ || defined __NetBSD__ || defined __sun) /* U+10441 DESERET SMALL LETTER EF */ mb = for_character ("\220\060\355\071", 4); ASSERT (mb.nbytes == 4); - ASSERT (memcmp (mb.buf, "\220\060\351\071", 4) == 0); + ASSERT (memeq (mb.buf, "\220\060\351\071", 4)); #endif /* U+E0041 TAG LATIN CAPITAL LETTER A */ mb = for_character ("\323\066\234\063", 4); ASSERT (mb.nbytes == 4); - ASSERT (memcmp (mb.buf, "\323\066\234\063", 4) == 0); + ASSERT (memeq (mb.buf, "\323\066\234\063", 4)); /* U+E0061 TAG LATIN SMALL LETTER A */ mb = for_character ("\323\066\237\065", 4); ASSERT (mb.nbytes == 4); - ASSERT (memcmp (mb.buf, "\323\066\237\065", 4) == 0); + ASSERT (memeq (mb.buf, "\323\066\237\065", 4)); } return test_exit_status; diff --git a/tests/test-copysign.c b/tests/test-copysign.c index 10bfa7bacf..62abaa1ced 100644 --- a/tests/test-copysign.c +++ b/tests/test-copysign.c @@ -87,7 +87,7 @@ main () y = 1.0; z = copysign (x, y); ASSERT (z == 0.0); - ASSERT (memcmp (&z, &zero, sizeof z) == 0); + ASSERT (memeq (&z, &zero, sizeof z)); x = 0.0; y = -1.0; @@ -99,7 +99,7 @@ main () y = 1.0; z = copysign (x, y); ASSERT (z == 0.0); - ASSERT (memcmp (&z, &zero, sizeof z) == 0); + ASSERT (memeq (&z, &zero, sizeof z)); x = minus_zerod; y = -1.0; diff --git a/tests/test-copysignf.c b/tests/test-copysignf.c index b577e48c83..27300ec65b 100644 --- a/tests/test-copysignf.c +++ b/tests/test-copysignf.c @@ -87,7 +87,7 @@ main () y = 1.0f; z = copysignf (x, y); ASSERT (z == 0.0f); - ASSERT (memcmp (&z, &zero, sizeof z) == 0); + ASSERT (memeq (&z, &zero, sizeof z)); x = 0.0f; y = -1.0f; @@ -99,7 +99,7 @@ main () y = 1.0f; z = copysignf (x, y); ASSERT (z == 0.0f); - ASSERT (memcmp (&z, &zero, sizeof z) == 0); + ASSERT (memeq (&z, &zero, sizeof z)); x = minus_zerof; y = -1.0f; diff --git a/tests/test-copysignl.c b/tests/test-copysignl.c index 49dcdd97cd..ce86bd0586 100644 --- a/tests/test-copysignl.c +++ b/tests/test-copysignl.c @@ -96,7 +96,7 @@ main () y = 1.0L; z = copysignl (x, y); ASSERT (z == 0.0L); - ASSERT (memcmp (&z, &zero, LDBL_BYTES) == 0); + ASSERT (memeq (&z, &zero, LDBL_BYTES)); x = 0.0L; y = -1.0L; @@ -108,7 +108,7 @@ main () y = 1.0L; z = copysignl (x, y); ASSERT (z == 0.0L); - ASSERT (memcmp (&z, &zero, LDBL_BYTES) == 0); + ASSERT (memeq (&z, &zero, LDBL_BYTES)); x = minus_zerol; y = -1.0L; diff --git a/tests/test-exclude.c b/tests/test-exclude.c index 8fdc2dd357..17c631c02a 100644 --- a/tests/test-exclude.c +++ b/tests/test-exclude.c @@ -90,7 +90,7 @@ main (int argc, char **argv) argc--; break; } - if (strlen (s) > 3 && memcmp (s, "no-", 3) == 0) + if (strlen (s) > 3 && memeq (s, "no-", 3)) { neg = 1; s += 3; diff --git a/tests/test-execute-main.c b/tests/test-execute-main.c index 7da5036db2..86d26ce8fc 100644 --- a/tests/test-execute-main.c +++ b/tests/test-execute-main.c @@ -233,7 +233,7 @@ main (int argc, char *argv[]) size_t length; char *contents = read_file (BASE ".tmp", 0, &length); - ASSERT (length == 3 && memcmp (contents, "bar", 3) == 0); + ASSERT (length == 3 && memeq (contents, "bar", 3)); ASSERT (remove (BASE ".tmp") == 0); } @@ -285,7 +285,7 @@ main (int argc, char *argv[]) size_t length; char *contents = read_file (BASE ".tmp", 0, &length); - ASSERT (length == 3 && memcmp (contents, "bar", 3) == 0); + ASSERT (length == 3 && memeq (contents, "bar", 3)); ASSERT (remove (BASE ".tmp") == 0); } @@ -404,7 +404,7 @@ main (int argc, char *argv[]) size_t length; char *contents = read_file (BASE ".tmp", 0, &length); - ASSERT (length == 6 && memcmp (contents, "Foobar", 6) == 0); + ASSERT (length == 6 && memeq (contents, "Foobar", 6)); ASSERT (remove (BASE ".tmp") == 0); } diff --git a/tests/test-execute-script.c b/tests/test-execute-script.c index 2e4ba2983e..bfb602097f 100644 --- a/tests/test-execute-script.c +++ b/tests/test-execute-script.c @@ -82,7 +82,7 @@ main () size_t length; char *contents = read_file (DATA_FILENAME, 0, &length); - ASSERT (length == 11 && memcmp (contents, "Halle Potta", 11) == 0); + ASSERT (length == 11 && memeq (contents, "Halle Potta", 11)); } ASSERT (unlink (DATA_FILENAME) == 0); diff --git a/tests/test-explicit_bzero.c b/tests/test-explicit_bzero.c index 1f9afdf19a..211d74fc0d 100644 --- a/tests/test-explicit_bzero.c +++ b/tests/test-explicit_bzero.c @@ -55,7 +55,7 @@ test_static (void) { memcpy (stbuf, SECRET, SECRET_SIZE); explicit_bzero (stbuf, SECRET_SIZE); - ASSERT (memcmp (zero, stbuf, SECRET_SIZE) == 0); + ASSERT (memeq (zero, stbuf, SECRET_SIZE)); } /* =============== Verify operation on heap-allocated memory =============== */ diff --git a/tests/test-fpurge.c b/tests/test-fpurge.c index 32a8f8c9b4..d7173e9ea0 100644 --- a/tests/test-fpurge.c +++ b/tests/test-fpurge.c @@ -77,7 +77,7 @@ main (void) char buf[8]; if (fread (buf, 1, 7, fp) < 7) goto skip; - ASSERT (memcmp (buf, "foogars", 7) == 0); + ASSERT (memeq (buf, "foogars", 7)); } /* Discard the buffered 'h'. */ if (check_filepos) @@ -115,7 +115,7 @@ main (void) { char buf[10]; ASSERT (fread (buf, 1, 10, fp) == 9); - ASSERT (memcmp (buf, "foogarsh!", 9) == 0); + ASSERT (memeq (buf, "foogarsh!", 9)); } ASSERT (fclose (fp) == 0); diff --git a/tests/test-freadptr.c b/tests/test-freadptr.c index f9f2869dfa..3e3340ac83 100644 --- a/tests/test-freadptr.c +++ b/tests/test-freadptr.c @@ -60,7 +60,7 @@ main (int argc, char **argv) ASSERT (ptr != NULL); ASSERT (available1 != 0); ASSERT (available1 <= strlen (expected)); - ASSERT (memcmp (ptr, expected, available1) == 0); + ASSERT (memeq (ptr, expected, available1)); } /* Test behaviour after normal ungetc. */ @@ -71,7 +71,7 @@ main (int argc, char **argv) if (ptr != NULL) { ASSERT (available2 == available1); - ASSERT (memcmp (ptr, expected, available2) == 0); + ASSERT (memeq (ptr, expected, available2)); } } @@ -87,7 +87,7 @@ main (int argc, char **argv) ASSERT (ptr[0] == '@'); if (available3 > 1) { - ASSERT (memcmp (ptr + 1, expected + 1, available3 - 1) == 0); + ASSERT (memeq (ptr + 1, expected + 1, available3 - 1)); } } } diff --git a/tests/test-freadseek.c b/tests/test-freadseek.c index 4a856f7197..776ffde12f 100644 --- a/tests/test-freadseek.c +++ b/tests/test-freadseek.c @@ -47,7 +47,7 @@ main (int argc, char **argv) size_t position = 0; ASSERT (fread (buf1, 1, nbytes1, stdin) == nbytes1); - ASSERT (memcmp (buf1, stdin_contents + position, nbytes1) == 0); + ASSERT (memeq (buf1, stdin_contents + position, nbytes1)); position += nbytes1; /* Test normal behaviour. */ @@ -55,7 +55,7 @@ main (int argc, char **argv) position += nbytes2; ASSERT (fread (buf3, 1, nbytes3, stdin) == nbytes3); - ASSERT (memcmp (buf3, stdin_contents + position, nbytes3) == 0); + ASSERT (memeq (buf3, stdin_contents + position, nbytes3)); position += nbytes3; /* Test behaviour after normal ungetc. */ @@ -64,7 +64,7 @@ main (int argc, char **argv) position += nbytes4; ASSERT (fread (buf5, 1, nbytes5, stdin) == nbytes5); - ASSERT (memcmp (buf5, stdin_contents + position, nbytes5) == 0); + ASSERT (memeq (buf5, stdin_contents + position, nbytes5)); position += nbytes5; /* Test behaviour after arbitrary ungetc. */ @@ -74,7 +74,7 @@ main (int argc, char **argv) position += nbytes6; ASSERT (fread (buf7, 1, nbytes7, stdin) == nbytes7); - ASSERT (memcmp (buf7, stdin_contents + position, nbytes7) == 0); + ASSERT (memeq (buf7, stdin_contents + position, nbytes7)); position += nbytes7; /* Test move to end of file. */ diff --git a/tests/test-fseeko-largefile.c b/tests/test-fseeko-largefile.c index e8c939240d..54f11a67b8 100644 --- a/tests/test-fseeko-largefile.c +++ b/tests/test-fseeko-largefile.c @@ -74,7 +74,7 @@ main (void) char buf[TESTFILE_DATA_LEN]; ASSERT (fread (buf, 1, TESTFILE_DATA_LEN, fp) == TESTFILE_DATA_LEN); - ASSERT (memcmp (buf, TESTFILE_DATA, TESTFILE_DATA_LEN) == 0); + ASSERT (memeq (buf, TESTFILE_DATA, TESTFILE_DATA_LEN)); ret = fclose (fp); ASSERT (ret == 0); diff --git a/tests/test-ftell3.c b/tests/test-ftell3.c index 6870ece2ed..f5adc360d6 100644 --- a/tests/test-ftell3.c +++ b/tests/test-ftell3.c @@ -62,7 +62,7 @@ main (void) { char buf[10]; ASSERT (fread (buf, 1, 10, fp) == 9); - ASSERT (memcmp (buf, "foogarsh!", 9) == 0); + ASSERT (memeq (buf, "foogarsh!", 9)); } ASSERT (fclose (fp) == 0); diff --git a/tests/test-ftello3.c b/tests/test-ftello3.c index fb762165a0..89893af9e7 100644 --- a/tests/test-ftello3.c +++ b/tests/test-ftello3.c @@ -62,7 +62,7 @@ main (void) { char buf[10]; ASSERT (fread (buf, 1, 10, fp) == 9); - ASSERT (memcmp (buf, "foogarsh!", 9) == 0); + ASSERT (memeq (buf, "foogarsh!", 9)); } ASSERT (fclose (fp) == 0); diff --git a/tests/test-getdelim.c b/tests/test-getdelim.c index e2cea1e130..3a6e75ae1a 100644 --- a/tests/test-getdelim.c +++ b/tests/test-getdelim.c @@ -81,7 +81,7 @@ main (void) /* Test embedded NULs and EOF behavior. */ result = getdelim (&line, &len, 'n', f); ASSERT (result == 3); - ASSERT (memcmp (line, "d\0f", 4) == 0); + ASSERT (memeq (line, "d\0f", 4)); ASSERT (3 < len); result = getdelim (&line, &len, 'n', f); diff --git a/tests/test-getline.c b/tests/test-getline.c index cef7933d42..1431be0698 100644 --- a/tests/test-getline.c +++ b/tests/test-getline.c @@ -81,7 +81,7 @@ main (void) /* Test embedded NULs and EOF behavior. */ result = getline (&line, &len, f); ASSERT (result == 3); - ASSERT (memcmp (line, "d\0f", 4) == 0); + ASSERT (memeq (line, "d\0f", 4)); ASSERT (3 < len); result = getline (&line, &len, f); diff --git a/tests/test-getndelim2.c b/tests/test-getndelim2.c index 6c1f70498f..f6cc585097 100644 --- a/tests/test-getndelim2.c +++ b/tests/test-getndelim2.c @@ -64,7 +64,7 @@ main (void) /* Test embedded NULs and EOF behavior. */ result = getndelim2 (&line, &len, 0, GETNLINE_NO_LIMIT, '\n', EOF, f); ASSERT (result == 3); - ASSERT (memcmp (line, "d\0f", 4) == 0); + ASSERT (memeq (line, "d\0f", 4)); ASSERT (3 < len); result = getndelim2 (&line, &len, 0, GETNLINE_NO_LIMIT, '\n', EOF, f); @@ -93,7 +93,7 @@ main (void) result = getndelim2 (&line, &len, 0, GETNLINE_NO_LIMIT, EOF, EOF, f); ASSERT (result == 2); ASSERT (10 == len); - ASSERT (memcmp (line, "\0f\0eeea\nb", 10) == 0); + ASSERT (memeq (line, "\0f\0eeea\nb", 10)); result = getndelim2 (&line, &len, 0, GETNLINE_NO_LIMIT, '\n', '\r', f); ASSERT (result == -1); diff --git a/tests/test-iconv-utf.c b/tests/test-iconv-utf.c index 8a047e5b25..4c21667976 100644 --- a/tests/test-iconv-utf.c +++ b/tests/test-iconv-utf.c @@ -79,7 +79,7 @@ main () &outptr, &outbytesleft); ASSERT (res == 0 && inbytesleft == 0); ASSERT (outptr == buf + (sizeof (expected) - 1)); - ASSERT (memcmp (buf, expected, sizeof (expected) - 1) == 0); + ASSERT (memeq (buf, expected, sizeof (expected) - 1)); ASSERT (iconv_close (cd) == 0); @@ -111,7 +111,7 @@ main () &outptr, &outbytesleft); ASSERT (res == 0 && inbytesleft == 0); ASSERT (outptr == buf + (sizeof (expected) - 1)); - ASSERT (memcmp (buf, expected, sizeof (expected) - 1) == 0); + ASSERT (memeq (buf, expected, sizeof (expected) - 1)); ASSERT (iconv_close (cd) == 0); @@ -143,7 +143,7 @@ main () &outptr, &outbytesleft); ASSERT (res == 0 && inbytesleft == 0); ASSERT (outptr == buf + (sizeof (expected) - 1)); - ASSERT (memcmp (buf, expected, sizeof (expected) - 1) == 0); + ASSERT (memeq (buf, expected, sizeof (expected) - 1)); ASSERT (iconv_close (cd) == 0); @@ -175,7 +175,7 @@ main () &outptr, &outbytesleft); ASSERT (res == 0 && inbytesleft == 0); ASSERT (outptr == buf + (sizeof (expected) - 1)); - ASSERT (memcmp (buf, expected, sizeof (expected) - 1) == 0); + ASSERT (memeq (buf, expected, sizeof (expected) - 1)); ASSERT (iconv_close (cd) == 0); @@ -207,7 +207,7 @@ main () &outptr, &outbytesleft); ASSERT (res == 0 && inbytesleft == 0); ASSERT (outptr == buf + (sizeof (expected) - 1)); - ASSERT (memcmp (buf, expected, sizeof (expected) - 1) == 0); + ASSERT (memeq (buf, expected, sizeof (expected) - 1)); ASSERT (iconv_close (cd) == 0); @@ -239,7 +239,7 @@ main () &outptr, &outbytesleft); ASSERT (res == 0 && inbytesleft == 0); ASSERT (outptr == buf + (sizeof (expected) - 1)); - ASSERT (memcmp (buf, expected, sizeof (expected) - 1) == 0); + ASSERT (memeq (buf, expected, sizeof (expected) - 1)); ASSERT (iconv_close (cd) == 0); @@ -271,7 +271,7 @@ main () &outptr, &outbytesleft); ASSERT (res == 0 && inbytesleft == 0); ASSERT (outptr == buf + (sizeof (expected) - 1)); - ASSERT (memcmp (buf, expected, sizeof (expected) - 1) == 0); + ASSERT (memeq (buf, expected, sizeof (expected) - 1)); ASSERT (iconv_close (cd) == 0); @@ -303,7 +303,7 @@ main () &outptr, &outbytesleft); ASSERT (res == 0 && inbytesleft == 0); ASSERT (outptr == buf + (sizeof (expected) - 1)); - ASSERT (memcmp (buf, expected, sizeof (expected) - 1) == 0); + ASSERT (memeq (buf, expected, sizeof (expected) - 1)); ASSERT (iconv_close (cd) == 0); diff --git a/tests/test-iconv.c b/tests/test-iconv.c index bf57744248..59d065177f 100644 --- a/tests/test-iconv.c +++ b/tests/test-iconv.c @@ -70,7 +70,7 @@ main () &outptr, &outbytesleft); ASSERT (res == 0 && inbytesleft == 0); ASSERT (outptr == buf + strlen (expected)); - ASSERT (memcmp (buf, expected, strlen (expected)) == 0); + ASSERT (memeq (buf, expected, strlen (expected))); } /* Test conversion from ISO-8859-1 to UTF-8 with E2BIG. */ @@ -105,7 +105,7 @@ main () &outptr, &outbytesleft); ASSERT (res == 0 && inbytesleft == 0); ASSERT (outptr == buf + strlen (expected)); - ASSERT (memcmp (buf, expected, strlen (expected)) == 0); + ASSERT (memeq (buf, expected, strlen (expected))); } /* Test conversion from UTF-8 to ISO-8859-1 with EILSEQ. */ diff --git a/tests/test-memset_explicit.c b/tests/test-memset_explicit.c index 719fae3ca0..6c308f1f7a 100644 --- a/tests/test-memset_explicit.c +++ b/tests/test-memset_explicit.c @@ -73,14 +73,14 @@ test_static (void) { memcpy (stbuf, SECRET, SECRET_SIZE); memset_explicit (stbuf, 0, SECRET_SIZE); - ASSERT (memcmp (zero, stbuf, SECRET_SIZE) == 0); + ASSERT (memeq (zero, stbuf, SECRET_SIZE)); for (int i = 1; i <= UCHAR_MAX; i++) { char checkbuf[SECRET_SIZE]; memset (checkbuf, i, SECRET_SIZE); memcpy (stbuf, SECRET, SECRET_SIZE); memset_explicit (stbuf, i, SECRET_SIZE); - ASSERT (memcmp (checkbuf, stbuf, SECRET_SIZE) == 0); + ASSERT (memeq (checkbuf, stbuf, SECRET_SIZE)); } } diff --git a/tests/test-nonblocking-reader.h b/tests/test-nonblocking-reader.h index 2500bbcc4a..e7460fb40f 100644 --- a/tests/test-nonblocking-reader.h +++ b/tests/test-nonblocking-reader.h @@ -147,7 +147,7 @@ main_reader_loop (int test, size_t data_block_size, int fd) ret = full_read (fd, data, data_block_size); END_TIMING ASSERT (ret == data_block_size); - ASSERT (memcmp (data, expected, data_block_size) == 0); + ASSERT (memeq (data, expected, data_block_size)); ASSERT (spent_time > 0.5); /* This assertion fails if data_block_size is very large and ENABLE_DEBUGGING is 1. */ @@ -159,7 +159,7 @@ main_reader_loop (int test, size_t data_block_size, int fd) ret = full_read (fd, data, data_block_size); END_TIMING ASSERT (ret == data_block_size); - ASSERT (memcmp (data, expected + data_block_size, data_block_size) == 0); + ASSERT (memeq (data, expected + data_block_size, data_block_size)); /* This assertion fails if data_block_size is much larger than needed and SMALL_DELAY is too large. */ ASSERT (spent_time < 0.5); @@ -172,7 +172,7 @@ main_reader_loop (int test, size_t data_block_size, int fd) ret = full_read_from_nonblocking_fd (fd, data, data_block_size); END_TIMING ASSERT (ret == data_block_size); - ASSERT (memcmp (data, expected, data_block_size) == 0); + ASSERT (memeq (data, expected, data_block_size)); ASSERT (spent_time > 0.5); /* This assertion fails if data_block_size is much larger than needed and SMALL_DELAY is too large, or if data_block_size is very large and @@ -185,7 +185,7 @@ main_reader_loop (int test, size_t data_block_size, int fd) ret = full_read_from_nonblocking_fd (fd, data, data_block_size); END_TIMING ASSERT (ret == data_block_size); - ASSERT (memcmp (data, expected + data_block_size, data_block_size) == 0); + ASSERT (memeq (data, expected + data_block_size, data_block_size)); /* This assertion fails if data_block_size is much larger than needed and SMALL_DELAY is too large. */ ASSERT (spent_time < 0.5); diff --git a/tests/test-nstrftime.h b/tests/test-nstrftime.h index 8e4695d147..7ab38b40c5 100644 --- a/tests/test-nstrftime.h +++ b/tests/test-nstrftime.h @@ -241,7 +241,7 @@ tzalloc_test (void) if (! (streq (buf, LT[i].exp) || (!tz && n == strlen (LT[i].exp) - && memcmp (buf, LT[i].exp, n - sizeof "(GMT)" + 1) == 0 + && memeq (buf, LT[i].exp, n - sizeof "(GMT)" + 1) && streq (buf + n - sizeof "(GMT)" + 1, "(GMT)")) #if defined _WIN32 && !defined __CYGWIN__ /* On native Windows, the time zone is printed differently. */ diff --git a/tests/test-obstack-zprintf-gnu.c b/tests/test-obstack-zprintf-gnu.c index 9a2573e84e..54bf536b49 100644 --- a/tests/test-obstack-zprintf-gnu.c +++ b/tests/test-obstack-zprintf-gnu.c @@ -42,7 +42,7 @@ test_function (ptrdiff_t (*my_obstack_zprintf) (struct obstack *, const char *, obstack_init (&obs); #define RESULT_EQ(expected) \ - (len == strlen (expected) && memcmp (result, expected, len) == 0) + (len == strlen (expected) && memeq (result, expected, len)) /* Test the support of the 'B' conversion specifier for binary output of integers. */ diff --git a/tests/test-obstack-zprintf-posix.c b/tests/test-obstack-zprintf-posix.c index 4cc0e1942d..2b4843fd60 100644 --- a/tests/test-obstack-zprintf-posix.c +++ b/tests/test-obstack-zprintf-posix.c @@ -47,7 +47,7 @@ strisnan (const char *string, size_t start_index, size_t end_index, int uppercas if (string[start_index] == '-') start_index++; if (start_index + 3 <= end_index - && memcmp (string + start_index, uppercase ? "NAN" : "nan", 3) == 0) + && memeq (string + start_index, uppercase ? "NAN" : "nan", 3)) { start_index += 3; if (start_index == end_index @@ -65,7 +65,7 @@ test_function (ptrdiff_t (*my_obstack_zprintf) (struct obstack *, const char *, obstack_init (&obs); #define RESULT_EQ(expected) \ - (len == strlen (expected) && memcmp (result, expected, len) == 0) + (len == strlen (expected) && memeq (result, expected, len)) /* Test the support of the 'a' and 'A' conversion specifier for hexadecimal output of floating-point numbers. */ @@ -138,7 +138,7 @@ test_function (ptrdiff_t (*my_obstack_zprintf) (struct obstack *, const char *, char *result = obstack_finish (&obs); ASSERT (len >= 3 + 3 && strisnan (result, 0, len - 3, 0) - && memcmp (result + len - 3, " 33", 3) == 0); + && memeq (result + len - 3, " 33", 3)); obstack_free (&obs, result); } @@ -171,7 +171,7 @@ test_function (ptrdiff_t (*my_obstack_zprintf) (struct obstack *, const char *, char *result = obstack_finish (&obs); ASSERT (len >= 3 + 3 && strisnan (result, 0, len - 3, 0) - && memcmp (result + len - 3, " 33", 3) == 0); + && memeq (result + len - 3, " 33", 3)); obstack_free (&obs, result); } @@ -194,7 +194,7 @@ test_function (ptrdiff_t (*my_obstack_zprintf) (struct obstack *, const char *, char *result = obstack_finish (&obs); ASSERT (len >= 3 + 3 && strisnan (result, 0, len - 3, 0) - && memcmp (result + len - 3, " 33", 3) == 0); + && memeq (result + len - 3, " 33", 3)); obstack_free (&obs, result); } @@ -208,7 +208,7 @@ test_function (ptrdiff_t (*my_obstack_zprintf) (struct obstack *, const char *, ASSERT (len == 4000 + 3); for (size_t i = 0; i < 4000 - 7; i++) ASSERT (result[i] == '0'); - ASSERT (memcmp (result + 4000 - 7, "1234567 99", 7 + 3) == 0); + ASSERT (memeq (result + 4000 - 7, "1234567 99", 7 + 3)); obstack_free (&obs, result); } diff --git a/tests/test-openpty.c b/tests/test-openpty.c index 53160b9e93..658f86d18a 100644 --- a/tests/test-openpty.c +++ b/tests/test-openpty.c @@ -94,7 +94,7 @@ main () return 1; } if (!(res == strlen (expected) - && memcmp (buf, expected, strlen (expected)) == 0)) + && memeq (buf, expected, strlen (expected)))) { fprintf (stderr, "read result unexpected\n"); return 1; diff --git a/tests/test-posix_spawn-chdir.c b/tests/test-posix_spawn-chdir.c index 19235e120d..e169949b95 100644 --- a/tests/test-posix_spawn-chdir.c +++ b/tests/test-posix_spawn-chdir.c @@ -129,14 +129,14 @@ test (const char *pwd_prog) fprintf (stderr, "could not read expected output\n"); exit (1); } - if (!(line_len == 2 && memcmp (line, "/\n", 2) == 0)) + if (!(line_len == 2 && memeq (line, "/\n", 2))) #if defined _WIN32 && !defined __CYGWIN__ /* If the pwd program is Cygwin's pwd, its output in the root directory is "/cygdrive/N", where N is a lowercase letter. And if the pwd program is MSYS2 pwd, its output in the root directory is "/N", where N is a lowercase letter. */ if (!((line_len > 11 - && memcmp (line, "/cygdrive/", 10) == 0 + && memeq (line, "/cygdrive/", 10) && line[10] >= 'a' && line[10] <= 'z' && ((line_len == 12 && line[11] == '\n') || (line_len == 13 && line[11] == '\r' && line[12] == '\n'))) diff --git a/tests/test-posix_spawn-inherit0.c b/tests/test-posix_spawn-inherit0.c index 39eb988945..722b3940be 100644 --- a/tests/test-posix_spawn-inherit0.c +++ b/tests/test-posix_spawn-inherit0.c @@ -113,7 +113,7 @@ child_main (void) /* Read from STDIN_FILENO. */ char buf[1024]; int nread = fread (buf, 1, sizeof (buf), stdin); - if (!(nread == 5 && memcmp (buf, "Potta", 5) == 0)) + if (!(nread == 5 && memeq (buf, "Potta", 5))) { fprintf (stderr, "child: read %d bytes, expected %d bytes\n", nread, 5); return 1; diff --git a/tests/test-posix_spawn-inherit1.c b/tests/test-posix_spawn-inherit1.c index a5262dd041..a68cb0e3b1 100644 --- a/tests/test-posix_spawn-inherit1.c +++ b/tests/test-posix_spawn-inherit1.c @@ -97,7 +97,7 @@ parent_main (void) } char buf[1024]; int nread = fread (buf, 1, sizeof (buf), fp); - if (!(nread == 11 && memcmp (buf, "Halle Potta", 11) == 0)) + if (!(nread == 11 && memeq (buf, "Halle Potta", 11))) { fprintf (stderr, "data file wrong: has %d bytes, expected %d bytes\n", nread, 11); return 1; diff --git a/tests/test-posix_spawn-open1.c b/tests/test-posix_spawn-open1.c index 5f74eb3624..776b6b70bd 100644 --- a/tests/test-posix_spawn-open1.c +++ b/tests/test-posix_spawn-open1.c @@ -120,7 +120,7 @@ child_main (void) /* See if reading from STDIN_FILENO yields the expected contents. */ if (fread (buf, 1, sizeof (buf), stdin) == 11 - && memcmp (buf, "Halle Potta", 11) == 0) + && memeq (buf, "Halle Potta", 11)) return 0; else return 2; diff --git a/tests/test-posix_spawn-open2.c b/tests/test-posix_spawn-open2.c index f3c743e985..407c842a31 100644 --- a/tests/test-posix_spawn-open2.c +++ b/tests/test-posix_spawn-open2.c @@ -101,7 +101,7 @@ parent_main (void) } char buf[1024]; int nread = fread (buf, 1, sizeof (buf), fp); - if (!(nread == 11 && memcmp (buf, "Halle Potta", 11) == 0)) + if (!(nread == 11 && memeq (buf, "Halle Potta", 11))) { fprintf (stderr, "data file wrong: has %d bytes, expected %d bytes\n", nread, 11); return 1; diff --git a/tests/test-posix_spawn-script.c b/tests/test-posix_spawn-script.c index 92b87055a5..45a09d2d88 100644 --- a/tests/test-posix_spawn-script.c +++ b/tests/test-posix_spawn-script.c @@ -134,7 +134,7 @@ main () } char buf[1024]; int nread = fread (buf, 1, sizeof (buf), fp); - if (!(nread == 11 && memcmp (buf, "Halle Potta", 11) == 0)) + if (!(nread == 11 && memeq (buf, "Halle Potta", 11))) { fprintf (stderr, "data file wrong: has %d bytes, expected %d bytes\n", nread, 11); return 1; diff --git a/tests/test-posix_spawnp-script.c b/tests/test-posix_spawnp-script.c index 5838cdd4b0..2cd313e53f 100644 --- a/tests/test-posix_spawnp-script.c +++ b/tests/test-posix_spawnp-script.c @@ -134,7 +134,7 @@ main () } char buf[1024]; int nread = fread (buf, 1, sizeof (buf), fp); - if (!(nread == 11 && memcmp (buf, "Halle Potta", 11) == 0)) + if (!(nread == 11 && memeq (buf, "Halle Potta", 11))) { fprintf (stderr, "data file wrong: has %d bytes, expected %d bytes\n", nread, 11); return 1; diff --git a/tests/test-ptsname.c b/tests/test-ptsname.c index 14f5c8b1c2..3d321ad390 100644 --- a/tests/test-ptsname.c +++ b/tests/test-ptsname.c @@ -98,7 +98,7 @@ main (void) master. */ if (result != NULL) { - ASSERT (memcmp (result, "/dev/", 5) == 0); + ASSERT (memeq (result, "/dev/", 5)); } close (fd); @@ -124,7 +124,7 @@ main (void) result = ptsname (fd); ASSERT (result != NULL); - ASSERT (memcmp (result, "/dev/pts/", 9) == 0); + ASSERT (memeq (result, "/dev/pts/", 9)); close (fd); } @@ -154,7 +154,7 @@ main (void) result = ptsname (fd); ASSERT (result != NULL); - ASSERT (memcmp (result, "/dev/pts/", 9) == 0); + ASSERT (memeq (result, "/dev/pts/", 9)); /* This close (fd) call takes 15 seconds. It would be interruptible by the SIGALRM timer, but then this test would report failure. */ diff --git a/tests/test-ptsname_r.c b/tests/test-ptsname_r.c index 8328576353..9aea0065cd 100644 --- a/tests/test-ptsname_r.c +++ b/tests/test-ptsname_r.c @@ -146,7 +146,7 @@ main (void) master. */ if (result == 0) { - ASSERT (memcmp (buffer, "/dev/", 5) == 0); + ASSERT (memeq (buffer, "/dev/", 5)); } close (fd); @@ -173,7 +173,7 @@ main (void) result = ptsname_r (fd, buffer, sizeof buffer); ASSERT (result == 0); - ASSERT (memcmp (buffer, "/dev/pts/", 9) == 0); + ASSERT (memeq (buffer, "/dev/pts/", 9)); test_errors (fd, buffer); @@ -206,7 +206,7 @@ main (void) result = ptsname_r (fd, buffer, sizeof buffer); ASSERT (result == 0); - ASSERT (memcmp (buffer, "/dev/pts/", 9) == 0); + ASSERT (memeq (buffer, "/dev/pts/", 9)); test_errors (fd, buffer); diff --git a/tests/test-quotearg-simple.c b/tests/test-quotearg-simple.c index 0f34922187..567fb5062f 100644 --- a/tests/test-quotearg-simple.c +++ b/tests/test-quotearg-simple.c @@ -367,7 +367,7 @@ main (_GL_UNUSED int argc, char *argv[]) a-time, and from left to right (no SEGV) or some other way. */ size_t n = quotearg_buffer (buf, sizeof buf, z, SIZE_MAX, NULL); ASSERT (n == s_len + 2 * q_len); - ASSERT (memcmp (buf, q, sizeof buf) == 0); + ASSERT (memeq (buf, q, sizeof buf)); free (q); } } diff --git a/tests/test-quotearg.h b/tests/test-quotearg.h index d91b0abf71..1d6dc16f0a 100644 --- a/tests/test-quotearg.h +++ b/tests/test-quotearg.h @@ -52,7 +52,7 @@ static void compare (char const *a, size_t la, char const *b, size_t lb) { ASSERT (la == lb); - ASSERT (memcmp (a, b, la) == 0); + ASSERT (memeq (a, b, la)); ASSERT (b[lb] == '\0'); } diff --git a/tests/test-read.c b/tests/test-read.c index e76d377be8..ff79d93176 100644 --- a/tests/test-read.c +++ b/tests/test-read.c @@ -47,7 +47,7 @@ main (void) char buf[10]; ssize_t ret = read (fd, buf, 10); ASSERT (ret == 5); - ASSERT (memcmp (buf, "World", 5) == 0); + ASSERT (memeq (buf, "World", 5)); } ASSERT (close (fd) == 0); diff --git a/tests/test-sh-quote.c b/tests/test-sh-quote.c index 6c23c1f57f..3383e665eb 100644 --- a/tests/test-sh-quote.c +++ b/tests/test-sh-quote.c @@ -44,7 +44,7 @@ check_one (const char *input, const char *expected) buf[output_len + 1] = '%'; bufend = shell_quote_copy (buf, input); ASSERT (bufend == buf + output_len); - ASSERT (memcmp (buf, output, output_len + 1) == 0); + ASSERT (memeq (buf, output, output_len + 1)); ASSERT (buf[output_len + 1] == '%'); ASSERT (streq (output, expected)); diff --git a/tests/test-sha3-224-buffer.c b/tests/test-sha3-224-buffer.c index 1a96e609a9..95f626a7b0 100644 --- a/tests/test-sha3-224-buffer.c +++ b/tests/test-sha3-224-buffer.c @@ -48,7 +48,7 @@ static int mismatch (char const expect[SHA3_224_DIGEST_SIZE], char const buf[SHA3_224_DIGEST_SIZE]) { - if (memcmp (expect, buf, SHA3_224_DIGEST_SIZE) == 0) + if (memeq (expect, buf, SHA3_224_DIGEST_SIZE)) return 0; printf ("expected:\n"); for (size_t i = 0; i < SHA3_224_DIGEST_SIZE; i++) diff --git a/tests/test-sha3-256-buffer.c b/tests/test-sha3-256-buffer.c index 27aa8d7573..d321136935 100644 --- a/tests/test-sha3-256-buffer.c +++ b/tests/test-sha3-256-buffer.c @@ -49,7 +49,7 @@ static int mismatch (char const expect[SHA3_256_DIGEST_SIZE], char const buf[SHA3_256_DIGEST_SIZE]) { - if (memcmp (expect, buf, SHA3_256_DIGEST_SIZE) == 0) + if (memeq (expect, buf, SHA3_256_DIGEST_SIZE)) return 0; printf ("expected:\n"); for (size_t i = 0; i < SHA3_256_DIGEST_SIZE; i++) diff --git a/tests/test-sha3-384-buffer.c b/tests/test-sha3-384-buffer.c index 9a9fdef76a..f3c4d33d07 100644 --- a/tests/test-sha3-384-buffer.c +++ b/tests/test-sha3-384-buffer.c @@ -53,7 +53,7 @@ static int mismatch (char const expect[SHA3_384_DIGEST_SIZE], char const buf[SHA3_384_DIGEST_SIZE]) { - if (memcmp (expect, buf, SHA3_384_DIGEST_SIZE) == 0) + if (memeq (expect, buf, SHA3_384_DIGEST_SIZE)) return 0; printf ("expected:\n"); for (size_t i = 0; i < SHA3_384_DIGEST_SIZE; i++) diff --git a/tests/test-sha3-512-buffer.c b/tests/test-sha3-512-buffer.c index 55af231c54..2ed63f1c41 100644 --- a/tests/test-sha3-512-buffer.c +++ b/tests/test-sha3-512-buffer.c @@ -57,7 +57,7 @@ static int mismatch (char const expect[SHA3_512_DIGEST_SIZE], char const buf[SHA3_512_DIGEST_SIZE]) { - if (memcmp (expect, buf, SHA3_512_DIGEST_SIZE) == 0) + if (memeq (expect, buf, SHA3_512_DIGEST_SIZE)) return 0; printf ("expected:\n"); for (size_t i = 0; i < SHA3_512_DIGEST_SIZE; i++) diff --git a/tests/test-snprintf-posix.h b/tests/test-snprintf-posix.h index 3fea570252..1fcf6b1d87 100644 --- a/tests/test-snprintf-posix.h +++ b/tests/test-snprintf-posix.h @@ -64,7 +64,7 @@ strisnan (const char *string, size_t start_index, size_t end_index, int uppercas if (string[start_index] == '-') start_index++; if (start_index + 3 <= end_index - && memcmp (string + start_index, uppercase ? "NAN" : "nan", 3) == 0) + && memeq (string + start_index, uppercase ? "NAN" : "nan", 3)) { start_index += 3; if (start_index == end_index @@ -94,14 +94,14 @@ test_function (int (*my_snprintf) (char *, size_t, const char *, ...)) { if (size > 0) { - ASSERT (memcmp (buf, "12345", size - 1) == 0); + ASSERT (memeq (buf, "12345", size - 1)); ASSERT (buf[size - 1] == '\0'); } - ASSERT (memcmp (buf + size, &"DEADBEEF"[size], 8 - size) == 0); + ASSERT (memeq (buf + size, &"DEADBEEF"[size], 8 - size)); } else { - ASSERT (memcmp (buf, "12345\0EF", 8) == 0); + ASSERT (memeq (buf, "12345\0EF", 8)); } } @@ -1647,7 +1647,7 @@ test_function (int (*my_snprintf) (char *, size_t, const char *, ...)) ASSERT (streq (result, expected) /* Some implementations produce exponents with 3 digits. */ || (strlen (result) == strlen (expected) + 1 - && memcmp (result, expected, strlen (expected) - 2) == 0 + && memeq (result, expected, strlen (expected) - 2) && result[strlen (expected) - 2] == '0' && streq (result + strlen (expected) - 1, expected + strlen (expected) - 2))); @@ -1938,7 +1938,7 @@ test_function (int (*my_snprintf) (char *, size_t, const char *, ...)) ASSERT (streq (result, expected) /* Some implementations produce exponents with 3 digits. */ || (strlen (result) == strlen (expected) + 1 - && memcmp (result, expected, strlen (expected) - 2) == 0 + && memeq (result, expected, strlen (expected) - 2) && result[strlen (expected) - 2] == '0' && streq (result + strlen (expected) - 1, expected + strlen (expected) - 2))); @@ -2295,7 +2295,7 @@ test_function (int (*my_snprintf) (char *, size_t, const char *, ...)) /* Some implementations produce exponents with 3 digits. */ || (expected[strlen (expected) - 4] == 'e' && strlen (result) == strlen (expected) + 1 - && memcmp (result, expected, strlen (expected) - 2) == 0 + && memeq (result, expected, strlen (expected) - 2) && result[strlen (expected) - 2] == '0' && streq (result + strlen (expected) - 1, expected + strlen (expected) - 2))); @@ -2572,7 +2572,7 @@ test_function (int (*my_snprintf) (char *, size_t, const char *, ...)) /* Some implementations produce exponents with 3 digits. */ || (expected[strlen (expected) - 4] == 'e' && strlen (result) == strlen (expected) + 1 - && memcmp (result, expected, strlen (expected) - 2) == 0 + && memeq (result, expected, strlen (expected) - 2) && result[strlen (expected) - 2] == '0' && streq (result + strlen (expected) - 1, expected + strlen (expected) - 2))); @@ -2964,7 +2964,7 @@ test_function (int (*my_snprintf) (char *, size_t, const char *, ...)) input[i] = 'a' + ((1000000 / (i + 1)) % 26); input[i] = '\0'; retval = my_snprintf (result, sizeof (result), "%.4000s %d", input, 99); - ASSERT (memcmp (result, input, 4000) == 0); + ASSERT (memeq (result, input, 4000)); ASSERT (streq (result + 4000, " 99")); ASSERT (retval == strlen (result)); } @@ -3040,7 +3040,7 @@ test_function (int (*my_snprintf) (char *, size_t, const char *, ...)) block = (char *) malloc (i); memcpy (block, "abcdefgh", i); retval = my_snprintf (result, sizeof (result), "%.*s", (int) i, block); - ASSERT (memcmp (result, block, i) == 0); + ASSERT (memeq (result, block, i)); ASSERT (result[i] == '\0'); ASSERT (retval == strlen (result)); free (block); @@ -3054,7 +3054,7 @@ test_function (int (*my_snprintf) (char *, size_t, const char *, ...)) for (size_t j = 0; j < i; j++) block[j] = "abcdefgh"[j]; retval = my_snprintf (result, sizeof (result), "%.*ls", (int) i, block); - ASSERT (memcmp (result, "abcdefgh", i) == 0); + ASSERT (memeq (result, "abcdefgh", i)); ASSERT (result[i] == '\0'); ASSERT (retval == strlen (result)); free (block); @@ -3106,7 +3106,7 @@ test_function (int (*my_snprintf) (char *, size_t, const char *, ...)) int retval = my_snprintf (result, sizeof (result), "a%cz %d", '\0', 33, 44, 55); - ASSERT (memcmp (result, "a\0z 33\0", 6 + 1) == 0); + ASSERT (memeq (result, "a\0z 33\0", 6 + 1)); ASSERT (retval == 6); } @@ -3158,7 +3158,7 @@ test_function (int (*my_snprintf) (char *, size_t, const char *, ...)) as if by a call to the wcrtomb function with a pointer to storage of at least MB_CUR_MAX bytes, the wint_t argument converted to wchar_t, and an initial shift state." */ - ASSERT (memcmp (result, "a\0z 33\0", 6 + 1) == 0); + ASSERT (memeq (result, "a\0z 33\0", 6 + 1)); ASSERT (retval == 6); } diff --git a/tests/test-snprintf.c b/tests/test-snprintf.c index d87c2f50af..d2176809f0 100644 --- a/tests/test-snprintf.c +++ b/tests/test-snprintf.c @@ -45,17 +45,17 @@ main () { if (size > 0) { - ASSERT (memcmp (buf, "12345", size - 1) == 0); + ASSERT (memeq (buf, "12345", size - 1)); ASSERT (buf[size - 1] == '\0' || buf[size - 1] == '0' + size); } #if !CHECK_SNPRINTF_POSIX if (size > 0) #endif - ASSERT (memcmp (buf + size, &"DEADBEEF"[size], 8 - size) == 0); + ASSERT (memeq (buf + size, &"DEADBEEF"[size], 8 - size)); } else { - ASSERT (memcmp (buf, "12345\0EF", 8) == 0); + ASSERT (memeq (buf, "12345\0EF", 8)); } } diff --git a/tests/test-snzprintf-posix.h b/tests/test-snzprintf-posix.h index 26d141c14e..e00b32961e 100644 --- a/tests/test-snzprintf-posix.h +++ b/tests/test-snzprintf-posix.h @@ -33,7 +33,7 @@ strisnan (const char *string, size_t start_index, size_t end_index, int uppercas if (string[start_index] == '-') start_index++; if (start_index + 3 <= end_index - && memcmp (string + start_index, uppercase ? "NAN" : "nan", 3) == 0) + && memeq (string + start_index, uppercase ? "NAN" : "nan", 3)) { start_index += 3; if (start_index == end_index diff --git a/tests/test-spawn-pipe-script.c b/tests/test-spawn-pipe-script.c index 041fe8baa8..9c6744fd43 100644 --- a/tests/test-spawn-pipe-script.c +++ b/tests/test-spawn-pipe-script.c @@ -88,7 +88,7 @@ main () ASSERT (fread (buffer, 1, sizeof (buffer), fp) == 11); /* Check the result. */ - ASSERT (memcmp (buffer, "Halle Potta", 11) == 0); + ASSERT (memeq (buffer, "Halle Potta", 11)); /* Wait for child. */ ASSERT (wait_subprocess (pid, progname, true, false, true, true, NULL) == 0); diff --git a/tests/test-sprintf-posix.h b/tests/test-sprintf-posix.h index 1abd0e41ae..112a1dabe5 100644 --- a/tests/test-sprintf-posix.h +++ b/tests/test-sprintf-posix.h @@ -64,7 +64,7 @@ strisnan (const char *string, size_t start_index, size_t end_index, int uppercas if (string[start_index] == '-') start_index++; if (start_index + 3 <= end_index - && memcmp (string + start_index, uppercase ? "NAN" : "nan", 3) == 0) + && memeq (string + start_index, uppercase ? "NAN" : "nan", 3)) { start_index += 3; if (start_index == end_index @@ -89,7 +89,7 @@ test_function (int (*my_sprintf) (char *, const char *, ...)) memcpy (buf, "DEADBEEF", 8); retval = my_sprintf (buf, "%d", 12345); ASSERT (retval == 5); - ASSERT (memcmp (buf, "12345\0EF", 8) == 0); + ASSERT (memeq (buf, "12345\0EF", 8)); } /* Test support of size specifiers as in C99. */ @@ -1634,7 +1634,7 @@ test_function (int (*my_sprintf) (char *, const char *, ...)) ASSERT (streq (result, expected) /* Some implementations produce exponents with 3 digits. */ || (strlen (result) == strlen (expected) + 1 - && memcmp (result, expected, strlen (expected) - 2) == 0 + && memeq (result, expected, strlen (expected) - 2) && result[strlen (expected) - 2] == '0' && streq (result + strlen (expected) - 1, expected + strlen (expected) - 2))); @@ -1925,7 +1925,7 @@ test_function (int (*my_sprintf) (char *, const char *, ...)) ASSERT (streq (result, expected) /* Some implementations produce exponents with 3 digits. */ || (strlen (result) == strlen (expected) + 1 - && memcmp (result, expected, strlen (expected) - 2) == 0 + && memeq (result, expected, strlen (expected) - 2) && result[strlen (expected) - 2] == '0' && streq (result + strlen (expected) - 1, expected + strlen (expected) - 2))); @@ -2282,7 +2282,7 @@ test_function (int (*my_sprintf) (char *, const char *, ...)) /* Some implementations produce exponents with 3 digits. */ || (expected[strlen (expected) - 4] == 'e' && strlen (result) == strlen (expected) + 1 - && memcmp (result, expected, strlen (expected) - 2) == 0 + && memeq (result, expected, strlen (expected) - 2) && result[strlen (expected) - 2] == '0' && streq (result + strlen (expected) - 1, expected + strlen (expected) - 2))); @@ -2559,7 +2559,7 @@ test_function (int (*my_sprintf) (char *, const char *, ...)) /* Some implementations produce exponents with 3 digits. */ || (expected[strlen (expected) - 4] == 'e' && strlen (result) == strlen (expected) + 1 - && memcmp (result, expected, strlen (expected) - 2) == 0 + && memeq (result, expected, strlen (expected) - 2) && result[strlen (expected) - 2] == '0' && streq (result + strlen (expected) - 1, expected + strlen (expected) - 2))); @@ -2951,7 +2951,7 @@ test_function (int (*my_sprintf) (char *, const char *, ...)) input[i] = 'a' + ((1000000 / (i + 1)) % 26); input[i] = '\0'; retval = my_sprintf (result, "%.4000s %d", input, 99); - ASSERT (memcmp (result, input, 4000) == 0); + ASSERT (memeq (result, input, 4000)); ASSERT (streq (result + 4000, " 99")); ASSERT (retval == strlen (result)); } @@ -3027,7 +3027,7 @@ test_function (int (*my_sprintf) (char *, const char *, ...)) block = (char *) malloc (i); memcpy (block, "abcdefgh", i); retval = my_sprintf (result, "%.*s", (int) i, block); - ASSERT (memcmp (result, block, i) == 0); + ASSERT (memeq (result, block, i)); ASSERT (result[i] == '\0'); ASSERT (retval == strlen (result)); free (block); @@ -3041,7 +3041,7 @@ test_function (int (*my_sprintf) (char *, const char *, ...)) for (size_t j = 0; j < i; j++) block[j] = "abcdefgh"[j]; retval = my_sprintf (result, "%.*ls", (int) i, block); - ASSERT (memcmp (result, "abcdefgh", i) == 0); + ASSERT (memeq (result, "abcdefgh", i)); ASSERT (result[i] == '\0'); ASSERT (retval == strlen (result)); free (block); @@ -3087,7 +3087,7 @@ test_function (int (*my_sprintf) (char *, const char *, ...)) { /* NUL character. */ int retval = my_sprintf (result, "a%cz %d", '\0', 33, 44, 55); - ASSERT (memcmp (result, "a\0z 33\0", 6 + 1) == 0); + ASSERT (memeq (result, "a\0z 33\0", 6 + 1)); ASSERT (retval == 6); } @@ -3141,7 +3141,7 @@ test_function (int (*my_sprintf) (char *, const char *, ...)) - on musl libc, - with GCC 14.1, 13.2, 12.3, and 11.4 */ - ASSERT (memcmp (result, "a\0z 33\0", 6 + 1) == 0); + ASSERT (memeq (result, "a\0z 33\0", 6 + 1)); ASSERT (retval == 6); } diff --git a/tests/test-striconv.c b/tests/test-striconv.c index a1f7f55f5a..e44468d7f1 100644 --- a/tests/test-striconv.c +++ b/tests/test-striconv.c @@ -54,7 +54,7 @@ main () &result, &length); ASSERT (retval == 0); ASSERT (length == strlen (expected)); - ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); + ASSERT (result != NULL && memeq (result, expected, strlen (expected))); free (result); } @@ -68,7 +68,7 @@ main () &result, &length); ASSERT (retval == 0); ASSERT (length == strlen (expected)); - ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); + ASSERT (result != NULL && memeq (result, expected, strlen (expected))); free (result); } diff --git a/tests/test-striconveh.c b/tests/test-striconveh.c index e98b62c3e0..15cc3a2d28 100644 --- a/tests/test-striconveh.c +++ b/tests/test-striconveh.c @@ -164,7 +164,7 @@ main () &result, &length); ASSERT (retval == 0); ASSERT (length == strlen (expected)); - ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); + ASSERT (result != NULL && memeq (result, expected, strlen (expected))); if (o) { for (size_t i = 0; i < 37; i++) @@ -211,7 +211,7 @@ main () static const char expected[] = "Rafa? Maszkowski"; ASSERT (retval == 0); ASSERT (length == strlen (expected)); - ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); + ASSERT (result != NULL && memeq (result, expected, strlen (expected))); if (o) { for (size_t i = 0; i < 16; i++) @@ -260,7 +260,7 @@ main () static const char expected[] = "Rafa? Maszkowski"; ASSERT (retval == 0); ASSERT (length == strlen (expected)); - ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); + ASSERT (result != NULL && memeq (result, expected, strlen (expected))); if (o) { for (size_t i = 0; i < 16; i++) @@ -276,7 +276,7 @@ main () static const char expected[] = "Rafa\\u0142 Maszkowski"; ASSERT (retval == 0); ASSERT (length == strlen (expected)); - ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); + ASSERT (result != NULL && memeq (result, expected, strlen (expected))); if (o) { for (size_t i = 0; i < 16; i++) @@ -311,7 +311,7 @@ main () &result, &length); ASSERT (retval == 0); ASSERT (length == strlen (expected)); - ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); + ASSERT (result != NULL && memeq (result, expected, strlen (expected))); if (o) { for (size_t i = 0; i < 37; i++) @@ -345,7 +345,7 @@ main () &result, &length); ASSERT (retval == 0); ASSERT (length == strlen (expected)); - ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); + ASSERT (result != NULL && memeq (result, expected, strlen (expected))); if (o) { for (size_t i = 0; i < 37; i++) @@ -379,7 +379,7 @@ main () &result, &length); ASSERT (retval == 0); ASSERT (length == strlen (expected)); - ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); + ASSERT (result != NULL && memeq (result, expected, strlen (expected))); if (o) { for (size_t i = 0; i < 41; i++) @@ -427,7 +427,7 @@ main () static const char expected[] = "Rafa? Maszkowski"; ASSERT (retval == 0); ASSERT (length == strlen (expected)); - ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); + ASSERT (result != NULL && memeq (result, expected, strlen (expected))); if (o) { for (size_t i = 0; i < 16; i++) @@ -443,7 +443,7 @@ main () static const char expected[] = "Rafa\357\277\275 Maszkowski"; ASSERT (retval == 0); ASSERT (length == strlen (expected)); - ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); + ASSERT (result != NULL && memeq (result, expected, strlen (expected))); if (o) { for (size_t i = 0; i < 16; i++) @@ -490,7 +490,7 @@ main () static const char expected[] = "Rafa? Maszkowski"; ASSERT (retval == 0); ASSERT (length == strlen (expected)); - ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); + ASSERT (result != NULL && memeq (result, expected, strlen (expected))); if (o) { for (size_t i = 0; i < 16; i++) @@ -506,7 +506,7 @@ main () static const char expected[] = "Rafa\2041\2447 Maszkowski"; ASSERT (retval == 0); ASSERT (length == strlen (expected)); - ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); + ASSERT (result != NULL && memeq (result, expected, strlen (expected))); if (o) { for (size_t i = 0; i < 16; i++) @@ -551,7 +551,7 @@ main () static const char expected[] = "Rafa? Maszkowski"; ASSERT (retval == 0); ASSERT (length == strlen (expected)); - ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); + ASSERT (result != NULL && memeq (result, expected, strlen (expected))); if (o) { for (size_t i = 0; i < 17; i++) @@ -569,7 +569,7 @@ main () static const char expected[] = "Rafa\\u0142 Maszkowski"; ASSERT (retval == 0); ASSERT (length == strlen (expected)); - ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); + ASSERT (result != NULL && memeq (result, expected, strlen (expected))); if (o) { for (size_t i = 0; i < 17; i++) @@ -638,9 +638,9 @@ main () ASSERT (length == strlen (expected1) || length == strlen (expected2)); ASSERT (result != NULL); if (length == strlen (expected1)) - ASSERT (memcmp (result, expected1, strlen (expected1)) == 0); + ASSERT (memeq (result, expected1, strlen (expected1))); else - ASSERT (memcmp (result, expected2, strlen (expected2)) == 0); + ASSERT (memeq (result, expected2, strlen (expected2))); free (result); } @@ -665,9 +665,9 @@ main () ASSERT (length == strlen (expected1) || length == strlen (expected2)); ASSERT (result != NULL); if (length == strlen (expected1)) - ASSERT (memcmp (result, expected1, strlen (expected1)) == 0); + ASSERT (memeq (result, expected1, strlen (expected1))); else - ASSERT (memcmp (result, expected2, strlen (expected2)) == 0); + ASSERT (memeq (result, expected2, strlen (expected2))); free (result); } # endif @@ -712,11 +712,11 @@ main () || length == strlen (expected3)); ASSERT (result != NULL); if (length == strlen (expected1)) - ASSERT (memcmp (result, expected1, strlen (expected1)) == 0); + ASSERT (memeq (result, expected1, strlen (expected1))); else if (length == strlen (expected2)) - ASSERT (memcmp (result, expected2, strlen (expected2)) == 0); + ASSERT (memeq (result, expected2, strlen (expected2))); else - ASSERT (memcmp (result, expected3, strlen (expected3)) == 0); + ASSERT (memeq (result, expected3, strlen (expected3))); free (result); } break; @@ -734,11 +734,11 @@ main () || length == strlen (expected3)); ASSERT (result != NULL); if (length == strlen (expected1)) - ASSERT (memcmp (result, expected1, strlen (expected1)) == 0); + ASSERT (memeq (result, expected1, strlen (expected1))); else if (length == strlen (expected2)) - ASSERT (memcmp (result, expected2, strlen (expected2)) == 0); + ASSERT (memeq (result, expected2, strlen (expected2))); else - ASSERT (memcmp (result, expected3, strlen (expected3)) == 0); + ASSERT (memeq (result, expected3, strlen (expected3))); free (result); } } @@ -784,10 +784,10 @@ main () || length == strlen (expected3)); ASSERT (result != NULL); if (length == strlen (expected1)) - ASSERT (memcmp (result, expected1, strlen (expected1)) == 0); + ASSERT (memeq (result, expected1, strlen (expected1))); else if (length == strlen (expected2)) - ASSERT (memcmp (result, expected2, strlen (expected2)) == 0 - || memcmp (result, expected3, strlen (expected3)) == 0); + ASSERT (memeq (result, expected2, strlen (expected2)) + || memeq (result, expected3, strlen (expected3))); free (result); } break; @@ -805,10 +805,10 @@ main () || length == strlen (expected3)); ASSERT (result != NULL); if (length == strlen (expected1)) - ASSERT (memcmp (result, expected1, strlen (expected1)) == 0); + ASSERT (memeq (result, expected1, strlen (expected1))); else if (length == strlen (expected2)) - ASSERT (memcmp (result, expected2, strlen (expected2)) == 0 - || memcmp (result, expected3, strlen (expected3)) == 0); + ASSERT (memeq (result, expected2, strlen (expected2)) + || memeq (result, expected3, strlen (expected3))); free (result); } } @@ -1097,7 +1097,7 @@ main () &result, &length); ASSERT (retval == 0); ASSERT (length == strlen (expected)); - ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); + ASSERT (result != NULL && memeq (result, expected, strlen (expected))); if (o) { for (size_t i = 0; i < 37; i++) @@ -1138,7 +1138,7 @@ main () static const char expected[] = "Rafa? Maszkowski"; ASSERT (retval == 0); ASSERT (length == strlen (expected)); - ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); + ASSERT (result != NULL && memeq (result, expected, strlen (expected))); if (o) { for (size_t i = 0; i < 16; i++) @@ -1154,7 +1154,7 @@ main () static const char expected[] = "Rafa\\u0142 Maszkowski"; ASSERT (retval == 0); ASSERT (length == strlen (expected)); - ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); + ASSERT (result != NULL && memeq (result, expected, strlen (expected))); if (o) { for (size_t i = 0; i < 16; i++) @@ -1188,7 +1188,7 @@ main () &result, &length); ASSERT (retval == 0); ASSERT (length == strlen (expected)); - ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); + ASSERT (result != NULL && memeq (result, expected, strlen (expected))); if (o) { for (size_t i = 0; i < 37; i++) @@ -1222,7 +1222,7 @@ main () &result, &length); ASSERT (retval == 0); ASSERT (length == strlen (expected)); - ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); + ASSERT (result != NULL && memeq (result, expected, strlen (expected))); if (o) { for (size_t i = 0; i < 37; i++) @@ -1256,7 +1256,7 @@ main () &result, &length); ASSERT (retval == 0); ASSERT (length == strlen (expected)); - ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); + ASSERT (result != NULL && memeq (result, expected, strlen (expected))); if (o) { for (size_t i = 0; i < 41; i++) @@ -1304,7 +1304,7 @@ main () static const char expected[] = "Rafa? Maszkowski"; ASSERT (retval == 0); ASSERT (length == strlen (expected)); - ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); + ASSERT (result != NULL && memeq (result, expected, strlen (expected))); if (o) { for (size_t i = 0; i < 17; i++) @@ -1322,7 +1322,7 @@ main () static const char expected[] = "Rafa\\u0142 Maszkowski"; ASSERT (retval == 0); ASSERT (length == strlen (expected)); - ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); + ASSERT (result != NULL && memeq (result, expected, strlen (expected))); if (o) { for (size_t i = 0; i < 17; i++) diff --git a/tests/test-striconveha.c b/tests/test-striconveha.c index a382bd18e2..b31aa9aae3 100644 --- a/tests/test-striconveha.c +++ b/tests/test-striconveha.c @@ -72,7 +72,7 @@ main () &result, &length); ASSERT (retval == 0); ASSERT (length == strlen (expected)); - ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); + ASSERT (result != NULL && memeq (result, expected, strlen (expected))); if (o) { for (size_t i = 0; i < 37; i++) @@ -112,7 +112,7 @@ main () static const char expected[] = "Rafa? Maszkowski"; ASSERT (retval == 0); ASSERT (length == strlen (expected)); - ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); + ASSERT (result != NULL && memeq (result, expected, strlen (expected))); if (o) { for (size_t i = 0; i < 16; i++) @@ -128,7 +128,7 @@ main () static const char expected[] = "Rafa\\u0142 Maszkowski"; ASSERT (retval == 0); ASSERT (length == strlen (expected)); - ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); + ASSERT (result != NULL && memeq (result, expected, strlen (expected))); if (o) { for (size_t i = 0; i < 16; i++) @@ -162,7 +162,7 @@ main () &result, &length); ASSERT (retval == 0); ASSERT (length == strlen (expected)); - ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); + ASSERT (result != NULL && memeq (result, expected, strlen (expected))); if (o) { for (size_t i = 0; i < 37; i++) @@ -195,7 +195,7 @@ main () &result, &length); ASSERT (retval == 0); ASSERT (length == strlen (expected)); - ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); + ASSERT (result != NULL && memeq (result, expected, strlen (expected))); if (o) { for (size_t i = 0; i < 41; i++) @@ -242,7 +242,7 @@ main () static const char expected[] = "Rafa? Maszkowski"; ASSERT (retval == 0); ASSERT (length == strlen (expected)); - ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); + ASSERT (result != NULL && memeq (result, expected, strlen (expected))); if (o) { for (size_t i = 0; i < 17; i++) @@ -260,7 +260,7 @@ main () static const char expected[] = "Rafa\\u0142 Maszkowski"; ASSERT (retval == 0); ASSERT (length == strlen (expected)); - ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); + ASSERT (result != NULL && memeq (result, expected, strlen (expected))); if (o) { for (size_t i = 0; i < 17; i++) @@ -327,7 +327,7 @@ main () &result, &length); ASSERT (retval == 0); ASSERT (length == strlen (expected)); - ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); + ASSERT (result != NULL && memeq (result, expected, strlen (expected))); if (o) { for (size_t i = 0; i < 10; i++) @@ -355,7 +355,7 @@ main () &result, &length); ASSERT (retval == 0); ASSERT (length == strlen (expected)); - ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); + ASSERT (result != NULL && memeq (result, expected, strlen (expected))); if (o) { for (size_t i = 0; i < 10; i++) @@ -383,7 +383,7 @@ main () &result, &length); ASSERT (retval == 0); ASSERT (length == strlen (expected)); - ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); + ASSERT (result != NULL && memeq (result, expected, strlen (expected))); if (o) { for (size_t i = 0; i < 16; i++) @@ -422,7 +422,7 @@ main () &result, &length); ASSERT (retval == 0); ASSERT (length == strlen (expected)); - ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0); + ASSERT (result != NULL && memeq (result, expected, strlen (expected))); if (o) { for (size_t i = 0; i < 13; i++) diff --git a/tests/test-string-buffer-reversed.c b/tests/test-string-buffer-reversed.c index 898ba1c46f..c46f37fded 100644 --- a/tests/test-string-buffer-reversed.c +++ b/tests/test-string-buffer-reversed.c @@ -90,7 +90,7 @@ main () ASSERT (sd_char_at (sd, 3) == '\377'); } char *s = sbr_dupfree_c (&buffer); - ASSERT (s != NULL && memcmp (s, "z\0x\377\0", 5) == 0); + ASSERT (s != NULL && memeq (s, "z\0x\377\0", 5)); free (s); } @@ -124,7 +124,7 @@ main () sbr_prepend_desc (&buffer, sd_new_addr (5, "de\0fg")); sbr_prepend_c (&buffer, "abc"); char *s = sbr_dupfree_c (&buffer); - ASSERT (s != NULL && memcmp (s, "abcde\0fghij", 12) == 0); + ASSERT (s != NULL && memeq (s, "abcde\0fghij", 12)); free (s); } diff --git a/tests/test-string-buffer.c b/tests/test-string-buffer.c index 2aabd665be..5182c2bab8 100644 --- a/tests/test-string-buffer.c +++ b/tests/test-string-buffer.c @@ -89,7 +89,7 @@ main () ASSERT (sd_char_at (sd, 3) == 'z'); } char *s = sb_dupfree_c (&buffer); - ASSERT (s != NULL && memcmp (s, "x\377\0z\0", 5) == 0); + ASSERT (s != NULL && memeq (s, "x\377\0z\0", 5)); free (s); } @@ -123,7 +123,7 @@ main () sb_append_desc (&buffer, sd_new_addr (5, "de\0fg")); sb_append_c (&buffer, "hij"); char *s = sb_dupfree_c (&buffer); - ASSERT (s != NULL && memcmp (s, "abcde\0fghij", 12) == 0); + ASSERT (s != NULL && memeq (s, "abcde\0fghij", 12)); free (s); } diff --git a/tests/test-string-desc-quotearg.c b/tests/test-string-desc-quotearg.c index b380b2d879..26113d6e48 100644 --- a/tests/test-string-desc-quotearg.c +++ b/tests/test-string-desc-quotearg.c @@ -36,7 +36,7 @@ main (void) char buf[80]; size_t n = sd_quotearg_buffer (buf, sizeof (buf), s2, NULL); ASSERT (n == 21); - ASSERT (memcmp (buf, "The\0quick\0brown\0\0fox", n) == 0); + ASSERT (memeq (buf, "The\0quick\0brown\0\0fox", n)); } /* Test sd_quotearg_alloc. */ @@ -44,60 +44,60 @@ main (void) size_t n; char *ret = sd_quotearg_alloc (s2, &n, NULL); ASSERT (n == 21); - ASSERT (memcmp (ret, "The\0quick\0brown\0\0fox", n) == 0); + ASSERT (memeq (ret, "The\0quick\0brown\0\0fox", n)); free (ret); } /* Test sd_quotearg_n. */ { char *ret = sd_quotearg_n (1, s2); - ASSERT (memcmp (ret, "Thequickbrownfox", 16 + 1) == 0); + ASSERT (memeq (ret, "Thequickbrownfox", 16 + 1)); } /* Test sd_quotearg. */ { char *ret = sd_quotearg (s2); - ASSERT (memcmp (ret, "Thequickbrownfox", 16 + 1) == 0); + ASSERT (memeq (ret, "Thequickbrownfox", 16 + 1)); } /* Test sd_quotearg_n_style. */ { char *ret = sd_quotearg_n_style (1, clocale_quoting_style, s2); - ASSERT (memcmp (ret, "\"The\\0quick\\0brown\\0\\0fox\\0\"", 28 + 1) == 0 + ASSERT (memeq (ret, "\"The\\0quick\\0brown\\0\\0fox\\0\"", 28 + 1) || /* if the locale has UTF-8 encoding */ - memcmp (ret, "\342\200\230The\\0quick\\0brown\\0\\0fox\\0\342\200\231", 32 + 1) == 0); + memeq (ret, "\342\200\230The\\0quick\\0brown\\0\\0fox\\0\342\200\231", 32 + 1)); } /* Test sd_quotearg_style. */ { char *ret = sd_quotearg_style (clocale_quoting_style, s2); - ASSERT (memcmp (ret, "\"The\\0quick\\0brown\\0\\0fox\\0\"", 28 + 1) == 0 + ASSERT (memeq (ret, "\"The\\0quick\\0brown\\0\\0fox\\0\"", 28 + 1) || /* if the locale has UTF-8 encoding */ - memcmp (ret, "\342\200\230The\\0quick\\0brown\\0\\0fox\\0\342\200\231", 32 + 1) == 0); + memeq (ret, "\342\200\230The\\0quick\\0brown\\0\\0fox\\0\342\200\231", 32 + 1)); } /* Test sd_quotearg_char. */ { char *ret = sd_quotearg_char (s1, ' '); - ASSERT (memcmp (ret, "Hello world!", 12 + 1) == 0); /* ' ' not quoted?! */ + ASSERT (memeq (ret, "Hello world!", 12 + 1)); /* ' ' not quoted?! */ } /* Test sd_quotearg_colon. */ { char *ret = sd_quotearg_colon (sd_from_c ("a:b")); - ASSERT (memcmp (ret, "a:b", 3 + 1) == 0); /* ':' not quoted?! */ + ASSERT (memeq (ret, "a:b", 3 + 1)); /* ':' not quoted?! */ } /* Test sd_quotearg_n_custom. */ { char *ret = sd_quotearg_n_custom (2, "<", ">", s1); - ASSERT (memcmp (ret, "", 14 + 1) == 0); + ASSERT (memeq (ret, "", 14 + 1)); } /* Test sd_quotearg_n_custom. */ { char *ret = sd_quotearg_custom ("[[", "]]", s1); - ASSERT (memcmp (ret, "[[Hello world!]]", 16 + 1) == 0); + ASSERT (memeq (ret, "[[Hello world!]]", 16 + 1)); } return test_exit_status; diff --git a/tests/test-string-desc.c b/tests/test-string-desc.c index e2462c41b5..97cc16e8a3 100644 --- a/tests/test-string-desc.c +++ b/tests/test-string-desc.c @@ -56,8 +56,8 @@ main (int argc, char *argv[]) /* Test sd_data. */ (void) sd_data (s0); - ASSERT (memcmp (sd_data (s1), "Hello world!", 12) == 0); - ASSERT (memcmp (sd_data (s2), "The\0quick\0brown\0\0fox", 21) == 0); + ASSERT (memeq (sd_data (s1), "Hello world!", 12)); + ASSERT (memeq (sd_data (s2), "The\0quick\0brown\0\0fox", 21)); /* Test sd_is_empty. */ ASSERT (sd_is_empty (s0)); @@ -201,7 +201,7 @@ main (int argc, char *argv[]) { char *ptr = sd_c (s2); ASSERT (ptr != NULL); - ASSERT (memcmp (ptr, "The\0quick\0brown\0\0fox\0", 22) == 0); + ASSERT (memeq (ptr, "The\0quick\0brown\0\0fox\0", 22)); free (ptr); } diff --git a/tests/test-supersede-fopen.h b/tests/test-supersede-fopen.h index bb95cb71c9..d5f732c3cc 100644 --- a/tests/test-supersede-fopen.h +++ b/tests/test-supersede-fopen.h @@ -47,7 +47,7 @@ test_fopen_supersede (bool supersede_if_exists, bool supersede_if_does_not_exist size_t file_size; char *file_contents = read_file (filename, RF_BINARY, &file_size); ASSERT (file_size == 12); - ASSERT (memcmp (file_contents, "Hello world\n", 12) == 0); + ASSERT (memeq (file_contents, "Hello world\n", 12)); } /* Test the case that the file exists and is a regular file. */ @@ -70,12 +70,12 @@ test_fopen_supersede (bool supersede_if_exists, bool supersede_if_does_not_exist if (supersede_if_exists) { ASSERT (file_size == 12); - ASSERT (memcmp (file_contents, "Hello world\n", 12) == 0); + ASSERT (memeq (file_contents, "Hello world\n", 12)); } else { ASSERT (file_size == 7); - ASSERT (memcmp (file_contents, "Foobar\n", 7) == 0); + ASSERT (memeq (file_contents, "Foobar\n", 7)); } } ASSERT (fclose_supersede (fp, &action) == 0); @@ -85,7 +85,7 @@ test_fopen_supersede (bool supersede_if_exists, bool supersede_if_does_not_exist size_t file_size; char *file_contents = read_file (filename, RF_BINARY, &file_size); ASSERT (file_size == 7); - ASSERT (memcmp (file_contents, "Foobar\n", 7) == 0); + ASSERT (memeq (file_contents, "Foobar\n", 7)); if (supersede_if_exists) { @@ -94,7 +94,7 @@ test_fopen_supersede (bool supersede_if_exists, bool supersede_if_does_not_exist #if !(defined _WIN32 && !defined __CYGWIN__) /* Note: On Linux/mips, statbuf.st_dev is smaller than a dev_t! */ dev_t new_dev = statbuf.st_dev; - ASSERT (memcmp (&orig_dev, &new_dev, sizeof (dev_t)) == 0); + ASSERT (memeq (&orig_dev, &new_dev, sizeof (dev_t))); ASSERT (memcmp (&orig_ino, &statbuf.st_ino, sizeof (ino_t)) != 0); #endif } @@ -142,12 +142,12 @@ test_fopen_supersede (bool supersede_if_exists, bool supersede_if_does_not_exist if (supersede_if_exists) { ASSERT (file_size == 7); - ASSERT (memcmp (file_contents, "Foobar\n", 7) == 0); + ASSERT (memeq (file_contents, "Foobar\n", 7)); } else { ASSERT (file_size == 4); - ASSERT (memcmp (file_contents, "New\n", 4) == 0); + ASSERT (memeq (file_contents, "New\n", 4)); } } ASSERT (fclose_supersede (fp, &action) == 0); @@ -157,7 +157,7 @@ test_fopen_supersede (bool supersede_if_exists, bool supersede_if_does_not_exist size_t file_size; char *file_contents = read_file (linkname, RF_BINARY, &file_size); ASSERT (file_size == 4); - ASSERT (memcmp (file_contents, "New\n", 4) == 0); + ASSERT (memeq (file_contents, "New\n", 4)); if (supersede_if_exists) { @@ -166,7 +166,7 @@ test_fopen_supersede (bool supersede_if_exists, bool supersede_if_does_not_exist #if !(defined _WIN32 && !defined __CYGWIN__) /* Note: On Linux/mips, statbuf.st_dev is smaller than a dev_t! */ dev_t new_dev = statbuf.st_dev; - ASSERT (memcmp (&orig_dev, &new_dev, sizeof (dev_t)) == 0); + ASSERT (memeq (&orig_dev, &new_dev, sizeof (dev_t))); ASSERT (memcmp (&orig_ino, &statbuf.st_ino, sizeof (ino_t)) != 0); #endif } @@ -232,7 +232,7 @@ test_fopen_supersede (bool supersede_if_exists, bool supersede_if_does_not_exist size_t file_size; char *file_contents = read_file (linkname, RF_BINARY, &file_size); ASSERT (file_size == 12); - ASSERT (memcmp (file_contents, "Hello world\n", 12) == 0); + ASSERT (memeq (file_contents, "Hello world\n", 12)); /* Clean up. */ unlink (linkname); diff --git a/tests/test-supersede-open.h b/tests/test-supersede-open.h index 6d4f629a5f..3c19fc6b2e 100644 --- a/tests/test-supersede-open.h +++ b/tests/test-supersede-open.h @@ -46,7 +46,7 @@ test_open_supersede (bool supersede_if_exists, bool supersede_if_does_not_exist) size_t file_size; char *file_contents = read_file (filename, RF_BINARY, &file_size); ASSERT (file_size == 12); - ASSERT (memcmp (file_contents, "Hello world\n", 12) == 0); + ASSERT (memeq (file_contents, "Hello world\n", 12)); } /* Test the case that the file exists and is a regular file. */ @@ -68,12 +68,12 @@ test_open_supersede (bool supersede_if_exists, bool supersede_if_does_not_exist) if (supersede_if_exists) { ASSERT (file_size == 12); - ASSERT (memcmp (file_contents, "Hello world\n", 12) == 0); + ASSERT (memeq (file_contents, "Hello world\n", 12)); } else { ASSERT (file_size == 7); - ASSERT (memcmp (file_contents, "Foobar\n", 7) == 0); + ASSERT (memeq (file_contents, "Foobar\n", 7)); } } ASSERT (close_supersede (fd, &action) == 0); @@ -83,7 +83,7 @@ test_open_supersede (bool supersede_if_exists, bool supersede_if_does_not_exist) size_t file_size; char *file_contents = read_file (filename, RF_BINARY, &file_size); ASSERT (file_size == 7); - ASSERT (memcmp (file_contents, "Foobar\n", 7) == 0); + ASSERT (memeq (file_contents, "Foobar\n", 7)); if (supersede_if_exists) { @@ -92,7 +92,7 @@ test_open_supersede (bool supersede_if_exists, bool supersede_if_does_not_exist) #if !(defined _WIN32 && !defined __CYGWIN__) /* Note: On Linux/mips, statbuf.st_dev is smaller than a dev_t! */ dev_t new_dev = statbuf.st_dev; - ASSERT (memcmp (&orig_dev, &new_dev, sizeof (dev_t)) == 0); + ASSERT (memeq (&orig_dev, &new_dev, sizeof (dev_t))); ASSERT (memcmp (&orig_ino, &statbuf.st_ino, sizeof (ino_t)) != 0); #endif } @@ -139,12 +139,12 @@ test_open_supersede (bool supersede_if_exists, bool supersede_if_does_not_exist) if (supersede_if_exists) { ASSERT (file_size == 7); - ASSERT (memcmp (file_contents, "Foobar\n", 7) == 0); + ASSERT (memeq (file_contents, "Foobar\n", 7)); } else { ASSERT (file_size == 4); - ASSERT (memcmp (file_contents, "New\n", 4) == 0); + ASSERT (memeq (file_contents, "New\n", 4)); } } ASSERT (close_supersede (fd, &action) == 0); @@ -154,7 +154,7 @@ test_open_supersede (bool supersede_if_exists, bool supersede_if_does_not_exist) size_t file_size; char *file_contents = read_file (linkname, RF_BINARY, &file_size); ASSERT (file_size == 4); - ASSERT (memcmp (file_contents, "New\n", 4) == 0); + ASSERT (memeq (file_contents, "New\n", 4)); if (supersede_if_exists) { @@ -163,7 +163,7 @@ test_open_supersede (bool supersede_if_exists, bool supersede_if_does_not_exist) #if !(defined _WIN32 && !defined __CYGWIN__) /* Note: On Linux/mips, statbuf.st_dev is smaller than a dev_t! */ dev_t new_dev = statbuf.st_dev; - ASSERT (memcmp (&orig_dev, &new_dev, sizeof (dev_t)) == 0); + ASSERT (memeq (&orig_dev, &new_dev, sizeof (dev_t))); ASSERT (memcmp (&orig_ino, &statbuf.st_ino, sizeof (ino_t)) != 0); #endif } @@ -229,7 +229,7 @@ test_open_supersede (bool supersede_if_exists, bool supersede_if_does_not_exist) size_t file_size; char *file_contents = read_file (linkname, RF_BINARY, &file_size); ASSERT (file_size == 12); - ASSERT (memcmp (file_contents, "Hello world\n", 12) == 0); + ASSERT (memeq (file_contents, "Hello world\n", 12)); /* Clean up. */ unlink (linkname); diff --git a/tests/test-system-quote-main.c b/tests/test-system-quote-main.c index 6e7fbe9ba6..f7e7c2c1a8 100644 --- a/tests/test-system-quote-main.c +++ b/tests/test-system-quote-main.c @@ -58,7 +58,7 @@ check_one (enum system_command_interpreter interpreter, const char *prog, buf[output_len + 1] = '%'; bufend = system_quote_copy (buf, interpreter, input); ASSERT (bufend == buf + output_len); - ASSERT (memcmp (buf, output, output_len + 1) == 0); + ASSERT (memeq (buf, output, output_len + 1)); ASSERT (buf[output_len + 1] == '%'); /* Store INPUT in EXPECTED_DATA_FILE, for verification by the child diff --git a/tests/test-szprintf-posix.h b/tests/test-szprintf-posix.h index 8d017796ff..9684092138 100644 --- a/tests/test-szprintf-posix.h +++ b/tests/test-szprintf-posix.h @@ -33,7 +33,7 @@ strisnan (const char *string, size_t start_index, size_t end_index, int uppercas if (string[start_index] == '-') start_index++; if (start_index + 3 <= end_index - && memcmp (string + start_index, uppercase ? "NAN" : "nan", 3) == 0) + && memeq (string + start_index, uppercase ? "NAN" : "nan", 3)) { start_index += 3; if (start_index == end_index diff --git a/tests/test-ttyname_r.c b/tests/test-ttyname_r.c index a2f1cc3631..51e1742e68 100644 --- a/tests/test-ttyname_r.c +++ b/tests/test-ttyname_r.c @@ -45,7 +45,7 @@ main (void) ASSERT (ttyname_r (fd, buf, 1) == ERANGE); ASSERT (ttyname_r (fd, buf, sizeof (buf)) == 0); - ASSERT (memcmp (buf, "/dev/", 5) == 0); + ASSERT (memeq (buf, "/dev/", 5)); /* Test behaviour for invalid file descriptors. */ { diff --git a/tests/test-vasnprintf-posix.c b/tests/test-vasnprintf-posix.c index d4ea779ea7..7a48bcc96c 100644 --- a/tests/test-vasnprintf-posix.c +++ b/tests/test-vasnprintf-posix.c @@ -78,7 +78,7 @@ strisnan (const char *string, size_t start_index, size_t end_index, int uppercas if (string[start_index] == '-') start_index++; if (start_index + 3 <= end_index - && memcmp (string + start_index, uppercase ? "NAN" : "nan", 3) == 0) + && memeq (string + start_index, uppercase ? "NAN" : "nan", 3)) { start_index += 3; if (start_index == end_index @@ -119,7 +119,7 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...)) ASSERT (length == 5); if (size < 6) ASSERT (result != buf); - ASSERT (memcmp (buf + size, &"DEADBEEF"[size], 8 - size) == 0); + ASSERT (memeq (buf + size, &"DEADBEEF"[size], 8 - size)); if (result != buf) free (result); } @@ -2125,7 +2125,7 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...)) ASSERT (streq (result, expected) /* Some implementations produce exponents with 3 digits. */ || (strlen (result) == strlen (expected) + 1 - && memcmp (result, expected, strlen (expected) - 2) == 0 + && memeq (result, expected, strlen (expected) - 2) && result[strlen (expected) - 2] == '0' && streq (result + strlen (expected) - 1, expected + strlen (expected) - 2))); @@ -2491,7 +2491,7 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...)) ASSERT (streq (result, expected) /* Some implementations produce exponents with 3 digits. */ || (strlen (result) == strlen (expected) + 1 - && memcmp (result, expected, strlen (expected) - 2) == 0 + && memeq (result, expected, strlen (expected) - 2) && result[strlen (expected) - 2] == '0' && streq (result + strlen (expected) - 1, expected + strlen (expected) - 2))); @@ -2940,7 +2940,7 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...)) /* Some implementations produce exponents with 3 digits. */ || (expected[strlen (expected) - 4] == 'e' && strlen (result) == strlen (expected) + 1 - && memcmp (result, expected, strlen (expected) - 2) == 0 + && memeq (result, expected, strlen (expected) - 2) && result[strlen (expected) - 2] == '0' && streq (result + strlen (expected) - 1, expected + strlen (expected) - 2))); @@ -3292,7 +3292,7 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...)) /* Some implementations produce exponents with 3 digits. */ || (expected[strlen (expected) - 4] == 'e' && strlen (result) == strlen (expected) + 1 - && memcmp (result, expected, strlen (expected) - 2) == 0 + && memeq (result, expected, strlen (expected) - 2) && result[strlen (expected) - 2] == '0' && streq (result + strlen (expected) - 1, expected + strlen (expected) - 2))); @@ -3819,7 +3819,7 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...)) input[i] = '\0'; result = my_asnprintf (NULL, &length, "%.4000s %d", input, 99); ASSERT (result != NULL); - ASSERT (memcmp (result, input, 4000) == 0); + ASSERT (memeq (result, input, 4000)); ASSERT (streq (result + 4000, " 99")); ASSERT (length == strlen (result)); free (result); @@ -3922,7 +3922,7 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...)) memcpy (block, "abcdefgh", i); result = my_asnprintf (NULL, &length, "%.*s", (int) i, block); ASSERT (result != NULL); - ASSERT (memcmp (result, block, i) == 0); + ASSERT (memeq (result, block, i)); ASSERT (result[i] == '\0'); ASSERT (length == strlen (result)); free (result); @@ -3939,7 +3939,7 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...)) block[j] = "abcdefgh"[j]; result = my_asnprintf (NULL, &length, "%.*ls", (int) i, block); ASSERT (result != NULL); - ASSERT (memcmp (result, "abcdefgh", i) == 0); + ASSERT (memeq (result, "abcdefgh", i)); ASSERT (result[i] == '\0'); ASSERT (length == strlen (result)); free (result); @@ -4045,7 +4045,7 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...)) char *result = my_asnprintf (NULL, &length, "a%cz %d", '\0', 33, 44, 55); - ASSERT (memcmp (result, "a\0z 33\0", 6 + 1) == 0); + ASSERT (memeq (result, "a\0z 33\0", 6 + 1)); ASSERT (length == 6); free (result); } @@ -4111,7 +4111,7 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...)) as if by a call to the wcrtomb function with a pointer to storage of at least MB_CUR_MAX bytes, the wint_t argument converted to wchar_t, and an initial shift state." */ - ASSERT (memcmp (result, "a\0z 33\0", 6 + 1) == 0); + ASSERT (memeq (result, "a\0z 33\0", 6 + 1)); ASSERT (length == 6); free (result); } diff --git a/tests/test-vasnprintf-posix2.c b/tests/test-vasnprintf-posix2.c index 30a27db610..b9db6ea542 100644 --- a/tests/test-vasnprintf-posix2.c +++ b/tests/test-vasnprintf-posix2.c @@ -72,8 +72,8 @@ main (int argc, char *argv[]) char *result = asnprintf (NULL, &length, "%'d", 1000); ASSERT (result != NULL); ASSERT (length == 4 + separator_len); - ASSERT (memcmp (result, "1", 1) == 0 - && memcmp (result + 1, separator, separator_len) == 0 + ASSERT (memeq (result, "1", 1) + && memeq (result + 1, separator, separator_len) && streq (result + 1 + separator_len, "000")); free (result); } @@ -82,8 +82,8 @@ main (int argc, char *argv[]) char *result = asnprintf (NULL, &length, "%'d", -1000); ASSERT (result != NULL); ASSERT (length == 5 + separator_len); - ASSERT (memcmp (result, "-1", 2) == 0 - && memcmp (result + 2, separator, separator_len) == 0 + ASSERT (memeq (result, "-1", 2) + && memeq (result + 2, separator, separator_len) && streq (result + 2 + separator_len, "000")); free (result); } @@ -92,8 +92,8 @@ main (int argc, char *argv[]) char *result = asnprintf (NULL, &length, "%'d", -142857); ASSERT (result != NULL); ASSERT (length == 7 + separator_len); - ASSERT (memcmp (result, "-142", 4) == 0 - && memcmp (result + 4, separator, separator_len) == 0 + ASSERT (memeq (result, "-142", 4) + && memeq (result + 4, separator, separator_len) && streq (result + 4 + separator_len, "857")); free (result); } @@ -102,12 +102,12 @@ main (int argc, char *argv[]) char *result = asnprintf (NULL, &length, "%'d", 2147483647); ASSERT (result != NULL); ASSERT (length == 10 + 3 * separator_len); - ASSERT (memcmp (result, "2", 1) == 0 - && memcmp (result + 1, separator, separator_len) == 0 - && memcmp (result + 1 + separator_len, "147", 3) == 0 - && memcmp (result + 4 + separator_len, separator, separator_len) == 0 - && memcmp (result + 4 + 2 * separator_len, "483", 3) == 0 - && memcmp (result + 7 + 2 * separator_len, separator, separator_len) == 0 + ASSERT (memeq (result, "2", 1) + && memeq (result + 1, separator, separator_len) + && memeq (result + 1 + separator_len, "147", 3) + && memeq (result + 4 + separator_len, separator, separator_len) + && memeq (result + 4 + 2 * separator_len, "483", 3) + && memeq (result + 7 + 2 * separator_len, separator, separator_len) && streq (result + 7 + 3 * separator_len, "647")); free (result); } @@ -116,12 +116,12 @@ main (int argc, char *argv[]) char *result = asnprintf (NULL, &length, "%'d", -2147483647); ASSERT (result != NULL); ASSERT (length == 11 + 3 * separator_len); - ASSERT (memcmp (result, "-2", 2) == 0 - && memcmp (result + 2, separator, separator_len) == 0 - && memcmp (result + 2 + separator_len, "147", 3) == 0 - && memcmp (result + 5 + separator_len, separator, separator_len) == 0 - && memcmp (result + 5 + 2 * separator_len, "483", 3) == 0 - && memcmp (result + 8 + 2 * separator_len, separator, separator_len) == 0 + ASSERT (memeq (result, "-2", 2) + && memeq (result + 2, separator, separator_len) + && memeq (result + 2 + separator_len, "147", 3) + && memeq (result + 5 + separator_len, separator, separator_len) + && memeq (result + 5 + 2 * separator_len, "483", 3) + && memeq (result + 8 + 2 * separator_len, separator, separator_len) && streq (result + 8 + 3 * separator_len, "647")); free (result); } @@ -134,8 +134,8 @@ main (int argc, char *argv[]) /* Most implementations don't add the grouping character within the leading zeroes. */ ASSERT (length == 10 + separator_len); - ASSERT (memcmp (result, "0000001", 7) == 0 - && memcmp (result + 7, separator, separator_len) == 0 + ASSERT (memeq (result, "0000001", 7) + && memeq (result + 7, separator, separator_len) && streq (result + 7 + separator_len, "000")); } else @@ -144,12 +144,12 @@ main (int argc, char *argv[]) within the leading zeroes. */ ASSERT (length == 10 + 3 * separator_len); - ASSERT (memcmp (result, "0", 1) == 0 - && memcmp (result + 1, separator, separator_len) == 0 - && memcmp (result + 1 + separator_len, "000", 3) == 0 - && memcmp (result + 4 + separator_len, separator, separator_len) == 0 - && memcmp (result + 4 + 2 * separator_len, "001", 3) == 0 - && memcmp (result + 7 + 2 * separator_len, separator, separator_len) == 0 + ASSERT (memeq (result, "0", 1) + && memeq (result + 1, separator, separator_len) + && memeq (result + 1 + separator_len, "000", 3) + && memeq (result + 4 + separator_len, separator, separator_len) + && memeq (result + 4 + 2 * separator_len, "001", 3) + && memeq (result + 7 + 2 * separator_len, separator, separator_len) && streq (result + 7 + 3 * separator_len, "000")); } free (result); @@ -163,8 +163,8 @@ main (int argc, char *argv[]) /* Most implementations don't add the grouping character within the leading zeroes. */ ASSERT (length == 11 + separator_len); - ASSERT (memcmp (result, "-0000001", 8) == 0 - && memcmp (result + 8, separator, separator_len) == 0 + ASSERT (memeq (result, "-0000001", 8) + && memeq (result + 8, separator, separator_len) && streq (result + 8 + separator_len, "000")); } else @@ -173,12 +173,12 @@ main (int argc, char *argv[]) within the leading zeroes. */ ASSERT (length == 11 + 3 * separator_len); - ASSERT (memcmp (result, "-0", 2) == 0 - && memcmp (result + 2, separator, separator_len) == 0 - && memcmp (result + 2 + separator_len, "000", 3) == 0 - && memcmp (result + 5 + separator_len, separator, separator_len) == 0 - && memcmp (result + 5 + 2 * separator_len, "001", 3) == 0 - && memcmp (result + 8 + 2 * separator_len, separator, separator_len) == 0 + ASSERT (memeq (result, "-0", 2) + && memeq (result + 2, separator, separator_len) + && memeq (result + 2 + separator_len, "000", 3) + && memeq (result + 5 + separator_len, separator, separator_len) + && memeq (result + 5 + 2 * separator_len, "001", 3) + && memeq (result + 8 + 2 * separator_len, separator, separator_len) && streq (result + 8 + 3 * separator_len, "000")); } free (result); @@ -196,8 +196,8 @@ main (int argc, char *argv[]) */ ASSERT (length == 10); - ASSERT (memcmp (result, " 1" + separator_len, 7 - separator_len) == 0 - && memcmp (result + 7 - separator_len, separator, separator_len) == 0 + ASSERT (memeq (result, " 1" + separator_len, 7 - separator_len) + && memeq (result + 7 - separator_len, separator, separator_len) && streq (result + 7, "000")); } else @@ -208,8 +208,8 @@ main (int argc, char *argv[]) */ ASSERT (length == 9 + separator_len); - ASSERT (memcmp (result, " 1", 6) == 0 - && memcmp (result + 6, separator, separator_len) == 0 + ASSERT (memeq (result, " 1", 6) + && memeq (result + 6, separator, separator_len) && streq (result + 6 + separator_len, "000")); } } @@ -233,8 +233,8 @@ main (int argc, char *argv[]) */ ASSERT (length == 10); - ASSERT (memcmp (result, " -1" + separator_len, 7 - separator_len) == 0 - && memcmp (result + 7 - separator_len, separator, separator_len) == 0 + ASSERT (memeq (result, " -1" + separator_len, 7 - separator_len) + && memeq (result + 7 - separator_len, separator, separator_len) && streq (result + 7, "000")); } else @@ -245,8 +245,8 @@ main (int argc, char *argv[]) */ ASSERT (length == 9 + separator_len); - ASSERT (memcmp (result, " -1", 6) == 0 - && memcmp (result + 6, separator, separator_len) == 0 + ASSERT (memeq (result, " -1", 6) + && memeq (result + 6, separator, separator_len) && streq (result + 6 + separator_len, "000")); } } @@ -264,8 +264,8 @@ main (int argc, char *argv[]) char *result = asnprintf (NULL, &length, "%'.0f", 1000.0); ASSERT (result != NULL); ASSERT (length == 4 + separator_len); - ASSERT (memcmp (result, "1", 1) == 0 - && memcmp (result + 1, separator, separator_len) == 0 + ASSERT (memeq (result, "1", 1) + && memeq (result + 1, separator, separator_len) && streq (result + 1 + separator_len, "000")); free (result); } @@ -274,12 +274,12 @@ main (int argc, char *argv[]) char *result = asnprintf (NULL, &length, "%'.5f", 3141592653.5897932386); ASSERT (result != NULL); ASSERT (length == 16 + 3 * separator_len); - ASSERT (memcmp (result, "3", 1) == 0 - && memcmp (result + 1, separator, separator_len) == 0 - && memcmp (result + 1 + separator_len, "141", 3) == 0 - && memcmp (result + 4 + separator_len, separator, separator_len) == 0 - && memcmp (result + 4 + 2 * separator_len, "592", 3) == 0 - && memcmp (result + 7 + 2 * separator_len, separator, separator_len) == 0 + ASSERT (memeq (result, "3", 1) + && memeq (result + 1, separator, separator_len) + && memeq (result + 1 + separator_len, "141", 3) + && memeq (result + 4 + separator_len, separator, separator_len) + && memeq (result + 4 + 2 * separator_len, "592", 3) + && memeq (result + 7 + 2 * separator_len, separator, separator_len) && streq (result + 7 + 3 * separator_len, "653,58979")); free (result); } @@ -288,12 +288,12 @@ main (int argc, char *argv[]) char *result = asnprintf (NULL, &length, "%'.5f", -3141592653.5897932386); ASSERT (result != NULL); ASSERT (length == 17 + 3 * separator_len); - ASSERT (memcmp (result, "-3", 2) == 0 - && memcmp (result + 2, separator, separator_len) == 0 - && memcmp (result + 2 + separator_len, "141", 3) == 0 - && memcmp (result + 5 + separator_len, separator, separator_len) == 0 - && memcmp (result + 5 + 2 * separator_len, "592", 3) == 0 - && memcmp (result + 8 + 2 * separator_len, separator, separator_len) == 0 + ASSERT (memeq (result, "-3", 2) + && memeq (result + 2, separator, separator_len) + && memeq (result + 2 + separator_len, "141", 3) + && memeq (result + 5 + separator_len, separator, separator_len) + && memeq (result + 5 + 2 * separator_len, "592", 3) + && memeq (result + 8 + 2 * separator_len, separator, separator_len) && streq (result + 8 + 3 * separator_len, "653,58979")); free (result); } @@ -310,8 +310,8 @@ main (int argc, char *argv[]) */ ASSERT (length == 10); - ASSERT (memcmp (result, "0000001" + separator_len, 7 - separator_len) == 0 - && memcmp (result + 7 - separator_len, separator, separator_len) == 0 + ASSERT (memeq (result, "0000001" + separator_len, 7 - separator_len) + && memeq (result + 7 - separator_len, separator, separator_len) && streq (result + 7, "000")); } else @@ -322,8 +322,8 @@ main (int argc, char *argv[]) */ ASSERT (length == 9 + separator_len); - ASSERT (memcmp (result, "000001", 6) == 0 - && memcmp (result + 6, separator, separator_len) == 0 + ASSERT (memeq (result, "000001", 6) + && memeq (result + 6, separator, separator_len) && streq (result + 6 + separator_len, "000")); } } @@ -341,8 +341,8 @@ main (int argc, char *argv[]) char *result = asnprintf (NULL, &length, "%'g", 1000.0); ASSERT (result != NULL); ASSERT (length == 4 + separator_len); - ASSERT (memcmp (result, "1", 1) == 0 - && memcmp (result + 1, separator, separator_len) == 0 + ASSERT (memeq (result, "1", 1) + && memeq (result + 1, separator, separator_len) && streq (result + 1 + separator_len, "000")); free (result); } @@ -351,8 +351,8 @@ main (int argc, char *argv[]) char *result = asnprintf (NULL, &length, "%'g", -142857.0); ASSERT (result != NULL); ASSERT (length == 7 + separator_len); - ASSERT (memcmp (result, "-142", 4) == 0 - && memcmp (result + 4, separator, separator_len) == 0 + ASSERT (memeq (result, "-142", 4) + && memeq (result + 4, separator, separator_len) && streq (result + 4 + separator_len, "857")); free (result); } @@ -391,16 +391,16 @@ main (int argc, char *argv[]) 42351647362715016953416125033982098102569580078125.0); ASSERT (result != NULL); ASSERT (length == 50 + 16 * separator_len); - ASSERT (memcmp (result, "42", 2) == 0 - && memcmp (result + 2, separator, separator_len) == 0 - && memcmp (result + 2 + separator_len, "351", 3) == 0 - && memcmp (result + 5 + separator_len, separator, separator_len) == 0 - && memcmp (result + 5 + 2 * separator_len, "647", 3) == 0 - && memcmp (result + 8 + 2 * separator_len, separator, separator_len) == 0 - && memcmp (result + 8 + 3 * separator_len, "362", 3) == 0 - && memcmp (result + 11 + 3 * separator_len, separator, separator_len) == 0 - && memcmp (result + 11 + 4 * separator_len, "715", 3) == 0 - && memcmp (result + 14 + 4 * separator_len, separator, separator_len) == 0); + ASSERT (memeq (result, "42", 2) + && memeq (result + 2, separator, separator_len) + && memeq (result + 2 + separator_len, "351", 3) + && memeq (result + 5 + separator_len, separator, separator_len) + && memeq (result + 5 + 2 * separator_len, "647", 3) + && memeq (result + 8 + 2 * separator_len, separator, separator_len) + && memeq (result + 8 + 3 * separator_len, "362", 3) + && memeq (result + 11 + 3 * separator_len, separator, separator_len) + && memeq (result + 11 + 4 * separator_len, "715", 3) + && memeq (result + 14 + 4 * separator_len, separator, separator_len)); free (result); } { @@ -416,8 +416,8 @@ main (int argc, char *argv[]) */ ASSERT (length == 10); - ASSERT (memcmp (result, "0000001" + separator_len, 7 - separator_len) == 0 - && memcmp (result + 7 - separator_len, separator, separator_len) == 0 + ASSERT (memeq (result, "0000001" + separator_len, 7 - separator_len) + && memeq (result + 7 - separator_len, separator, separator_len) && streq (result + 7, "000")); } else @@ -428,8 +428,8 @@ main (int argc, char *argv[]) */ ASSERT (length == 9 + separator_len); - ASSERT (memcmp (result, "000001", 6) == 0 - && memcmp (result + 6, separator, separator_len) == 0 + ASSERT (memeq (result, "000001", 6) + && memeq (result + 6, separator, separator_len) && streq (result + 6 + separator_len, "000")); } } diff --git a/tests/test-vasnprintf.c b/tests/test-vasnprintf.c index a0eaf34c20..b4fbec6123 100644 --- a/tests/test-vasnprintf.c +++ b/tests/test-vasnprintf.c @@ -55,7 +55,7 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...)) ASSERT (length == 5); if (size < 5 + 1) ASSERT (result != buf); - ASSERT (memcmp (buf + size, &"DEADBEEF"[size], 8 - size) == 0); + ASSERT (memeq (buf + size, &"DEADBEEF"[size], 8 - size)); if (result != buf) free (result); } @@ -78,11 +78,11 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...)) 163141592653589790000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 */ ASSERT (strlen (result) == 126); - ASSERT (memcmp (result, "163141592653589790", 18) == 0); + ASSERT (memeq (result, "163141592653589790", 18)); ASSERT (length == 126); if (size < 126 + 1) ASSERT (result != buf); - ASSERT (memcmp (buf + size, &"DEADBEEF"[size], 8 - size) == 0); + ASSERT (memeq (buf + size, &"DEADBEEF"[size], 8 - size)); if (result != buf) free (result); } diff --git a/tests/test-vasprintf-posix.c b/tests/test-vasprintf-posix.c index 889d62d097..dd13d2dcea 100644 --- a/tests/test-vasprintf-posix.c +++ b/tests/test-vasprintf-posix.c @@ -77,7 +77,7 @@ strisnan (const char *string, size_t start_index, size_t end_index, int uppercas if (string[start_index] == '-') start_index++; if (start_index + 3 <= end_index - && memcmp (string + start_index, uppercase ? "NAN" : "nan", 3) == 0) + && memeq (string + start_index, uppercase ? "NAN" : "nan", 3)) { start_index += 3; if (start_index == end_index @@ -2105,7 +2105,7 @@ test_function (int (*my_asprintf) (char **, const char *, ...)) ASSERT (streq (result, expected) /* Some implementations produce exponents with 3 digits. */ || (strlen (result) == strlen (expected) + 1 - && memcmp (result, expected, strlen (expected) - 2) == 0 + && memeq (result, expected, strlen (expected) - 2) && result[strlen (expected) - 2] == '0' && streq (result + strlen (expected) - 1, expected + strlen (expected) - 2))); @@ -2471,7 +2471,7 @@ test_function (int (*my_asprintf) (char **, const char *, ...)) ASSERT (streq (result, expected) /* Some implementations produce exponents with 3 digits. */ || (strlen (result) == strlen (expected) + 1 - && memcmp (result, expected, strlen (expected) - 2) == 0 + && memeq (result, expected, strlen (expected) - 2) && result[strlen (expected) - 2] == '0' && streq (result + strlen (expected) - 1, expected + strlen (expected) - 2))); @@ -2924,7 +2924,7 @@ test_function (int (*my_asprintf) (char **, const char *, ...)) /* Some implementations produce exponents with 3 digits. */ || (expected[strlen (expected) - 4] == 'e' && strlen (result) == strlen (expected) + 1 - && memcmp (result, expected, strlen (expected) - 2) == 0 + && memeq (result, expected, strlen (expected) - 2) && result[strlen (expected) - 2] == '0' && streq (result + strlen (expected) - 1, expected + strlen (expected) - 2))); @@ -3276,7 +3276,7 @@ test_function (int (*my_asprintf) (char **, const char *, ...)) /* Some implementations produce exponents with 3 digits. */ || (expected[strlen (expected) - 4] == 'e' && strlen (result) == strlen (expected) + 1 - && memcmp (result, expected, strlen (expected) - 2) == 0 + && memeq (result, expected, strlen (expected) - 2) && result[strlen (expected) - 2] == '0' && streq (result + strlen (expected) - 1, expected + strlen (expected) - 2))); @@ -3803,7 +3803,7 @@ test_function (int (*my_asprintf) (char **, const char *, ...)) input[i] = '\0'; retval = my_asprintf (&result, "%.4000s %d", input, 99); ASSERT (result != NULL); - ASSERT (memcmp (result, input, 4000) == 0); + ASSERT (memeq (result, input, 4000)); ASSERT (streq (result + 4000, " 99")); ASSERT (retval == strlen (result)); free (result); @@ -3906,7 +3906,7 @@ test_function (int (*my_asprintf) (char **, const char *, ...)) memcpy (block, "abcdefgh", i); retval = my_asprintf (&result, "%.*s", (int) i, block); ASSERT (result != NULL); - ASSERT (memcmp (result, block, i) == 0); + ASSERT (memeq (result, block, i)); ASSERT (result[i] == '\0'); ASSERT (retval == strlen (result)); free (result); @@ -3923,7 +3923,7 @@ test_function (int (*my_asprintf) (char **, const char *, ...)) block[j] = "abcdefgh"[j]; retval = my_asprintf (&result, "%.*ls", (int) i, block); ASSERT (result != NULL); - ASSERT (memcmp (result, "abcdefgh", i) == 0); + ASSERT (memeq (result, "abcdefgh", i)); ASSERT (result[i] == '\0'); ASSERT (retval == strlen (result)); free (result); @@ -3985,7 +3985,7 @@ test_function (int (*my_asprintf) (char **, const char *, ...)) char *result; int retval = my_asprintf (&result, "a%cz %d", '\0', 33, 44, 55); - ASSERT (memcmp (result, "a\0z 33\0", 6 + 1) == 0); + ASSERT (memeq (result, "a\0z 33\0", 6 + 1)); ASSERT (retval == 6); free (result); } @@ -4051,7 +4051,7 @@ test_function (int (*my_asprintf) (char **, const char *, ...)) as if by a call to the wcrtomb function with a pointer to storage of at least MB_CUR_MAX bytes, the wint_t argument converted to wchar_t, and an initial shift state." */ - ASSERT (memcmp (result, "a\0z 33\0", 6 + 1) == 0); + ASSERT (memeq (result, "a\0z 33\0", 6 + 1)); ASSERT (retval == 6); free (result); } diff --git a/tests/test-vaszprintf-posix.c b/tests/test-vaszprintf-posix.c index 5d9302547f..a5b8be275c 100644 --- a/tests/test-vaszprintf-posix.c +++ b/tests/test-vaszprintf-posix.c @@ -43,7 +43,7 @@ strisnan (const char *string, size_t start_index, size_t end_index, int uppercas if (string[start_index] == '-') start_index++; if (start_index + 3 <= end_index - && memcmp (string + start_index, uppercase ? "NAN" : "nan", 3) == 0) + && memeq (string + start_index, uppercase ? "NAN" : "nan", 3)) { start_index += 3; if (start_index == end_index diff --git a/tests/test-vsnprintf.c b/tests/test-vsnprintf.c index 87f43dd52f..f5bc545460 100644 --- a/tests/test-vsnprintf.c +++ b/tests/test-vsnprintf.c @@ -58,17 +58,17 @@ main (int argc, char *argv[]) { if (size > 0) { - ASSERT (memcmp (buf, "12345", size - 1) == 0); + ASSERT (memeq (buf, "12345", size - 1)); ASSERT (buf[size - 1] == '\0' || buf[size - 1] == '0' + size); } #if !CHECK_VSNPRINTF_POSIX if (size > 0) #endif - ASSERT (memcmp (buf + size, &"DEADBEEF"[size], 8 - size) == 0); + ASSERT (memeq (buf + size, &"DEADBEEF"[size], 8 - size)); } else { - ASSERT (memcmp (buf, "12345\0EF", 8) == 0); + ASSERT (memeq (buf, "12345\0EF", 8)); } } diff --git a/tests/test-wcrtomb-w32.c b/tests/test-wcrtomb-w32.c index be6fb0b046..ed91211547 100644 --- a/tests/test-wcrtomb-w32.c +++ b/tests/test-wcrtomb-w32.c @@ -145,13 +145,13 @@ test_one_locale (const char *name, int codepage) memset (buf, 'x', 8); ret = wcrtomb (buf, 0x00FC, NULL); ASSERT (ret == 1); - ASSERT (memcmp (buf, "\374", 1) == 0); + ASSERT (memeq (buf, "\374", 1)); ASSERT (buf[1] == 'x'); memset (buf, 'x', 8); ret = wcrtomb (buf, 0x00DF, NULL); ASSERT (ret == 1); - ASSERT (memcmp (buf, "\337", 1) == 0); + ASSERT (memeq (buf, "\337", 1)); ASSERT (buf[1] == 'x'); } return 0; @@ -163,19 +163,19 @@ test_one_locale (const char *name, int codepage) memset (buf, 'x', 8); ret = wcrtomb (buf, 0x0622, NULL); ASSERT (ret == 1); - ASSERT (memcmp (buf, "\302", 1) == 0); + ASSERT (memeq (buf, "\302", 1)); ASSERT (buf[1] == 'x'); memset (buf, 'x', 8); ret = wcrtomb (buf, 0x0644, NULL); ASSERT (ret == 1); - ASSERT (memcmp (buf, "\341", 1) == 0); + ASSERT (memeq (buf, "\341", 1)); ASSERT (buf[1] == 'x'); memset (buf, 'x', 8); ret = wcrtomb (buf, 0x0648, NULL); ASSERT (ret == 1); - ASSERT (memcmp (buf, "\346", 1) == 0); + ASSERT (memeq (buf, "\346", 1)); ASSERT (buf[1] == 'x'); } return 0; @@ -189,13 +189,13 @@ test_one_locale (const char *name, int codepage) memset (buf, 'x', 8); ret = wcrtomb (buf, 0x00FC, NULL); ASSERT (ret == 2); - ASSERT (memcmp (buf, "\303\274", 2) == 0); + ASSERT (memeq (buf, "\303\274", 2)); ASSERT (buf[2] == 'x'); memset (buf, 'x', 8); ret = wcrtomb (buf, 0x00DF, NULL); ASSERT (ret == 2); - ASSERT (memcmp (buf, "\303\237", 2) == 0); + ASSERT (memeq (buf, "\303\237", 2)); ASSERT (buf[2] == 'x'); } return 0; @@ -207,19 +207,19 @@ test_one_locale (const char *name, int codepage) memset (buf, 'x', 8); ret = wcrtomb (buf, 0x65E5, NULL); ASSERT (ret == 2); - ASSERT (memcmp (buf, "\223\372", 2) == 0); + ASSERT (memeq (buf, "\223\372", 2)); ASSERT (buf[2] == 'x'); memset (buf, 'x', 8); ret = wcrtomb (buf, 0x672C, NULL); ASSERT (ret == 2); - ASSERT (memcmp (buf, "\226\173", 2) == 0); + ASSERT (memeq (buf, "\226\173", 2)); ASSERT (buf[2] == 'x'); memset (buf, 'x', 8); ret = wcrtomb (buf, 0x8A9E, NULL); ASSERT (ret == 2); - ASSERT (memcmp (buf, "\214\352", 2) == 0); + ASSERT (memeq (buf, "\214\352", 2)); ASSERT (buf[2] == 'x'); } return 0; @@ -231,19 +231,19 @@ test_one_locale (const char *name, int codepage) memset (buf, 'x', 8); ret = wcrtomb (buf, 0x65E5, NULL); ASSERT (ret == 2); - ASSERT (memcmp (buf, "\244\351", 2) == 0); + ASSERT (memeq (buf, "\244\351", 2)); ASSERT (buf[2] == 'x'); memset (buf, 'x', 8); ret = wcrtomb (buf, 0x672C, NULL); ASSERT (ret == 2); - ASSERT (memcmp (buf, "\245\273", 2) == 0); + ASSERT (memeq (buf, "\245\273", 2)); ASSERT (buf[2] == 'x'); memset (buf, 'x', 8); ret = wcrtomb (buf, 0x8A9E, NULL); ASSERT (ret == 2); - ASSERT (memcmp (buf, "\273\171", 2) == 0); + ASSERT (memeq (buf, "\273\171", 2)); ASSERT (buf[2] == 'x'); } return 0; @@ -255,19 +255,19 @@ test_one_locale (const char *name, int codepage) memset (buf, 'x', 8); ret = wcrtomb (buf, 0x65E5, NULL); ASSERT (ret == 2); - ASSERT (memcmp (buf, "\310\325", 2) == 0); + ASSERT (memeq (buf, "\310\325", 2)); ASSERT (buf[2] == 'x'); memset (buf, 'x', 8); ret = wcrtomb (buf, 0x672C, NULL); ASSERT (ret == 2); - ASSERT (memcmp (buf, "\261\276", 2) == 0); + ASSERT (memeq (buf, "\261\276", 2)); ASSERT (buf[2] == 'x'); memset (buf, 'x', 8); ret = wcrtomb (buf, 0x8A9E, NULL); ASSERT (ret == 2); - ASSERT (memcmp (buf, "\325\132", 2) == 0); + ASSERT (memeq (buf, "\325\132", 2)); ASSERT (buf[2] == 'x'); } return 0; @@ -281,13 +281,13 @@ test_one_locale (const char *name, int codepage) memset (buf, 'x', 8); ret = wcrtomb (buf, 0x00FC, NULL); ASSERT (ret == 2); - ASSERT (memcmp (buf, "\250\271", 2) == 0); + ASSERT (memeq (buf, "\250\271", 2)); ASSERT (buf[2] == 'x'); memset (buf, 'x', 8); ret = wcrtomb (buf, 0x00DF, NULL); ASSERT (ret == 4); - ASSERT (memcmp (buf, "\201\060\211\070", 4) == 0); + ASSERT (memeq (buf, "\201\060\211\070", 4)); ASSERT (buf[4] == 'x'); } return 0; diff --git a/tests/test-wcrtomb.c b/tests/test-wcrtomb.c index bf6c8a5925..977e00975e 100644 --- a/tests/test-wcrtomb.c +++ b/tests/test-wcrtomb.c @@ -44,7 +44,7 @@ check_character (const char *s, size_t n) ret = wcrtomb (buf, wc, NULL); ASSERT (ret == n); - ASSERT (memcmp (buf, s, n) == 0); + ASSERT (memeq (buf, s, n)); /* Test special calling convention, passing a NULL pointer. */ ret = wcrtomb (NULL, wc, NULL); diff --git a/tests/test-wcsnrtombs.c b/tests/test-wcsnrtombs.c index 5af8f6aae0..99b3b7773d 100644 --- a/tests/test-wcsnrtombs.c +++ b/tests/test-wcsnrtombs.c @@ -69,7 +69,7 @@ main (int argc, char *argv[]) ret = wcsnrtombs (buf, &src, 6, n, NULL); ASSERT (ret == (n <= 5 ? n : 5)); ASSERT (src == (n <= 5 ? input + n : NULL)); - ASSERT (memcmp (buf, original, ret) == 0); + ASSERT (memeq (buf, original, ret)); if (src == NULL) ASSERT (buf[ret] == '\0'); ASSERT (buf[ret + (src == NULL) + 0] == '_'); @@ -104,7 +104,7 @@ main (int argc, char *argv[]) n < 3 ? input + 1 : n < 5 ? input + 2 : n <= 7 ? input + (n - 2) : NULL)); - ASSERT (memcmp (buf, original, ret) == 0); + ASSERT (memeq (buf, original, ret)); if (src == NULL) ASSERT (buf[ret] == '\0'); ASSERT (buf[ret + (src == NULL) + 0] == '_'); @@ -141,7 +141,7 @@ main (int argc, char *argv[]) n < 5 ? input + 2 : n < 7 ? input + 3 : n <= 8 ? input + (n - 3) : NULL)); - ASSERT (memcmp (buf, original, ret) == 0); + ASSERT (memeq (buf, original, ret)); if (src == NULL) ASSERT (buf[ret] == '\0'); ASSERT (buf[ret + (src == NULL) + 0] == '_'); @@ -177,7 +177,7 @@ main (int argc, char *argv[]) n < 3 ? input + 1 : n < 7 ? input + 2 : n <= 9 ? input + (n - 4) : NULL)); - ASSERT (memcmp (buf, original, ret) == 0); + ASSERT (memeq (buf, original, ret)); if (src == NULL) ASSERT (buf[ret] == '\0'); ASSERT (buf[ret + (src == NULL) + 0] == '_'); diff --git a/tests/test-wcsrtombs.c b/tests/test-wcsrtombs.c index ac4b9b0ad5..74467ff430 100644 --- a/tests/test-wcsrtombs.c +++ b/tests/test-wcsrtombs.c @@ -69,7 +69,7 @@ main (int argc, char *argv[]) ret = wcsrtombs (buf, &src, n, NULL); ASSERT (ret == (n <= 5 ? n : 5)); ASSERT (src == (n <= 5 ? input + n : NULL)); - ASSERT (memcmp (buf, original, ret) == 0); + ASSERT (memeq (buf, original, ret)); if (src == NULL) ASSERT (buf[ret] == '\0'); ASSERT (buf[ret + (src == NULL) + 0] == '_'); @@ -104,7 +104,7 @@ main (int argc, char *argv[]) n < 3 ? input + 1 : n < 5 ? input + 2 : n <= 7 ? input + (n - 2) : NULL)); - ASSERT (memcmp (buf, original, ret) == 0); + ASSERT (memeq (buf, original, ret)); if (src == NULL) ASSERT (buf[ret] == '\0'); ASSERT (buf[ret + (src == NULL) + 0] == '_'); @@ -141,7 +141,7 @@ main (int argc, char *argv[]) n < 5 ? input + 2 : n < 7 ? input + 3 : n <= 8 ? input + (n - 3) : NULL)); - ASSERT (memcmp (buf, original, ret) == 0); + ASSERT (memeq (buf, original, ret)); if (src == NULL) ASSERT (buf[ret] == '\0'); ASSERT (buf[ret + (src == NULL) + 0] == '_'); @@ -177,7 +177,7 @@ main (int argc, char *argv[]) n < 3 ? input + 1 : n < 7 ? input + 2 : n <= 9 ? input + (n - 4) : NULL)); - ASSERT (memcmp (buf, original, ret) == 0); + ASSERT (memeq (buf, original, ret)); if (src == NULL) ASSERT (buf[ret] == '\0'); ASSERT (buf[ret + (src == NULL) + 0] == '_'); diff --git a/tests/test-wcstok.c b/tests/test-wcstok.c index b1b235df4e..36d6facf1e 100644 --- a/tests/test-wcstok.c +++ b/tests/test-wcstok.c @@ -38,12 +38,12 @@ main () ret = wcstok (string, delim, &ptr); ASSERT (ret == string); - ASSERT (memcmp (string, L"hello\0 world!", 14 * sizeof (wchar_t)) == 0); + ASSERT (memeq (string, L"hello\0 world!", 14 * sizeof (wchar_t))); ASSERT (ptr == string + 6); ret = wcstok (NULL, delim, &ptr); ASSERT (ret == string + 7); - ASSERT (memcmp (string, L"hello\0 world!", 14 * sizeof (wchar_t)) == 0); + ASSERT (memeq (string, L"hello\0 world!", 14 * sizeof (wchar_t))); ASSERT (ptr == NULL || *ptr == L'\0'); ret = wcstok (NULL, delim, &ptr); diff --git a/tests/test-write.c b/tests/test-write.c index 6c5871e5ac..92b34f47a3 100644 --- a/tests/test-write.c +++ b/tests/test-write.c @@ -52,7 +52,7 @@ main (void) ASSERT (rfd >= 0); ASSERT (read (rfd, buf, sizeof (buf)) == 17); ASSERT (close (rfd) == 0); - ASSERT (memcmp (buf, "Hello fascination", 17) == 0); + ASSERT (memeq (buf, "Hello fascination", 17)); } ASSERT (close (fd) == 0); diff --git a/tests/test-xmemdup0.c b/tests/test-xmemdup0.c index 26f15513bf..e774415acf 100644 --- a/tests/test-xmemdup0.c +++ b/tests/test-xmemdup0.c @@ -62,14 +62,14 @@ main (int argc, char **argv) { char *result = xmemdup0 (buffer, 9); ASSERT (result); - ASSERT (memcmp (result, buffer, 9) == 0); + ASSERT (memeq (result, buffer, 9)); ASSERT (result[9] == '\0'); free (result); } { char *result = xmemdup0 (buffer, 10); ASSERT (result); - ASSERT (memcmp (result, buffer, 10) == 0); + ASSERT (memeq (result, buffer, 10)); ASSERT (result[10] == '\0'); free (result); } diff --git a/tests/test-xstring-desc.c b/tests/test-xstring-desc.c index 3f2b8166e1..cd94a87abd 100644 --- a/tests/test-xstring-desc.c +++ b/tests/test-xstring-desc.c @@ -76,7 +76,7 @@ main (void) { char *ptr = xsd_c (s2); ASSERT (ptr != NULL); - ASSERT (memcmp (ptr, "The\0quick\0brown\0\0fox\0", 22) == 0); + ASSERT (memeq (ptr, "The\0quick\0brown\0\0fox\0", 22)); free (ptr); } diff --git a/tests/uniconv/test-u16-conv-to-enc.c b/tests/uniconv/test-u16-conv-to-enc.c index 6464b56e79..f7b3bf8654 100644 --- a/tests/uniconv/test-u16-conv-to-enc.c +++ b/tests/uniconv/test-u16-conv-to-enc.c @@ -68,7 +68,7 @@ main () NULL, &length); ASSERT (result != NULL); ASSERT (length == strlen (expected)); - ASSERT (memcmp (result, expected, length) == 0); + ASSERT (memeq (result, expected, length)); if (o) { for (size_t i = 0; i < 37; i++) @@ -112,8 +112,8 @@ main () static const char expected_translit[] = "Rafal Maszkowski"; ASSERT (result != NULL); ASSERT (length == strlen (expected)); - ASSERT (memcmp (result, expected, length) == 0 - || memcmp (result, expected_translit, length) == 0); + ASSERT (memeq (result, expected, length) + || memeq (result, expected_translit, length)); if (o) { for (size_t i = 0; i < 16; i++) @@ -129,7 +129,7 @@ main () static const char expected[] = "Rafa\\u0142 Maszkowski"; ASSERT (result != NULL); ASSERT (length == strlen (expected)); - ASSERT (memcmp (result, expected, length) == 0); + ASSERT (memeq (result, expected, length)); if (o) { for (size_t i = 0; i < 16; i++) diff --git a/tests/uniconv/test-u32-conv-to-enc.c b/tests/uniconv/test-u32-conv-to-enc.c index e23e28674b..df8af227a4 100644 --- a/tests/uniconv/test-u32-conv-to-enc.c +++ b/tests/uniconv/test-u32-conv-to-enc.c @@ -68,7 +68,7 @@ main () NULL, &length); ASSERT (result != NULL); ASSERT (length == strlen (expected)); - ASSERT (memcmp (result, expected, length) == 0); + ASSERT (memeq (result, expected, length)); if (o) { for (size_t i = 0; i < 37; i++) @@ -112,8 +112,8 @@ main () static const char expected_translit[] = "Rafal Maszkowski"; ASSERT (result != NULL); ASSERT (length == strlen (expected)); - ASSERT (memcmp (result, expected, length) == 0 - || memcmp (result, expected_translit, length) == 0); + ASSERT (memeq (result, expected, length) + || memeq (result, expected_translit, length)); if (o) { for (size_t i = 0; i < 16; i++) @@ -129,7 +129,7 @@ main () static const char expected[] = "Rafa\\u0142 Maszkowski"; ASSERT (result != NULL); ASSERT (length == strlen (expected)); - ASSERT (memcmp (result, expected, length) == 0); + ASSERT (memeq (result, expected, length)); if (o) { for (size_t i = 0; i < 16; i++) diff --git a/tests/uniconv/test-u8-conv-to-enc.c b/tests/uniconv/test-u8-conv-to-enc.c index 4953d521ae..28acbb3299 100644 --- a/tests/uniconv/test-u8-conv-to-enc.c +++ b/tests/uniconv/test-u8-conv-to-enc.c @@ -64,7 +64,7 @@ main () NULL, &length); ASSERT (result != NULL); ASSERT (length == strlen (expected)); - ASSERT (memcmp (result, expected, length) == 0); + ASSERT (memeq (result, expected, length)); if (o) { for (size_t i = 0; i < 41; i++) @@ -112,8 +112,8 @@ main () static const char expected_translit[] = "Rafal Maszkowski"; ASSERT (result != NULL); ASSERT (length == strlen (expected)); - ASSERT (memcmp (result, expected, length) == 0 - || memcmp (result, expected_translit, length) == 0); + ASSERT (memeq (result, expected, length) + || memeq (result, expected_translit, length)); if (o) { for (size_t i = 0; i < 17; i++) @@ -131,7 +131,7 @@ main () static const char expected[] = "Rafa\\u0142 Maszkowski"; ASSERT (result != NULL); ASSERT (length == strlen (expected)); - ASSERT (memcmp (result, expected, length) == 0); + ASSERT (memeq (result, expected, length)); if (o) { for (size_t i = 0; i < 17; i++) diff --git a/tests/unistdio/test-ulc-asnprintf1.h b/tests/unistdio/test-ulc-asnprintf1.h index bfcd5e056c..cbce728d55 100644 --- a/tests/unistdio/test-ulc-asnprintf1.h +++ b/tests/unistdio/test-ulc-asnprintf1.h @@ -46,7 +46,7 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...)) ASSERT (length == 5); if (size < 6) ASSERT (result != buf); - ASSERT (memcmp (buf + size, &"DEADBEEF"[size], 8 - size) == 0); + ASSERT (memeq (buf + size, &"DEADBEEF"[size], 8 - size)); if (result != buf) free (result); } diff --git a/tests/unistr/test-chr.h b/tests/unistr/test-chr.h index fe007261fd..ec0d14c613 100644 --- a/tests/unistr/test-chr.h +++ b/tests/unistr/test-chr.h @@ -70,7 +70,7 @@ main (void) n = U_UCTOMB (c, uc, 6); ASSERT (exp < input + length - 1); ASSERT (U_CHR (prev, (length - 1) - (prev - input), uc) == exp); - ASSERT (memcmp (exp, c, n * sizeof (UNIT)) == 0); + ASSERT (memeq (exp, c, n * sizeof (UNIT))); prev = exp; exp += n * 63; } diff --git a/tests/unistr/test-strchr.h b/tests/unistr/test-strchr.h index e078e23261..6e7dfd7ea9 100644 --- a/tests/unistr/test-strchr.h +++ b/tests/unistr/test-strchr.h @@ -63,7 +63,7 @@ test_strchr (void) n = U_UCTOMB (c, uc, 6); ASSERT (exp < input + length - 2); ASSERT (U_STRCHR (prev, uc) == exp); - ASSERT (memcmp (exp, c, n * sizeof (UNIT)) == 0); + ASSERT (memeq (exp, c, n * sizeof (UNIT))); prev = exp; exp += n * 63; } diff --git a/tests/virtualbox.h b/tests/virtualbox.h index ec8dc19c56..8f3a8992bc 100644 --- a/tests/virtualbox.h +++ b/tests/virtualbox.h @@ -39,7 +39,7 @@ is_running_under_virtualbox (void) { int n = read (fd, buf, sizeof (buf)); close (fd); - if (n == 10 + 1 && memcmp (buf, "VirtualBox\n", 10 + 1) == 0) + if (n == 10 + 1 && memeq (buf, "VirtualBox\n", 10 + 1)) return true; } #endif