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

13 files changed:
ChangeLog
modules/c32rtomb-tests
tests/test-c32rtomb-w32-1.sh [deleted file]
tests/test-c32rtomb-w32-2.sh
tests/test-c32rtomb-w32-3.sh
tests/test-c32rtomb-w32-4.sh
tests/test-c32rtomb-w32-5.sh
tests/test-c32rtomb-w32-6.sh
tests/test-c32rtomb-w32-7.sh
tests/test-c32rtomb-w32-8.sh [new file with mode: 0755]
tests/test-c32rtomb-w32.c
tests/test-c32rtomb.c
tests/test-c32rtomb.sh

index 55188989db58823f21d448829cfa404df1fda0ee..44c83c2bdb52979980dd9d7b1eb3486d4224392b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2023-07-29  Bruno Haible  <bruno@clisp.org>
 
+       c32rtomb tests: Renumber tests.
+       * tests/test-c32rtomb.sh: Renamed 1 -> 2 -> 3 -> 4 -> 5 -> 1.
+       * tests/test-c32rtomb.c: Update.
+       * tests/test-c32rtomb-w32-*.sh: Renamed 1 -> 2 -> 3 -> 5 -> 7 -> 4 -> 6
+       -> 8.
+       * tests/test-c32rtomb-w32.c: Update.
+       * modules/c32rtomb-tests: Update.
+
        btoc32 tests: Renumber tests.
        * tests/test-btoc32-*.sh: Renamed 1 -> 2 -> 3 -> 1.
        * tests/test-btoc32.c: Update.
index 9a1e0dcedeb0b605fec05a4237793401fd1709d7..4051a212c9357d629ebb8bd940e830fe98a6b84e 100644 (file)
@@ -1,13 +1,13 @@
 Files:
 tests/test-c32rtomb.sh
 tests/test-c32rtomb.c
-tests/test-c32rtomb-w32-1.sh
 tests/test-c32rtomb-w32-2.sh
 tests/test-c32rtomb-w32-3.sh
 tests/test-c32rtomb-w32-4.sh
 tests/test-c32rtomb-w32-5.sh
 tests/test-c32rtomb-w32-6.sh
 tests/test-c32rtomb-w32-7.sh
+tests/test-c32rtomb-w32-8.sh
 tests/test-c32rtomb-w32.c
 tests/signature.h
 tests/macros.h
@@ -31,9 +31,9 @@ gt_LOCALE_ZH_CN
 Makefile.am:
 TESTS += \
   test-c32rtomb.sh \
-  test-c32rtomb-w32-1.sh test-c32rtomb-w32-2.sh test-c32rtomb-w32-3.sh \
-  test-c32rtomb-w32-4.sh test-c32rtomb-w32-5.sh test-c32rtomb-w32-6.sh \
-  test-c32rtomb-w32-7.sh
+  test-c32rtomb-w32-2.sh test-c32rtomb-w32-3.sh test-c32rtomb-w32-4.sh \
+  test-c32rtomb-w32-5.sh test-c32rtomb-w32-6.sh test-c32rtomb-w32-7.sh \
+  test-c32rtomb-w32-8.sh
 TESTS_ENVIRONMENT += \
   LOCALE_FR='@LOCALE_FR@' \
   LOCALE_FR_UTF8='@LOCALE_FR_UTF8@' \
diff --git a/tests/test-c32rtomb-w32-1.sh b/tests/test-c32rtomb-w32-1.sh
deleted file mode 100755 (executable)
index e797d0e..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/bin/sh
-
-# Test a CP1252 locale.
-${CHECKER} ./test-c32rtomb-w32${EXEEXT} French_France 1252
index 1b63d472aa9fa04d4c771e6446141117f573b33b..e797d0e5eb7f648da18c02c870636c8ee730c176 100755 (executable)
@@ -1,4 +1,4 @@
 #!/bin/sh
 
-# Test a CP1256 locale.
-${CHECKER} ./test-c32rtomb-w32${EXEEXT} "Arabic_Saudi Arabia" 1256
+# Test a CP1252 locale.
+${CHECKER} ./test-c32rtomb-w32${EXEEXT} French_France 1252
index ff59a8727e91fc64df23a01e619991ae69b7afe2..1b63d472aa9fa04d4c771e6446141117f573b33b 100755 (executable)
@@ -1,4 +1,4 @@
 #!/bin/sh
 
-# Test a CP932 locale.
-${CHECKER} ./test-c32rtomb-w32${EXEEXT} Japanese_Japan 932
+# Test a CP1256 locale.
+${CHECKER} ./test-c32rtomb-w32${EXEEXT} "Arabic_Saudi Arabia" 1256
index 3cf340655272bc1cba392cf690852248e01a1b24..3c0f3db48f679678b71f1bce7389c5c3166493e6 100755 (executable)
@@ -1,4 +1,4 @@
 #!/bin/sh
 
-# Test a CP950 locale.
-${CHECKER} ./test-c32rtomb-w32${EXEEXT} Chinese_Taiwan 950
+# Test some UTF-8 locales.
+${CHECKER} ./test-c32rtomb-w32${EXEEXT} French_France Japanese_Japan Chinese_Taiwan Chinese_China 65001
index 2174c0b572be35308523ce833b8e845a714f30c4..ff59a8727e91fc64df23a01e619991ae69b7afe2 100755 (executable)
@@ -1,4 +1,4 @@
 #!/bin/sh
 
-# Test a CP936 locale.
-${CHECKER} ./test-c32rtomb-w32${EXEEXT} Chinese_China 936
+# Test a CP932 locale.
+${CHECKER} ./test-c32rtomb-w32${EXEEXT} Japanese_Japan 932
index b7e77b28d14fa8cad66ae45b7cf3e77c81eba8ae..3cf340655272bc1cba392cf690852248e01a1b24 100755 (executable)
@@ -1,4 +1,4 @@
 #!/bin/sh
 
-# Test a GB18030 locale.
-${CHECKER} ./test-c32rtomb-w32${EXEEXT} Chinese_China 54936
+# Test a CP950 locale.
+${CHECKER} ./test-c32rtomb-w32${EXEEXT} Chinese_Taiwan 950
index 3c0f3db48f679678b71f1bce7389c5c3166493e6..2174c0b572be35308523ce833b8e845a714f30c4 100755 (executable)
@@ -1,4 +1,4 @@
 #!/bin/sh
 
-# Test some UTF-8 locales.
-${CHECKER} ./test-c32rtomb-w32${EXEEXT} French_France Japanese_Japan Chinese_Taiwan Chinese_China 65001
+# Test a CP936 locale.
+${CHECKER} ./test-c32rtomb-w32${EXEEXT} Chinese_China 936
diff --git a/tests/test-c32rtomb-w32-8.sh b/tests/test-c32rtomb-w32-8.sh
new file mode 100755 (executable)
index 0000000..b7e77b2
--- /dev/null
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+# Test a GB18030 locale.
+${CHECKER} ./test-c32rtomb-w32${EXEEXT} Chinese_China 54936
index 06cfa1e44f22936b1d1ecc4cc8ac5b7732e5c937..dbf1440e632384385386b98fcbb6a27a2a02516a 100644 (file)
@@ -184,6 +184,32 @@ 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 "s\303\274\303\237\360\237\230\213!"; "süß😋!" */
+        memset (buf, 'x', 8);
+        ret = c32rtomb (buf, 0x00FC, NULL);
+        ASSERT (ret == 2);
+        ASSERT (memcmp (buf, "\303\274", 2) == 0);
+        ASSERT (buf[2] == 'x');
+
+        memset (buf, 'x', 8);
+        ret = c32rtomb (buf, 0x00DF, NULL);
+        ASSERT (ret == 2);
+        ASSERT (memcmp (buf, "\303\237", 2) == 0);
+        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 (buf[4] == 'x');
+      }
+      return 0;
+
     case 932:
       /* Locale encoding is CP932, similar to Shift_JIS.  */
       {
@@ -282,32 +308,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 "s\303\274\303\237\360\237\230\213!"; "süß😋!" */
-        memset (buf, 'x', 8);
-        ret = c32rtomb (buf, 0x00FC, NULL);
-        ASSERT (ret == 2);
-        ASSERT (memcmp (buf, "\303\274", 2) == 0);
-        ASSERT (buf[2] == 'x');
-
-        memset (buf, 'x', 8);
-        ret = c32rtomb (buf, 0x00DF, NULL);
-        ASSERT (ret == 2);
-        ASSERT (memcmp (buf, "\303\237", 2) == 0);
-        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 (buf[4] == 'x');
-      }
-      return 0;
-
     default:
       return 1;
     }
index 896987318178368f3bbf81a0a3f84f1d7642c7d1..4c39fd54a6ec4f0fb74317a0b262eb4f630ae24c 100644 (file)
@@ -119,6 +119,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" */
@@ -128,7 +132,7 @@ main (int argc, char *argv[])
         }
         return 0;
 
-      case '2':
+      case '3':
         /* Locale encoding is UTF-8.  */
         {
           const char input[] = "s\303\274\303\237\360\237\230\213!"; /* "süß😋!" */
@@ -139,7 +143,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>"; /* "<日本語>" */
@@ -150,7 +154,7 @@ main (int argc, char *argv[])
         }
         return 0;
 
-      case '4':
+      case '5':
         /* Locale encoding is GB18030.  */
         #if GL_CHAR32_T_IS_UNICODE && (defined __NetBSD__ || defined __sun)
         fputs ("Skipping test: The GB18030 converter in this system's iconv is broken.\n", stderr);
@@ -164,10 +168,6 @@ main (int argc, char *argv[])
           check_character (input + 7, 4);
         }
         return 0;
-
-      case '5':
-        /* C locale; tested above.  */
-        return 0;
       }
 
   return 1;
index 3239935332bec56655358ac484a074d8ea9bb0a9..e5236c976ab436d940eab52a93572775353c57e5 100755 (executable)
@@ -1,10 +1,14 @@
 #!/bin/sh
 
+# Test in the POSIX locale.
+LC_ALL=C     ${CHECKER} ./test-c32rtomb${EXEEXT} 1 || exit 1
+LC_ALL=POSIX ${CHECKER} ./test-c32rtomb${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-c32rtomb${EXEEXT} 1 \
+  ${CHECKER} ./test-c32rtomb${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-c32rtomb${EXEEXT} 2 \
+  ${CHECKER} ./test-c32rtomb${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-c32rtomb${EXEEXT} 3 \
+  ${CHECKER} ./test-c32rtomb${EXEEXT} 4 \
   || exit 1
 fi
 
@@ -28,15 +32,11 @@ fi
 : "${LOCALE_ZH_CN=zh_CN.GB18030}"
 if test $LOCALE_ZH_CN != none; then
   LC_ALL=$LOCALE_ZH_CN \
-  ${CHECKER} ./test-c32rtomb${EXEEXT} 4
+  ${CHECKER} ./test-c32rtomb${EXEEXT} 5
   case $? in
     0 | 77) ;;
     *) exit 1 ;;
   esac
 fi
 
-# Test in the POSIX locale.
-LC_ALL=C     ${CHECKER} ./test-c32rtomb${EXEEXT} 5 || exit 1
-LC_ALL=POSIX ${CHECKER} ./test-c32rtomb${EXEEXT} 5 || exit 1
-
 exit 0