From b5ac427c1097baa730cb5e8661d081531d4a0068 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sun, 30 Jul 2023 00:48:14 +0200 Subject: [PATCH] wcrtomb tests: Renumber tests. * tests/test-wcrtomb.sh: Renamed 1 -> 2 -> 3 -> 4 -> 5 -> 1. * tests/test-wcrtomb.c: Update. * tests/test-wcrtomb-w32-*.sh: Renamed 1 -> 2 -> 3 -> 5 -> 7 -> 4 -> 6 -> 8. * tests/test-wcrtomb-w32.c: Update. * modules/wcrtomb-tests: Update. --- ChangeLog | 8 ++++++++ modules/wcrtomb-tests | 8 ++++---- tests/test-wcrtomb-w32-1.sh | 4 ---- tests/test-wcrtomb-w32-2.sh | 4 ++-- tests/test-wcrtomb-w32-3.sh | 4 ++-- tests/test-wcrtomb-w32-4.sh | 4 ++-- tests/test-wcrtomb-w32-5.sh | 4 ++-- tests/test-wcrtomb-w32-6.sh | 4 ++-- tests/test-wcrtomb-w32-7.sh | 4 ++-- tests/test-wcrtomb-w32-8.sh | 4 ++++ tests/test-wcrtomb-w32.c | 40 ++++++++++++++++++------------------- tests/test-wcrtomb.c | 14 ++++++------- tests/test-wcrtomb.sh | 16 +++++++-------- 13 files changed, 63 insertions(+), 55 deletions(-) delete mode 100755 tests/test-wcrtomb-w32-1.sh create mode 100755 tests/test-wcrtomb-w32-8.sh diff --git a/ChangeLog b/ChangeLog index e85ddeff15..4a26a99194 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,13 @@ 2023-07-29 Bruno Haible + wcrtomb tests: Renumber tests. + * tests/test-wcrtomb.sh: Renamed 1 -> 2 -> 3 -> 4 -> 5 -> 1. + * tests/test-wcrtomb.c: Update. + * tests/test-wcrtomb-w32-*.sh: Renamed 1 -> 2 -> 3 -> 5 -> 7 -> 4 -> 6 + -> 8. + * tests/test-wcrtomb-w32.c: Update. + * modules/wcrtomb-tests: Update. + mbstoc32s tests: Renumber tests. * tests/test-mbstoc32s-*.sh: Renamed 1 -> 2 -> 3 -> 4 -> 5 -> 1. * tests/test-mbstoc32s.c: Update. diff --git a/modules/wcrtomb-tests b/modules/wcrtomb-tests index 56ab65d09a..3baa3f30c5 100644 --- a/modules/wcrtomb-tests +++ b/modules/wcrtomb-tests @@ -1,13 +1,13 @@ Files: tests/test-wcrtomb.sh tests/test-wcrtomb.c -tests/test-wcrtomb-w32-1.sh tests/test-wcrtomb-w32-2.sh tests/test-wcrtomb-w32-3.sh tests/test-wcrtomb-w32-4.sh tests/test-wcrtomb-w32-5.sh tests/test-wcrtomb-w32-6.sh tests/test-wcrtomb-w32-7.sh +tests/test-wcrtomb-w32-8.sh tests/test-wcrtomb-w32.c tests/signature.h tests/macros.h @@ -30,9 +30,9 @@ gt_LOCALE_ZH_CN Makefile.am: TESTS += \ test-wcrtomb.sh \ - test-wcrtomb-w32-1.sh test-wcrtomb-w32-2.sh test-wcrtomb-w32-3.sh \ - test-wcrtomb-w32-4.sh test-wcrtomb-w32-5.sh test-wcrtomb-w32-6.sh \ - test-wcrtomb-w32-7.sh + test-wcrtomb-w32-2.sh test-wcrtomb-w32-3.sh test-wcrtomb-w32-4.sh \ + test-wcrtomb-w32-5.sh test-wcrtomb-w32-6.sh test-wcrtomb-w32-7.sh \ + test-wcrtomb-w32-8.sh TESTS_ENVIRONMENT += \ LOCALE_FR='@LOCALE_FR@' \ LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' \ diff --git a/tests/test-wcrtomb-w32-1.sh b/tests/test-wcrtomb-w32-1.sh deleted file mode 100755 index b01c5436b4..0000000000 --- a/tests/test-wcrtomb-w32-1.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh - -# Test a CP1252 locale. -${CHECKER} ./test-wcrtomb-w32${EXEEXT} French_France 1252 diff --git a/tests/test-wcrtomb-w32-2.sh b/tests/test-wcrtomb-w32-2.sh index 5481634d40..b01c5436b4 100755 --- a/tests/test-wcrtomb-w32-2.sh +++ b/tests/test-wcrtomb-w32-2.sh @@ -1,4 +1,4 @@ #!/bin/sh -# Test a CP1256 locale. -${CHECKER} ./test-wcrtomb-w32${EXEEXT} "Arabic_Saudi Arabia" 1256 +# Test a CP1252 locale. +${CHECKER} ./test-wcrtomb-w32${EXEEXT} French_France 1252 diff --git a/tests/test-wcrtomb-w32-3.sh b/tests/test-wcrtomb-w32-3.sh index f35879da3f..5481634d40 100755 --- a/tests/test-wcrtomb-w32-3.sh +++ b/tests/test-wcrtomb-w32-3.sh @@ -1,4 +1,4 @@ #!/bin/sh -# Test a CP932 locale. -${CHECKER} ./test-wcrtomb-w32${EXEEXT} Japanese_Japan 932 +# Test a CP1256 locale. +${CHECKER} ./test-wcrtomb-w32${EXEEXT} "Arabic_Saudi Arabia" 1256 diff --git a/tests/test-wcrtomb-w32-4.sh b/tests/test-wcrtomb-w32-4.sh index 8eec6cbc30..fb04e5838d 100755 --- a/tests/test-wcrtomb-w32-4.sh +++ b/tests/test-wcrtomb-w32-4.sh @@ -1,4 +1,4 @@ #!/bin/sh -# Test a CP950 locale. -${CHECKER} ./test-wcrtomb-w32${EXEEXT} Chinese_Taiwan 950 +# Test some UTF-8 locales. +${CHECKER} ./test-wcrtomb-w32${EXEEXT} French_France Japanese_Japan Chinese_Taiwan Chinese_China 65001 diff --git a/tests/test-wcrtomb-w32-5.sh b/tests/test-wcrtomb-w32-5.sh index fd47d6fa97..f35879da3f 100755 --- a/tests/test-wcrtomb-w32-5.sh +++ b/tests/test-wcrtomb-w32-5.sh @@ -1,4 +1,4 @@ #!/bin/sh -# Test a CP936 locale. -${CHECKER} ./test-wcrtomb-w32${EXEEXT} Chinese_China 936 +# Test a CP932 locale. +${CHECKER} ./test-wcrtomb-w32${EXEEXT} Japanese_Japan 932 diff --git a/tests/test-wcrtomb-w32-6.sh b/tests/test-wcrtomb-w32-6.sh index 802237d1aa..8eec6cbc30 100755 --- a/tests/test-wcrtomb-w32-6.sh +++ b/tests/test-wcrtomb-w32-6.sh @@ -1,4 +1,4 @@ #!/bin/sh -# Test a GB18030 locale. -${CHECKER} ./test-wcrtomb-w32${EXEEXT} Chinese_China 54936 +# Test a CP950 locale. +${CHECKER} ./test-wcrtomb-w32${EXEEXT} Chinese_Taiwan 950 diff --git a/tests/test-wcrtomb-w32-7.sh b/tests/test-wcrtomb-w32-7.sh index fb04e5838d..fd47d6fa97 100755 --- a/tests/test-wcrtomb-w32-7.sh +++ b/tests/test-wcrtomb-w32-7.sh @@ -1,4 +1,4 @@ #!/bin/sh -# Test some UTF-8 locales. -${CHECKER} ./test-wcrtomb-w32${EXEEXT} French_France Japanese_Japan Chinese_Taiwan Chinese_China 65001 +# Test a CP936 locale. +${CHECKER} ./test-wcrtomb-w32${EXEEXT} Chinese_China 936 diff --git a/tests/test-wcrtomb-w32-8.sh b/tests/test-wcrtomb-w32-8.sh new file mode 100755 index 0000000000..802237d1aa --- /dev/null +++ b/tests/test-wcrtomb-w32-8.sh @@ -0,0 +1,4 @@ +#!/bin/sh + +# Test a GB18030 locale. +${CHECKER} ./test-wcrtomb-w32${EXEEXT} Chinese_China 54936 diff --git a/tests/test-wcrtomb-w32.c b/tests/test-wcrtomb-w32.c index 4e75fe0e73..4d00d08236 100644 --- a/tests/test-wcrtomb-w32.c +++ b/tests/test-wcrtomb-w32.c @@ -184,6 +184,26 @@ test_one_locale (const char *name, int codepage) } return 0; + case 65001: + /* Locale encoding is CP65001 = UTF-8. */ + if (strcmp (locale_charset (), "UTF-8") != 0) + return 77; + { + /* Convert "B\303\274\303\237er": "Büßer" */ + memset (buf, 'x', 8); + ret = wcrtomb (buf, 0x00FC, NULL); + ASSERT (ret == 2); + ASSERT (memcmp (buf, "\303\274", 2) == 0); + ASSERT (buf[2] == 'x'); + + memset (buf, 'x', 8); + ret = wcrtomb (buf, 0x00DF, NULL); + ASSERT (ret == 2); + ASSERT (memcmp (buf, "\303\237", 2) == 0); + ASSERT (buf[2] == 'x'); + } + return 0; + case 932: /* Locale encoding is CP932, similar to Shift_JIS. */ { @@ -276,26 +296,6 @@ test_one_locale (const char *name, int codepage) } return 0; - case 65001: - /* Locale encoding is CP65001 = UTF-8. */ - if (strcmp (locale_charset (), "UTF-8") != 0) - return 77; - { - /* Convert "B\303\274\303\237er": "Büßer" */ - memset (buf, 'x', 8); - ret = wcrtomb (buf, 0x00FC, NULL); - ASSERT (ret == 2); - ASSERT (memcmp (buf, "\303\274", 2) == 0); - ASSERT (buf[2] == 'x'); - - memset (buf, 'x', 8); - ret = wcrtomb (buf, 0x00DF, NULL); - ASSERT (ret == 2); - ASSERT (memcmp (buf, "\303\237", 2) == 0); - ASSERT (buf[2] == 'x'); - } - return 0; - default: return 1; } diff --git a/tests/test-wcrtomb.c b/tests/test-wcrtomb.c index 6ec075083e..6211efc057 100644 --- a/tests/test-wcrtomb.c +++ b/tests/test-wcrtomb.c @@ -117,6 +117,10 @@ main (int argc, char *argv[]) switch (argv[1][0]) { case '1': + /* C locale; tested above. */ + return 0; + + case '2': /* Locale encoding is ISO-8859-1 or ISO-8859-15. */ { const char input[] = "B\374\337er"; /* "Büßer" */ @@ -126,7 +130,7 @@ main (int argc, char *argv[]) } return 0; - case '2': + case '3': /* Locale encoding is UTF-8. */ { const char input[] = "B\303\274\303\237er"; /* "Büßer" */ @@ -136,7 +140,7 @@ main (int argc, char *argv[]) } return 0; - case '3': + case '4': /* Locale encoding is EUC-JP. */ { const char input[] = "<\306\374\313\334\270\354>"; /* "<日本語>" */ @@ -147,7 +151,7 @@ main (int argc, char *argv[]) } return 0; - case '4': + case '5': /* Locale encoding is GB18030. */ { const char input[] = "B\250\271\201\060\211\070er"; /* "Büßer" */ @@ -156,10 +160,6 @@ main (int argc, char *argv[]) check_character (input + 3, 4); } return 0; - - case '5': - /* C locale; tested above. */ - return 0; } return 1; diff --git a/tests/test-wcrtomb.sh b/tests/test-wcrtomb.sh index 01d8d53b36..b4604612bc 100755 --- a/tests/test-wcrtomb.sh +++ b/tests/test-wcrtomb.sh @@ -1,10 +1,14 @@ #!/bin/sh +# Test in the POSIX locale. +LC_ALL=C ${CHECKER} ./test-wcrtomb${EXEEXT} 1 || exit 1 +LC_ALL=POSIX ${CHECKER} ./test-wcrtomb${EXEEXT} 1 || exit 1 + # Test in an ISO-8859-1 or ISO-8859-15 locale. : "${LOCALE_FR=fr_FR}" if test $LOCALE_FR != none; then LC_ALL=$LOCALE_FR \ - ${CHECKER} ./test-wcrtomb${EXEEXT} 1 \ + ${CHECKER} ./test-wcrtomb${EXEEXT} 2 \ || exit 1 fi @@ -12,7 +16,7 @@ fi : "${LOCALE_FR_UTF8=fr_FR.UTF-8}" if test $LOCALE_FR_UTF8 != none; then LC_ALL=$LOCALE_FR_UTF8 \ - ${CHECKER} ./test-wcrtomb${EXEEXT} 2 \ + ${CHECKER} ./test-wcrtomb${EXEEXT} 3 \ || exit 1 fi @@ -20,7 +24,7 @@ fi : "${LOCALE_JA=ja_JP}" if test $LOCALE_JA != none; then LC_ALL=$LOCALE_JA \ - ${CHECKER} ./test-wcrtomb${EXEEXT} 3 \ + ${CHECKER} ./test-wcrtomb${EXEEXT} 4 \ || exit 1 fi @@ -28,12 +32,8 @@ fi : "${LOCALE_ZH_CN=zh_CN.GB18030}" if test $LOCALE_ZH_CN != none; then LC_ALL=$LOCALE_ZH_CN \ - ${CHECKER} ./test-wcrtomb${EXEEXT} 4 \ + ${CHECKER} ./test-wcrtomb${EXEEXT} 5 \ || exit 1 fi -# Test in the POSIX locale. -LC_ALL=C ${CHECKER} ./test-wcrtomb${EXEEXT} 5 || exit 1 -LC_ALL=POSIX ${CHECKER} ./test-wcrtomb${EXEEXT} 5 || exit 1 - exit 0 -- 2.39.5