]> Savannah Git Hosting - gnulib.git/commitdiff
mbrtowc tests: Renumber tests.
authorBruno Haible <bruno@clisp.org>
Sat, 29 Jul 2023 22:03:01 +0000 (00:03 +0200)
committerBruno Haible <bruno@clisp.org>
Sat, 29 Jul 2023 23:41:18 +0000 (01:41 +0200)
* tests/test-mbrtowc*.sh: Renamed 1 -> 2 -> 3 -> 4 -> 5 -> 1.
* tests/test-mbrtowc.c: Update.
* tests/test-mbrtowc-w32-*.sh: Renamed 1 -> 2 -> 3 -> 5 -> 7 -> 4 -> 6 -> 8.
* tests/test-mbrtowc-w32.c: Update.
* modules/mbrtowc-tests: Update.

22 files changed:
ChangeLog
modules/mbrtowc-tests
tests/test-mbrtowc-1.sh [new file with mode: 0755]
tests/test-mbrtowc-2.sh [new file with mode: 0755]
tests/test-mbrtowc-3.sh [new file with mode: 0755]
tests/test-mbrtowc-4.sh [new file with mode: 0755]
tests/test-mbrtowc-5.sh [new file with mode: 0755]
tests/test-mbrtowc-w32-1.sh [deleted file]
tests/test-mbrtowc-w32-2.sh
tests/test-mbrtowc-w32-3.sh
tests/test-mbrtowc-w32-4.sh
tests/test-mbrtowc-w32-5.sh
tests/test-mbrtowc-w32-6.sh
tests/test-mbrtowc-w32-7.sh
tests/test-mbrtowc-w32-8.sh [new file with mode: 0755]
tests/test-mbrtowc-w32.c
tests/test-mbrtowc.c
tests/test-mbrtowc1.sh [deleted file]
tests/test-mbrtowc2.sh [deleted file]
tests/test-mbrtowc3.sh [deleted file]
tests/test-mbrtowc4.sh [deleted file]
tests/test-mbrtowc5.sh [deleted file]

index 3c7c412592424b8891654118213fc05a3536691b..1de452327f675df41188b5e80e3be26a534e8c5b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2023-07-29  Bruno Haible  <bruno@clisp.org>
 
+       mbrtowc tests: Renumber tests.
+       * tests/test-mbrtowc*.sh: Renamed 1 -> 2 -> 3 -> 4 -> 5 -> 1.
+       * tests/test-mbrtowc.c: Update.
+       * tests/test-mbrtowc-w32-*.sh: Renamed 1 -> 2 -> 3 -> 5 -> 7 -> 4 -> 6
+       -> 8.
+       * tests/test-mbrtowc-w32.c: Update.
+       * modules/mbrtowc-tests: Update.
+
        mbrlen tests: Renumber tests.
        * tests/test-mbrlen*.sh: Renamed 1 -> 2 -> 3 -> 4 -> 5 -> 1.
        * tests/test-mbrlen.c: Update.
index 801425ad2483911da5a055b0644c60ddf74e0528..af02c94016afbda54f30599775a8c066d44604de 100644 (file)
@@ -1,17 +1,17 @@
 Files:
-tests/test-mbrtowc1.sh
-tests/test-mbrtowc2.sh
-tests/test-mbrtowc3.sh
-tests/test-mbrtowc4.sh
-tests/test-mbrtowc5.sh
+tests/test-mbrtowc-1.sh
+tests/test-mbrtowc-2.sh
+tests/test-mbrtowc-3.sh
+tests/test-mbrtowc-4.sh
+tests/test-mbrtowc-5.sh
 tests/test-mbrtowc.c
-tests/test-mbrtowc-w32-1.sh
 tests/test-mbrtowc-w32-2.sh
 tests/test-mbrtowc-w32-3.sh
 tests/test-mbrtowc-w32-4.sh
 tests/test-mbrtowc-w32-5.sh
 tests/test-mbrtowc-w32-6.sh
 tests/test-mbrtowc-w32-7.sh
+tests/test-mbrtowc-w32-8.sh
 tests/test-mbrtowc-w32.c
 tests/signature.h
 tests/macros.h
@@ -34,11 +34,11 @@ gt_LOCALE_ZH_CN
 
 Makefile.am:
 TESTS += \
-  test-mbrtowc1.sh test-mbrtowc2.sh test-mbrtowc3.sh test-mbrtowc4.sh \
-  test-mbrtowc5.sh \
-  test-mbrtowc-w32-1.sh test-mbrtowc-w32-2.sh test-mbrtowc-w32-3.sh \
-  test-mbrtowc-w32-4.sh test-mbrtowc-w32-5.sh test-mbrtowc-w32-6.sh \
-  test-mbrtowc-w32-7.sh
+  test-mbrtowc-1.sh test-mbrtowc-2.sh test-mbrtowc-3.sh test-mbrtowc-4.sh \
+  test-mbrtowc-5.sh \
+  test-mbrtowc-w32-2.sh test-mbrtowc-w32-3.sh test-mbrtowc-w32-4.sh \
+  test-mbrtowc-w32-5.sh test-mbrtowc-w32-6.sh test-mbrtowc-w32-7.sh \
+  test-mbrtowc-w32-8.sh
 TESTS_ENVIRONMENT += \
   LOCALE_FR='@LOCALE_FR@' \
   LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' \
diff --git a/tests/test-mbrtowc-1.sh b/tests/test-mbrtowc-1.sh
new file mode 100755 (executable)
index 0000000..f0a1fed
--- /dev/null
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+# Test whether the POSIX locale has encoding errors.
+LC_ALL=C \
+${CHECKER} ./test-mbrtowc${EXEEXT} 1 || exit 1
+LC_ALL=POSIX \
+${CHECKER} ./test-mbrtowc${EXEEXT} 1 || exit 1
+
+exit 0
diff --git a/tests/test-mbrtowc-2.sh b/tests/test-mbrtowc-2.sh
new file mode 100755 (executable)
index 0000000..3066292
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+# Test in an ISO-8859-1 or ISO-8859-15 locale.
+: "${LOCALE_FR=fr_FR}"
+if test $LOCALE_FR = none; then
+  if test -f /usr/bin/localedef; then
+    echo "Skipping test: no traditional french locale is installed"
+  else
+    echo "Skipping test: no traditional french locale is supported"
+  fi
+  exit 77
+fi
+
+LC_ALL=$LOCALE_FR \
+${CHECKER} ./test-mbrtowc${EXEEXT} 2
diff --git a/tests/test-mbrtowc-3.sh b/tests/test-mbrtowc-3.sh
new file mode 100755 (executable)
index 0000000..36b0023
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+# Test whether a specific UTF-8 locale is installed.
+: "${LOCALE_FR_UTF8=fr_FR.UTF-8}"
+if test $LOCALE_FR_UTF8 = none; then
+  if test -f /usr/bin/localedef; then
+    echo "Skipping test: no french Unicode locale is installed"
+  else
+    echo "Skipping test: no french Unicode locale is supported"
+  fi
+  exit 77
+fi
+
+LC_ALL=$LOCALE_FR_UTF8 \
+${CHECKER} ./test-mbrtowc${EXEEXT} 3
diff --git a/tests/test-mbrtowc-4.sh b/tests/test-mbrtowc-4.sh
new file mode 100755 (executable)
index 0000000..1c5943e
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+# Test whether a specific EUC-JP locale is installed.
+: "${LOCALE_JA=ja_JP}"
+if test $LOCALE_JA = none; then
+  if test -f /usr/bin/localedef; then
+    echo "Skipping test: no traditional japanese locale is installed"
+  else
+    echo "Skipping test: no traditional japanese locale is supported"
+  fi
+  exit 77
+fi
+
+LC_ALL=$LOCALE_JA \
+${CHECKER} ./test-mbrtowc${EXEEXT} 4
diff --git a/tests/test-mbrtowc-5.sh b/tests/test-mbrtowc-5.sh
new file mode 100755 (executable)
index 0000000..8690bbe
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+# Test whether a specific GB18030 locale is installed.
+: "${LOCALE_ZH_CN=zh_CN.GB18030}"
+if test $LOCALE_ZH_CN = none; then
+  if test -f /usr/bin/localedef; then
+    echo "Skipping test: no transitional chinese locale is installed"
+  else
+    echo "Skipping test: no transitional chinese locale is supported"
+  fi
+  exit 77
+fi
+
+LC_ALL=$LOCALE_ZH_CN \
+${CHECKER} ./test-mbrtowc${EXEEXT} 5
diff --git a/tests/test-mbrtowc-w32-1.sh b/tests/test-mbrtowc-w32-1.sh
deleted file mode 100755 (executable)
index fec9ead..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/bin/sh
-
-# Test a CP1252 locale.
-${CHECKER} ./test-mbrtowc-w32${EXEEXT} French_France 1252
index c55a0ec0aec119a26e371d99f7a689337220af8b..fec9eadf264208689a2daf29c08b0fdc988717de 100755 (executable)
@@ -1,4 +1,4 @@
 #!/bin/sh
 
-# Test a CP1256 locale.
-${CHECKER} ./test-mbrtowc-w32${EXEEXT} "Arabic_Saudi Arabia" 1256
+# Test a CP1252 locale.
+${CHECKER} ./test-mbrtowc-w32${EXEEXT} French_France 1252
index c49f4bdf7069a700a6288a5dc7f03987429248f1..c55a0ec0aec119a26e371d99f7a689337220af8b 100755 (executable)
@@ -1,4 +1,4 @@
 #!/bin/sh
 
-# Test a CP932 locale.
-${CHECKER} ./test-mbrtowc-w32${EXEEXT} Japanese_Japan 932
+# Test a CP1256 locale.
+${CHECKER} ./test-mbrtowc-w32${EXEEXT} "Arabic_Saudi Arabia" 1256
index 3e78615068975cbca7d2ea7a4cb8b1dc2d2e29a5..2c5d555f1b7293100982c6cf4e388e523e89586f 100755 (executable)
@@ -1,4 +1,4 @@
 #!/bin/sh
 
-# Test a CP950 locale.
-${CHECKER} ./test-mbrtowc-w32${EXEEXT} Chinese_Taiwan 950
+# Test some UTF-8 locales.
+${CHECKER} ./test-mbrtowc-w32${EXEEXT} French_France Japanese_Japan Chinese_Taiwan Chinese_China 65001
index c6ba22261dd343b15db62438f7bb8d3c2d6599e9..c49f4bdf7069a700a6288a5dc7f03987429248f1 100755 (executable)
@@ -1,4 +1,4 @@
 #!/bin/sh
 
-# Test a CP936 locale.
-${CHECKER} ./test-mbrtowc-w32${EXEEXT} Chinese_China 936
+# Test a CP932 locale.
+${CHECKER} ./test-mbrtowc-w32${EXEEXT} Japanese_Japan 932
index c2e8dfe08173942e2bffcd36ba044904aa960519..3e78615068975cbca7d2ea7a4cb8b1dc2d2e29a5 100755 (executable)
@@ -1,4 +1,4 @@
 #!/bin/sh
 
-# Test a GB18030 locale.
-${CHECKER} ./test-mbrtowc-w32${EXEEXT} Chinese_China 54936
+# Test a CP950 locale.
+${CHECKER} ./test-mbrtowc-w32${EXEEXT} Chinese_Taiwan 950
index 2c5d555f1b7293100982c6cf4e388e523e89586f..c6ba22261dd343b15db62438f7bb8d3c2d6599e9 100755 (executable)
@@ -1,4 +1,4 @@
 #!/bin/sh
 
-# Test some UTF-8 locales.
-${CHECKER} ./test-mbrtowc-w32${EXEEXT} French_France Japanese_Japan Chinese_Taiwan Chinese_China 65001
+# Test a CP936 locale.
+${CHECKER} ./test-mbrtowc-w32${EXEEXT} Chinese_China 936
diff --git a/tests/test-mbrtowc-w32-8.sh b/tests/test-mbrtowc-w32-8.sh
new file mode 100755 (executable)
index 0000000..c2e8dfe
--- /dev/null
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+# Test a GB18030 locale.
+${CHECKER} ./test-mbrtowc-w32${EXEEXT} Chinese_China 54936
index 5d07bb03ed33fb97be85ad31f0cbf49266227c77..fcb7869b37a6a42a6e5ef2db11ac819721493cee 100644 (file)
@@ -265,6 +265,126 @@ 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;
+      {
+        char input[] = "B\303\274\303\237er"; /* "Büßer" */
+        memset (&state, '\0', sizeof (mbstate_t));
+
+        wc = (wchar_t) 0xBADFACE;
+        ret = mbrtowc (&wc, input, 1, &state);
+        ASSERT (ret == 1);
+        ASSERT (wc == 'B');
+        ASSERT (mbsinit (&state));
+        input[0] = '\0';
+
+        wc = (wchar_t) 0xBADFACE;
+        ret = mbrtowc (&wc, input + 1, 1, &state);
+        ASSERT (ret == (size_t)(-2));
+        ASSERT (wc == (wchar_t) 0xBADFACE);
+        ASSERT (!mbsinit (&state));
+        input[1] = '\0';
+
+        wc = (wchar_t) 0xBADFACE;
+        ret = mbrtowc (&wc, input + 2, 5, &state);
+        ASSERT (ret == 1);
+        ASSERT (wctob (wc) == EOF);
+        ASSERT (wc == 0x00FC);
+        ASSERT (mbsinit (&state));
+        input[2] = '\0';
+
+        /* Test support of NULL first argument.  */
+        ret = mbrtowc (NULL, input + 3, 4, &state);
+        ASSERT (ret == 2);
+        ASSERT (mbsinit (&state));
+
+        wc = (wchar_t) 0xBADFACE;
+        ret = mbrtowc (&wc, input + 3, 4, &state);
+        ASSERT (ret == 2);
+        ASSERT (wctob (wc) == EOF);
+        ASSERT (wc == 0x00DF);
+        ASSERT (mbsinit (&state));
+        input[3] = '\0';
+        input[4] = '\0';
+
+        wc = (wchar_t) 0xBADFACE;
+        ret = mbrtowc (&wc, input + 5, 2, &state);
+        ASSERT (ret == 1);
+        ASSERT (wc == 'e');
+        ASSERT (mbsinit (&state));
+        input[5] = '\0';
+
+        wc = (wchar_t) 0xBADFACE;
+        ret = mbrtowc (&wc, input + 6, 1, &state);
+        ASSERT (ret == 1);
+        ASSERT (wc == 'r');
+        ASSERT (mbsinit (&state));
+
+        /* Test some invalid input.  */
+        memset (&state, '\0', sizeof (mbstate_t));
+        wc = (wchar_t) 0xBADFACE;
+        ret = mbrtowc (&wc, "\377", 1, &state); /* 0xFF */
+        ASSERT (ret == (size_t)-1);
+        ASSERT (errno == EILSEQ);
+
+        memset (&state, '\0', sizeof (mbstate_t));
+        wc = (wchar_t) 0xBADFACE;
+        ret = mbrtowc (&wc, "\303\300", 2, &state); /* 0xC3 0xC0 */
+        ASSERT (ret == (size_t)-1);
+        ASSERT (errno == EILSEQ);
+
+        memset (&state, '\0', sizeof (mbstate_t));
+        wc = (wchar_t) 0xBADFACE;
+        ret = mbrtowc (&wc, "\343\300", 2, &state); /* 0xE3 0xC0 */
+        ASSERT (ret == (size_t)-1);
+        ASSERT (errno == EILSEQ);
+
+        memset (&state, '\0', sizeof (mbstate_t));
+        wc = (wchar_t) 0xBADFACE;
+        ret = mbrtowc (&wc, "\343\300\200", 3, &state); /* 0xE3 0xC0 0x80 */
+        ASSERT (ret == (size_t)-1);
+        ASSERT (errno == EILSEQ);
+
+        memset (&state, '\0', sizeof (mbstate_t));
+        wc = (wchar_t) 0xBADFACE;
+        ret = mbrtowc (&wc, "\343\200\300", 3, &state); /* 0xE3 0x80 0xC0 */
+        ASSERT (ret == (size_t)-1);
+        ASSERT (errno == EILSEQ);
+
+        memset (&state, '\0', sizeof (mbstate_t));
+        wc = (wchar_t) 0xBADFACE;
+        ret = mbrtowc (&wc, "\363\300", 2, &state); /* 0xF3 0xC0 */
+        ASSERT (ret == (size_t)-1);
+        ASSERT (errno == EILSEQ);
+
+        memset (&state, '\0', sizeof (mbstate_t));
+        wc = (wchar_t) 0xBADFACE;
+        ret = mbrtowc (&wc, "\363\300\200\200", 4, &state); /* 0xF3 0xC0 0x80 0x80 */
+        ASSERT (ret == (size_t)-1);
+        ASSERT (errno == EILSEQ);
+
+        memset (&state, '\0', sizeof (mbstate_t));
+        wc = (wchar_t) 0xBADFACE;
+        ret = mbrtowc (&wc, "\363\200\300", 3, &state); /* 0xF3 0x80 0xC0 */
+        ASSERT (ret == (size_t)-1);
+        ASSERT (errno == EILSEQ);
+
+        memset (&state, '\0', sizeof (mbstate_t));
+        wc = (wchar_t) 0xBADFACE;
+        ret = mbrtowc (&wc, "\363\200\300\200", 4, &state); /* 0xF3 0x80 0xC0 0x80 */
+        ASSERT (ret == (size_t)-1);
+        ASSERT (errno == EILSEQ);
+
+        memset (&state, '\0', sizeof (mbstate_t));
+        wc = (wchar_t) 0xBADFACE;
+        ret = mbrtowc (&wc, "\363\200\200\300", 4, &state); /* 0xF3 0x80 0x80 0xC0 */
+        ASSERT (ret == (size_t)-1);
+        ASSERT (errno == EILSEQ);
+      }
+      return 0;
+
     case 932:
       /* Locale encoding is CP932, similar to Shift_JIS.  */
       {
@@ -573,126 +693,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;
-      {
-        char input[] = "B\303\274\303\237er"; /* "Büßer" */
-        memset (&state, '\0', sizeof (mbstate_t));
-
-        wc = (wchar_t) 0xBADFACE;
-        ret = mbrtowc (&wc, input, 1, &state);
-        ASSERT (ret == 1);
-        ASSERT (wc == 'B');
-        ASSERT (mbsinit (&state));
-        input[0] = '\0';
-
-        wc = (wchar_t) 0xBADFACE;
-        ret = mbrtowc (&wc, input + 1, 1, &state);
-        ASSERT (ret == (size_t)(-2));
-        ASSERT (wc == (wchar_t) 0xBADFACE);
-        ASSERT (!mbsinit (&state));
-        input[1] = '\0';
-
-        wc = (wchar_t) 0xBADFACE;
-        ret = mbrtowc (&wc, input + 2, 5, &state);
-        ASSERT (ret == 1);
-        ASSERT (wctob (wc) == EOF);
-        ASSERT (wc == 0x00FC);
-        ASSERT (mbsinit (&state));
-        input[2] = '\0';
-
-        /* Test support of NULL first argument.  */
-        ret = mbrtowc (NULL, input + 3, 4, &state);
-        ASSERT (ret == 2);
-        ASSERT (mbsinit (&state));
-
-        wc = (wchar_t) 0xBADFACE;
-        ret = mbrtowc (&wc, input + 3, 4, &state);
-        ASSERT (ret == 2);
-        ASSERT (wctob (wc) == EOF);
-        ASSERT (wc == 0x00DF);
-        ASSERT (mbsinit (&state));
-        input[3] = '\0';
-        input[4] = '\0';
-
-        wc = (wchar_t) 0xBADFACE;
-        ret = mbrtowc (&wc, input + 5, 2, &state);
-        ASSERT (ret == 1);
-        ASSERT (wc == 'e');
-        ASSERT (mbsinit (&state));
-        input[5] = '\0';
-
-        wc = (wchar_t) 0xBADFACE;
-        ret = mbrtowc (&wc, input + 6, 1, &state);
-        ASSERT (ret == 1);
-        ASSERT (wc == 'r');
-        ASSERT (mbsinit (&state));
-
-        /* Test some invalid input.  */
-        memset (&state, '\0', sizeof (mbstate_t));
-        wc = (wchar_t) 0xBADFACE;
-        ret = mbrtowc (&wc, "\377", 1, &state); /* 0xFF */
-        ASSERT (ret == (size_t)-1);
-        ASSERT (errno == EILSEQ);
-
-        memset (&state, '\0', sizeof (mbstate_t));
-        wc = (wchar_t) 0xBADFACE;
-        ret = mbrtowc (&wc, "\303\300", 2, &state); /* 0xC3 0xC0 */
-        ASSERT (ret == (size_t)-1);
-        ASSERT (errno == EILSEQ);
-
-        memset (&state, '\0', sizeof (mbstate_t));
-        wc = (wchar_t) 0xBADFACE;
-        ret = mbrtowc (&wc, "\343\300", 2, &state); /* 0xE3 0xC0 */
-        ASSERT (ret == (size_t)-1);
-        ASSERT (errno == EILSEQ);
-
-        memset (&state, '\0', sizeof (mbstate_t));
-        wc = (wchar_t) 0xBADFACE;
-        ret = mbrtowc (&wc, "\343\300\200", 3, &state); /* 0xE3 0xC0 0x80 */
-        ASSERT (ret == (size_t)-1);
-        ASSERT (errno == EILSEQ);
-
-        memset (&state, '\0', sizeof (mbstate_t));
-        wc = (wchar_t) 0xBADFACE;
-        ret = mbrtowc (&wc, "\343\200\300", 3, &state); /* 0xE3 0x80 0xC0 */
-        ASSERT (ret == (size_t)-1);
-        ASSERT (errno == EILSEQ);
-
-        memset (&state, '\0', sizeof (mbstate_t));
-        wc = (wchar_t) 0xBADFACE;
-        ret = mbrtowc (&wc, "\363\300", 2, &state); /* 0xF3 0xC0 */
-        ASSERT (ret == (size_t)-1);
-        ASSERT (errno == EILSEQ);
-
-        memset (&state, '\0', sizeof (mbstate_t));
-        wc = (wchar_t) 0xBADFACE;
-        ret = mbrtowc (&wc, "\363\300\200\200", 4, &state); /* 0xF3 0xC0 0x80 0x80 */
-        ASSERT (ret == (size_t)-1);
-        ASSERT (errno == EILSEQ);
-
-        memset (&state, '\0', sizeof (mbstate_t));
-        wc = (wchar_t) 0xBADFACE;
-        ret = mbrtowc (&wc, "\363\200\300", 3, &state); /* 0xF3 0x80 0xC0 */
-        ASSERT (ret == (size_t)-1);
-        ASSERT (errno == EILSEQ);
-
-        memset (&state, '\0', sizeof (mbstate_t));
-        wc = (wchar_t) 0xBADFACE;
-        ret = mbrtowc (&wc, "\363\200\300\200", 4, &state); /* 0xF3 0x80 0xC0 0x80 */
-        ASSERT (ret == (size_t)-1);
-        ASSERT (errno == EILSEQ);
-
-        memset (&state, '\0', sizeof (mbstate_t));
-        wc = (wchar_t) 0xBADFACE;
-        ret = mbrtowc (&wc, "\363\200\200\300", 4, &state); /* 0xF3 0x80 0x80 0xC0 */
-        ASSERT (ret == (size_t)-1);
-        ASSERT (errno == EILSEQ);
-      }
-      return 0;
-
     default:
       return 1;
     }
index cf43011cadc22ac9dccbffc6fb5e4c114d146cfc..be9df12e38a8fbfa09846abe396c74852f60ef76 100644 (file)
@@ -130,14 +130,48 @@ main (int argc, char *argv[])
      "C" locale.  Furthermore, when you attempt to set the "C" or "POSIX"
      locale via setlocale(), what you get is a "C" locale with UTF-8 encoding,
      that is, effectively the "C.UTF-8" locale.  */
-  if (argc > 1 && strcmp (argv[1], "5") == 0 && MB_CUR_MAX > 1)
-    argv[1] = "2";
+  if (argc > 1 && strcmp (argv[1], "1") == 0 && MB_CUR_MAX > 1)
+    argv[1] = "3";
 #endif
 
   if (argc > 1)
     switch (argv[1][0])
       {
       case '1':
+        /* C or POSIX locale.  */
+        {
+          int c;
+          char buf[1];
+
+          memset (&state, '\0', sizeof (mbstate_t));
+          for (c = 0; c < 0x100; c++)
+            if (c != 0)
+              {
+                /* We are testing all nonnull bytes.  */
+                buf[0] = c;
+
+                wc = (wchar_t) 0xBADFACE;
+                ret = mbrtowc (&wc, buf, 1, &state);
+                /* POSIX:2018 says: "In the POSIX locale an [EILSEQ] error
+                   cannot occur since all byte values are valid characters."  */
+                ASSERT (ret == 1);
+                if (c < 0x80)
+                  /* c is an ASCII character.  */
+                  ASSERT (wc == c);
+                else
+                  /* On most platforms, the bytes 0x80..0xFF map to U+0080..U+00FF.
+                     But on musl libc, the bytes 0x80..0xFF map to U+DF80..U+DFFF.  */
+                  ASSERT (wc == (btowc (c) == 0xDF00 + c ? btowc (c) : c));
+                ASSERT (mbsinit (&state));
+
+                ret = mbrtowc (NULL, buf, 1, &state);
+                ASSERT (ret == 1);
+                ASSERT (mbsinit (&state));
+              }
+        }
+        return 0;
+
+      case '2':
         /* Locale encoding is ISO-8859-1 or ISO-8859-15.  */
         {
           char input[] = "B\374\337er"; /* "Büßer" */
@@ -184,7 +218,7 @@ main (int argc, char *argv[])
         }
         return 0;
 
-      case '2':
+      case '3':
         /* Locale encoding is UTF-8.  */
         {
           char input[] = "B\303\274\303\237er"; /* "Büßer" */
@@ -239,7 +273,7 @@ main (int argc, char *argv[])
         }
         return 0;
 
-      case '3':
+      case '4':
         /* Locale encoding is EUC-JP.  */
         {
           char input[] = "<\306\374\313\334\270\354>"; /* "<日本語>" */
@@ -295,7 +329,7 @@ main (int argc, char *argv[])
         }
         return 0;
 
-      case '4':
+      case '5':
         /* Locale encoding is GB18030.  */
         {
           char input[] = "B\250\271\201\060\211\070er"; /* "Büßer" */
@@ -351,40 +385,6 @@ main (int argc, char *argv[])
           ASSERT (mbsinit (&state));
         }
         return 0;
-
-      case '5':
-        /* C or POSIX locale.  */
-        {
-          int c;
-          char buf[1];
-
-          memset (&state, '\0', sizeof (mbstate_t));
-          for (c = 0; c < 0x100; c++)
-            if (c != 0)
-              {
-                /* We are testing all nonnull bytes.  */
-                buf[0] = c;
-
-                wc = (wchar_t) 0xBADFACE;
-                ret = mbrtowc (&wc, buf, 1, &state);
-                /* POSIX:2018 says: "In the POSIX locale an [EILSEQ] error
-                   cannot occur since all byte values are valid characters."  */
-                ASSERT (ret == 1);
-                if (c < 0x80)
-                  /* c is an ASCII character.  */
-                  ASSERT (wc == c);
-                else
-                  /* On most platforms, the bytes 0x80..0xFF map to U+0080..U+00FF.
-                     But on musl libc, the bytes 0x80..0xFF map to U+DF80..U+DFFF.  */
-                  ASSERT (wc == (btowc (c) == 0xDF00 + c ? btowc (c) : c));
-                ASSERT (mbsinit (&state));
-
-                ret = mbrtowc (NULL, buf, 1, &state);
-                ASSERT (ret == 1);
-                ASSERT (mbsinit (&state));
-              }
-        }
-        return 0;
       }
 
   return 1;
diff --git a/tests/test-mbrtowc1.sh b/tests/test-mbrtowc1.sh
deleted file mode 100755 (executable)
index 2b6eaf9..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/bin/sh
-
-# Test in an ISO-8859-1 or ISO-8859-15 locale.
-: "${LOCALE_FR=fr_FR}"
-if test $LOCALE_FR = none; then
-  if test -f /usr/bin/localedef; then
-    echo "Skipping test: no traditional french locale is installed"
-  else
-    echo "Skipping test: no traditional french locale is supported"
-  fi
-  exit 77
-fi
-
-LC_ALL=$LOCALE_FR \
-${CHECKER} ./test-mbrtowc${EXEEXT} 1
diff --git a/tests/test-mbrtowc2.sh b/tests/test-mbrtowc2.sh
deleted file mode 100755 (executable)
index 6868e86..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/bin/sh
-
-# Test whether a specific UTF-8 locale is installed.
-: "${LOCALE_FR_UTF8=fr_FR.UTF-8}"
-if test $LOCALE_FR_UTF8 = none; then
-  if test -f /usr/bin/localedef; then
-    echo "Skipping test: no french Unicode locale is installed"
-  else
-    echo "Skipping test: no french Unicode locale is supported"
-  fi
-  exit 77
-fi
-
-LC_ALL=$LOCALE_FR_UTF8 \
-${CHECKER} ./test-mbrtowc${EXEEXT} 2
diff --git a/tests/test-mbrtowc3.sh b/tests/test-mbrtowc3.sh
deleted file mode 100755 (executable)
index eca8d64..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/bin/sh
-
-# Test whether a specific EUC-JP locale is installed.
-: "${LOCALE_JA=ja_JP}"
-if test $LOCALE_JA = none; then
-  if test -f /usr/bin/localedef; then
-    echo "Skipping test: no traditional japanese locale is installed"
-  else
-    echo "Skipping test: no traditional japanese locale is supported"
-  fi
-  exit 77
-fi
-
-LC_ALL=$LOCALE_JA \
-${CHECKER} ./test-mbrtowc${EXEEXT} 3
diff --git a/tests/test-mbrtowc4.sh b/tests/test-mbrtowc4.sh
deleted file mode 100755 (executable)
index 7da23a3..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/bin/sh
-
-# Test whether a specific GB18030 locale is installed.
-: "${LOCALE_ZH_CN=zh_CN.GB18030}"
-if test $LOCALE_ZH_CN = none; then
-  if test -f /usr/bin/localedef; then
-    echo "Skipping test: no transitional chinese locale is installed"
-  else
-    echo "Skipping test: no transitional chinese locale is supported"
-  fi
-  exit 77
-fi
-
-LC_ALL=$LOCALE_ZH_CN \
-${CHECKER} ./test-mbrtowc${EXEEXT} 4
diff --git a/tests/test-mbrtowc5.sh b/tests/test-mbrtowc5.sh
deleted file mode 100755 (executable)
index 4c6c6fe..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/bin/sh
-
-# Test whether the POSIX locale has encoding errors.
-LC_ALL=C \
-${CHECKER} ./test-mbrtowc${EXEEXT} 5 || exit 1
-LC_ALL=POSIX \
-${CHECKER} ./test-mbrtowc${EXEEXT} 5 || exit 1
-
-exit 0