]> Savannah Git Hosting - gnulib.git/commitdiff
wcrtomb tests: Renumber tests.
authorBruno Haible <bruno@clisp.org>
Sat, 29 Jul 2023 22:48:14 +0000 (00:48 +0200)
committerBruno Haible <bruno@clisp.org>
Sat, 29 Jul 2023 23:41:44 +0000 (01:41 +0200)
* 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.

13 files changed:
ChangeLog
modules/wcrtomb-tests
tests/test-wcrtomb-w32-1.sh [deleted file]
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 [new file with mode: 0755]
tests/test-wcrtomb-w32.c
tests/test-wcrtomb.c
tests/test-wcrtomb.sh

index e85ddeff151c25c3f780cf6b0a99aabfa44c30e5..4a26a9919481c4fbf24d0fb70bd4e4e7c2a77af2 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2023-07-29  Bruno Haible  <bruno@clisp.org>
 
+       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.
index 56ab65d09a33b07e3015643d1aba3a062fb81079..3baa3f30c54ead0c8a2fb61417e1cd48cb94488f 100644 (file)
@@ -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 (executable)
index b01c543..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/bin/sh
-
-# Test a CP1252 locale.
-${CHECKER} ./test-wcrtomb-w32${EXEEXT} French_France 1252
index 5481634d4065fcf39164abe8d7c805a52cdc426c..b01c5436b46b673ed75b416c770a6b8d62c850be 100755 (executable)
@@ -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
index f35879da3f0100ce22865b50a6f7cc330b7eec42..5481634d4065fcf39164abe8d7c805a52cdc426c 100755 (executable)
@@ -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
index 8eec6cbc307e7106e11598ecda2ece7833581ead..fb04e5838d12f7814d682ceccdcfd0378120364e 100755 (executable)
@@ -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
index fd47d6fa9701d4c6bd6a436b12259b43c34ffe93..f35879da3f0100ce22865b50a6f7cc330b7eec42 100755 (executable)
@@ -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
index 802237d1aa2524d48152a7340625bb07c5a3e6a9..8eec6cbc307e7106e11598ecda2ece7833581ead 100755 (executable)
@@ -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
index fb04e5838d12f7814d682ceccdcfd0378120364e..fd47d6fa9701d4c6bd6a436b12259b43c34ffe93 100755 (executable)
@@ -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 (executable)
index 0000000..802237d
--- /dev/null
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+# Test a GB18030 locale.
+${CHECKER} ./test-wcrtomb-w32${EXEEXT} Chinese_China 54936
index 4e75fe0e738d03691cbdd7ae0a3e9f977760932f..4d00d0823688ffd06ee930b1b51a69ca2d47dcb0 100644 (file)
@@ -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;
     }
index 6ec075083e05a5f6e79c4b122d9613bbda077dd6..6211efc057c384030a0e9285986b86f5ea33bdaf 100644 (file)
@@ -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;
index 01d8d53b36f10a1af6469fc190888ad654dbdf6b..b4604612bc157f4efdd8ba99e1c0b46f034ce8b9 100755 (executable)
@@ -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