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

ChangeLog
tests/test-mbstoc32s-1.sh
tests/test-mbstoc32s-2.sh
tests/test-mbstoc32s-3.sh
tests/test-mbstoc32s-4.sh
tests/test-mbstoc32s-5.sh
tests/test-mbstoc32s.c

index 65892c547e9c65c4fa021b00b9fef4938dcc6ee7..e85ddeff151c25c3f780cf6b0a99aabfa44c30e5 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2023-07-29  Bruno Haible  <bruno@clisp.org>
 
+       mbstoc32s tests: Renumber tests.
+       * tests/test-mbstoc32s-*.sh: Renamed 1 -> 2 -> 3 -> 4 -> 5 -> 1.
+       * tests/test-mbstoc32s.c: Update.
+
        mbsrtoc32s tests: Renumber tests.
        * tests/test-mbsrtoc32s-*.sh: Renamed 1 -> 2 -> 3 -> 4 -> 5 -> 1.
        * tests/test-mbsrtoc32s.c: Update.
index 9fa0ae98338398741ad357e33e4606310a0aa9c5..0e3c7bc0c8009b20ab82100272f579a5810b024d 100755 (executable)
@@ -1,15 +1,9 @@
 #!/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
+# Test whether the POSIX locale has encoding errors.
+LC_ALL=C \
+${CHECKER} ./test-mbstoc32s${EXEEXT} 1 || exit 1
+LC_ALL=POSIX \
+${CHECKER} ./test-mbstoc32s${EXEEXT} 1 || exit 1
 
-LC_ALL=$LOCALE_FR \
-${CHECKER} ./test-mbstoc32s${EXEEXT} 1
+exit 0
index 80d54a9e8ecdfef5619b27c2a42805e47d4eb422..e953dbe976f34c1e7e33e17d1c93442804fa0ea0 100755 (executable)
@@ -1,15 +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
+# 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 french Unicode locale is installed"
+    echo "Skipping test: no traditional french locale is installed"
   else
-    echo "Skipping test: no french Unicode locale is supported"
+    echo "Skipping test: no traditional french locale is supported"
   fi
   exit 77
 fi
 
-LC_ALL=$LOCALE_FR_UTF8 \
+LC_ALL=$LOCALE_FR \
 ${CHECKER} ./test-mbstoc32s${EXEEXT} 2
index a69decd165032d36fbd5359231e7b52298b132d2..0dc4d263e9cb1e6a77dac685f06fa51c8013af04 100755 (executable)
@@ -1,15 +1,15 @@
 #!/bin/sh
 
-# Test whether a specific EUC-JP locale is installed.
-: "${LOCALE_JA=ja_JP}"
-if test $LOCALE_JA = none; then
+# 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 traditional japanese locale is installed"
+    echo "Skipping test: no french Unicode locale is installed"
   else
-    echo "Skipping test: no traditional japanese locale is supported"
+    echo "Skipping test: no french Unicode locale is supported"
   fi
   exit 77
 fi
 
-LC_ALL=$LOCALE_JA \
+LC_ALL=$LOCALE_FR_UTF8 \
 ${CHECKER} ./test-mbstoc32s${EXEEXT} 3
index 9fc9a69f01ef3b71c926de663ac6bfdc6b51d520..7665d6ff9e94fffa70884c7f2318c1e67df8889e 100755 (executable)
@@ -1,15 +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
+# 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 transitional chinese locale is installed"
+    echo "Skipping test: no traditional japanese locale is installed"
   else
-    echo "Skipping test: no transitional chinese locale is supported"
+    echo "Skipping test: no traditional japanese locale is supported"
   fi
   exit 77
 fi
 
-LC_ALL=$LOCALE_ZH_CN \
+LC_ALL=$LOCALE_JA \
 ${CHECKER} ./test-mbstoc32s${EXEEXT} 4
index edb36432b88ff9c007aa82aa9401e87f713ba8bd..192d829e26f63322a24d1c60151424833bf536b9 100755 (executable)
@@ -1,9 +1,15 @@
 #!/bin/sh
 
-# Test whether the POSIX locale has encoding errors.
-LC_ALL=C \
-${CHECKER} ./test-mbstoc32s${EXEEXT} 5 || exit 1
-LC_ALL=POSIX \
-${CHECKER} ./test-mbstoc32s${EXEEXT} 5 || exit 1
+# 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
 
-exit 0
+LC_ALL=$LOCALE_ZH_CN \
+${CHECKER} ./test-mbstoc32s${EXEEXT} 5
index 09a1e072cf4b7fb5e17568b8ff9548f417a41304..b0b4f5a719887295008b7ef8c4cf3a4dd0d00f26 100644 (file)
@@ -69,8 +69,8 @@ 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)
@@ -92,6 +92,63 @@ main (int argc, char *argv[])
           switch (argv[1][0])
             {
             case '1':
+              /* C or POSIX locale.  */
+              {
+                char input[] = "n/a";
+
+                src = input;
+                ret = mbstoc32s (NULL, src, unlimited ? BUFSIZE : 1);
+                ASSERT (ret == 3);
+
+                src = input;
+                ret = mbstoc32s (buf, src, unlimited ? BUFSIZE : 1);
+                ASSERT (ret == (unlimited ? 3 : 1));
+                ASSERT (buf[0] == 'n');
+                if (unlimited)
+                  {
+                    ASSERT (buf[1] == '/');
+                    ASSERT (buf[2] == 'a');
+                    ASSERT (buf[3] == 0);
+                    ASSERT (buf[4] == (char32_t) 0xBADFACE);
+                  }
+                else
+                  ASSERT (buf[1] == (char32_t) 0xBADFACE);
+              }
+              {
+                int c;
+                char input[2];
+
+                for (c = 0; c < 0x100; c++)
+                  if (c != 0)
+                    {
+                      /* We are testing all nonnull bytes.  */
+                      input[0] = c;
+                      input[1] = '\0';
+
+                      src = input;
+                      ret = mbstoc32s (NULL, src, unlimited ? BUFSIZE : 1);
+                      ASSERT (ret == 1);
+
+                      buf[0] = buf[1] = (char32_t) 0xBADFACE;
+                      src = input;
+                      ret = mbstoc32s (buf, src, unlimited ? BUFSIZE : 1);
+                      /* POSIX:2018 says regarding mbstowcs: "In the POSIX locale an
+                         [EILSEQ] error cannot occur since all byte values are valid
+                         characters."  It is reasonable to expect mbstoc32s to behave
+                         in the same way.  */
+                      ASSERT (ret == 1);
+                      if (c < 0x80)
+                        /* c is an ASCII character.  */
+                        ASSERT (buf[0] == 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 (buf[0] == (btoc32 (c) == 0xDF00 + c ? btoc32 (c) : c));
+                    }
+              }
+              break;
+
+            case '2':
               /* Locale encoding is ISO-8859-1 or ISO-8859-15.  */
               {
                 char input[] = "B\374\337er"; /* "Büßer" */
@@ -128,7 +185,7 @@ main (int argc, char *argv[])
               }
               break;
 
-            case '2':
+            case '3':
               /* Locale encoding is UTF-8.  */
               {
                 char input[] = "s\303\274\303\237\360\237\230\213!"; /* "süß😋!" */
@@ -166,7 +223,7 @@ main (int argc, char *argv[])
               }
               break;
 
-            case '3':
+            case '4':
               /* Locale encoding is EUC-JP.  */
               {
                 char input[] = "<\306\374\313\334\270\354>"; /* "<日本語>" */
@@ -204,7 +261,7 @@ main (int argc, char *argv[])
               }
               break;
 
-            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);
@@ -245,63 +302,6 @@ main (int argc, char *argv[])
               }
               break;
 
-            case '5':
-              /* C or POSIX locale.  */
-              {
-                char input[] = "n/a";
-
-                src = input;
-                ret = mbstoc32s (NULL, src, unlimited ? BUFSIZE : 1);
-                ASSERT (ret == 3);
-
-                src = input;
-                ret = mbstoc32s (buf, src, unlimited ? BUFSIZE : 1);
-                ASSERT (ret == (unlimited ? 3 : 1));
-                ASSERT (buf[0] == 'n');
-                if (unlimited)
-                  {
-                    ASSERT (buf[1] == '/');
-                    ASSERT (buf[2] == 'a');
-                    ASSERT (buf[3] == 0);
-                    ASSERT (buf[4] == (char32_t) 0xBADFACE);
-                  }
-                else
-                  ASSERT (buf[1] == (char32_t) 0xBADFACE);
-              }
-              {
-                int c;
-                char input[2];
-
-                for (c = 0; c < 0x100; c++)
-                  if (c != 0)
-                    {
-                      /* We are testing all nonnull bytes.  */
-                      input[0] = c;
-                      input[1] = '\0';
-
-                      src = input;
-                      ret = mbstoc32s (NULL, src, unlimited ? BUFSIZE : 1);
-                      ASSERT (ret == 1);
-
-                      buf[0] = buf[1] = (char32_t) 0xBADFACE;
-                      src = input;
-                      ret = mbstoc32s (buf, src, unlimited ? BUFSIZE : 1);
-                      /* POSIX:2018 says regarding mbstowcs: "In the POSIX locale an
-                         [EILSEQ] error cannot occur since all byte values are valid
-                         characters."  It is reasonable to expect mbstoc32s to behave
-                         in the same way.  */
-                      ASSERT (ret == 1);
-                      if (c < 0x80)
-                        /* c is an ASCII character.  */
-                        ASSERT (buf[0] == 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 (buf[0] == (btoc32 (c) == 0xDF00 + c ? btoc32 (c) : c));
-                    }
-              }
-              break;
-
             default:
               return 1;
             }