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

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

index db32bd69200652d91bb76d54d8d163fea2362d54..a11baf1a9791f5b6aca5f25a8d47217ddede3f9a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2023-07-29  Bruno Haible  <bruno@clisp.org>
 
+       mbsnrtoc32s tests: Renumber tests.
+       * tests/test-mbsnrtoc32s-*.sh: Renamed 1 -> 2 -> 3 -> 4 -> 5 -> 1.
+       * tests/test-mbsnrtoc32s.c: Update.
+
        mbstowcs tests: Renumber tests.
        * tests/test-mbstowcs*.sh: Renamed 1 -> 2 -> 3 -> 4 -> 5 -> 1.
        * tests/test-mbstowcs.c: Update.
index e33a90be64126a81c58f3254beed849ebb85a698..e64c2657a7e398c786ca5ff71bd311151d537565 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-mbsnrtoc32s${EXEEXT} 1 || exit 1
+LC_ALL=POSIX \
+${CHECKER} ./test-mbsnrtoc32s${EXEEXT} 1 || exit 1
 
-LC_ALL=$LOCALE_FR \
-${CHECKER} ./test-mbsnrtoc32s${EXEEXT} 1
+exit 0
index c402683e79975858d2fbedfd6919c0b0363d68f4..4636a861ee29501c560f44eaa6f60e40caa68a12 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-mbsnrtoc32s${EXEEXT} 2
index afdfea9fb51bc89b6b97ab0e40d553a1fde0fe4d..d81bc5c9579d533d33fe0d6d18bcd6bfaa20bab4 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-mbsnrtoc32s${EXEEXT} 3
index 4399f1ea1c2b5cc0fad7e8170853090c8821edba..dc4166738eff8bfcd6729bcfa5f979186eee3f2b 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-mbsnrtoc32s${EXEEXT} 4
index 768d10b1e8e61eefbe881740635c758b8b382dc7..f56c1cfcaa6ab06023e9217f4b722916825e7bb9 100755 (executable)
@@ -1,9 +1,15 @@
 #!/bin/sh
 
-# Test whether the POSIX locale has encoding errors.
-LC_ALL=C \
-${CHECKER} ./test-mbsnrtoc32s${EXEEXT} 5 || exit 1
-LC_ALL=POSIX \
-${CHECKER} ./test-mbsnrtoc32s${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-mbsnrtoc32s${EXEEXT} 5
index 342626d2a2419c0c5ec7cc83ba4abb932516233b..09ebf2e76f51488e573b2876a94f6b0aceedc6dd 100644 (file)
@@ -78,8 +78,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)
@@ -102,6 +102,74 @@ main (int argc, char *argv[])
           switch (argv[1][0])
             {
             case '1':
+              /* C or POSIX locale.  */
+              {
+                char input[] = "n/a";
+                memset (&state, '\0', sizeof (mbstate_t));
+
+                src = input;
+                temp_state = state;
+                ret = mbsnrtoc32s (NULL, &src, 4, unlimited ? BUFSIZE : 1, &temp_state);
+                ASSERT (ret == 3);
+                ASSERT (src == input);
+                ASSERT (mbsinit (&state));
+
+                src = input;
+                ret = mbsnrtoc32s (buf, &src, 4, unlimited ? BUFSIZE : 1, &state);
+                ASSERT (ret == (unlimited ? 3 : 1));
+                ASSERT (src == (unlimited ? NULL : input + 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);
+                ASSERT (mbsinit (&state));
+              }
+              {
+                int c;
+                char input[2];
+
+                memset (&state, '\0', sizeof (mbstate_t));
+                for (c = 0; c < 0x100; c++)
+                  if (c != 0)
+                    {
+                      /* We are testing all nonnull bytes.  */
+                      input[0] = c;
+                      input[1] = '\0';
+
+                      src = input;
+                      ret = mbsnrtoc32s (NULL, &src, 2, unlimited ? BUFSIZE : 1, &state);
+                      ASSERT (ret == 1);
+                      ASSERT (src == input);
+                      ASSERT (mbsinit (&state));
+
+                      buf[0] = buf[1] = (char32_t) 0xBADFACE;
+                      src = input;
+                      ret = mbsnrtoc32s (buf, &src, 2, unlimited ? BUFSIZE : 1, &state);
+                      /* POSIX:2018 says regarding mbsnrtowcs: "In the POSIX locale an
+                         [EILSEQ] error cannot occur since all byte values are valid
+                         characters."  It is reasonable to expect mbsnrtoc32s to behave
+                         in the same way.  */
+                      ASSERT (ret == 1);
+                      ASSERT (src == (unlimited ? NULL : input + 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));
+                      ASSERT (mbsinit (&state));
+                    }
+              }
+              break;
+
+            case '2':
               /* Locale encoding is ISO-8859-1 or ISO-8859-15.  */
               {
                 char input[] = "B\374\337er"; /* "Büßer" */
@@ -146,7 +214,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üß😋!" */
@@ -192,7 +260,7 @@ main (int argc, char *argv[])
               }
               break;
 
-            case '3':
+            case '4':
               /* Locale encoding is EUC-JP.  */
               {
                 char input[] = "<\306\374\313\334\270\354>"; /* "<日本語>" */
@@ -245,7 +313,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);
@@ -295,74 +363,6 @@ main (int argc, char *argv[])
               }
               break;
 
-            case '5':
-              /* C or POSIX locale.  */
-              {
-                char input[] = "n/a";
-                memset (&state, '\0', sizeof (mbstate_t));
-
-                src = input;
-                temp_state = state;
-                ret = mbsnrtoc32s (NULL, &src, 4, unlimited ? BUFSIZE : 1, &temp_state);
-                ASSERT (ret == 3);
-                ASSERT (src == input);
-                ASSERT (mbsinit (&state));
-
-                src = input;
-                ret = mbsnrtoc32s (buf, &src, 4, unlimited ? BUFSIZE : 1, &state);
-                ASSERT (ret == (unlimited ? 3 : 1));
-                ASSERT (src == (unlimited ? NULL : input + 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);
-                ASSERT (mbsinit (&state));
-              }
-              {
-                int c;
-                char input[2];
-
-                memset (&state, '\0', sizeof (mbstate_t));
-                for (c = 0; c < 0x100; c++)
-                  if (c != 0)
-                    {
-                      /* We are testing all nonnull bytes.  */
-                      input[0] = c;
-                      input[1] = '\0';
-
-                      src = input;
-                      ret = mbsnrtoc32s (NULL, &src, 2, unlimited ? BUFSIZE : 1, &state);
-                      ASSERT (ret == 1);
-                      ASSERT (src == input);
-                      ASSERT (mbsinit (&state));
-
-                      buf[0] = buf[1] = (char32_t) 0xBADFACE;
-                      src = input;
-                      ret = mbsnrtoc32s (buf, &src, 2, unlimited ? BUFSIZE : 1, &state);
-                      /* POSIX:2018 says regarding mbsnrtowcs: "In the POSIX locale an
-                         [EILSEQ] error cannot occur since all byte values are valid
-                         characters."  It is reasonable to expect mbsnrtoc32s to behave
-                         in the same way.  */
-                      ASSERT (ret == 1);
-                      ASSERT (src == (unlimited ? NULL : input + 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));
-                      ASSERT (mbsinit (&state));
-                    }
-              }
-              break;
-
             default:
               return 1;
             }