Back to index

glibc  2.9
bug-regex19.c
Go to the documentation of this file.
00001 /* Regular expression tests.
00002    Copyright (C) 2003, 2005 Free Software Foundation, Inc.
00003    This file is part of the GNU C Library.
00004    Contributed by Jakub Jelinek <jakub@redhat.com>, 2003.
00005 
00006    The GNU C Library is free software; you can redistribute it and/or
00007    modify it under the terms of the GNU Lesser General Public
00008    License as published by the Free Software Foundation; either
00009    version 2.1 of the License, or (at your option) any later version.
00010 
00011    The GNU C Library is distributed in the hope that it will be useful,
00012    but WITHOUT ANY WARRANTY; without even the implied warranty of
00013    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014    Lesser General Public License for more details.
00015 
00016    You should have received a copy of the GNU Lesser General Public
00017    License along with the GNU C Library; if not, write to the Free
00018    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00019    02111-1307 USA.  */
00020 
00021 #include <sys/types.h>
00022 #include <mcheck.h>
00023 #include <regex.h>
00024 #include <stdio.h>
00025 #include <stdlib.h>
00026 #include <string.h>
00027 #include <locale.h>
00028 
00029 #define BRE RE_SYNTAX_POSIX_BASIC
00030 #define ERE RE_SYNTAX_POSIX_EXTENDED
00031 
00032 static struct test_s
00033 {
00034   int syntax;
00035   const char *pattern;
00036   const char *string;
00037   int start, res;
00038 } tests[] = {
00039   {BRE, "\\<A", "CBAA", 0, -1},
00040   {BRE, "\\<A", "CBAA", 2, -1},
00041   {BRE, "A\\>", "CAAB", 1, -1},
00042   {BRE, "\\bA", "CBAA", 0, -1},
00043   {BRE, "\\bA", "CBAA", 2, -1},
00044   {BRE, "A\\b", "CAAB", 1, -1},
00045   {BRE, "\\<A", "AA", 0, 0},
00046   {BRE, "\\<A", "C-AA", 2, 2},
00047   {BRE, "A\\>", "CAA-", 1, 2},
00048   {BRE, "A\\>", "CAA", 1, 2},
00049   {BRE, "\\bA", "AA", 0, 0},
00050   {BRE, "\\bA", "C-AA", 2, 2},
00051   {BRE, "A\\b", "CAA-", 1, 2},
00052   {BRE, "A\\b", "CAA", 1, 2},
00053   {BRE, "\\<[A]", "CBAA", 0, -1},
00054   {BRE, "\\<[A]", "CBAA", 2, -1},
00055   {BRE, "[A]\\>", "CAAB", 1, -1},
00056   {BRE, "\\b[A]", "CBAA", 0, -1},
00057   {BRE, "\\b[A]", "CBAA", 2, -1},
00058   {BRE, "[A]\\b", "CAAB", 1, -1},
00059   {BRE, "\\<[A]", "AA", 0, 0},
00060   {BRE, "\\<[A]", "C-AA", 2, 2},
00061   {BRE, "[A]\\>", "CAA-", 1, 2},
00062   {BRE, "[A]\\>", "CAA", 1, 2},
00063   {BRE, "\\b[A]", "AA", 0, 0},
00064   {BRE, "\\b[A]", "C-AA", 2, 2},
00065   {BRE, "[A]\\b", "CAA-", 1, 2},
00066   {BRE, "[A]\\b", "CAA", 1, 2},
00067   {ERE, "\\b(A|!|.B)", "A=AC", 0, 0},
00068   {ERE, "\\b(A|!|.B)", "=AC", 0, 1},
00069   {ERE, "\\b(A|!|.B)", "!AC", 0, 1},
00070   {ERE, "\\b(A|!|.B)", "=AB", 0, 1},
00071   {ERE, "\\b(A|!|.B)", "DA!C", 0, 2},
00072   {ERE, "\\b(A|!|.B)", "=CB", 0, 1},
00073   {ERE, "\\b(A|!|.B)", "!CB", 0, 1},
00074   {ERE, "\\b(A|!|.B)", "D,B", 0, 1},
00075   {ERE, "\\b(A|!|.B)", "!.C", 0, -1},
00076   {ERE, "\\b(A|!|.B)", "BCB", 0, -1},
00077   {ERE, "(A|\\b)(A|B|C)", "DAAD", 0, 1},
00078   {ERE, "(A|\\b)(A|B|C)", "DABD", 0, 1},
00079   {ERE, "(A|\\b)(A|B|C)", "AD", 0, 0},
00080   {ERE, "(A|\\b)(A|B|C)", "C!", 0, 0},
00081   {ERE, "(A|\\b)(A|B|C)", "D,B", 0, 2},
00082   {ERE, "(A|\\b)(A|B|C)", "DA?A", 0, 3},
00083   {ERE, "(A|\\b)(A|B|C)", "BBC", 0, 0},
00084   {ERE, "(A|\\b)(A|B|C)", "DA", 0, -1},
00085   {ERE, "(!|\\b)(!|=|~)", "A!=\\", 0, 1},
00086   {ERE, "(!|\\b)(!|=|~)", "/!=A", 0, 1},
00087   {ERE, "(!|\\b)(!|=|~)", "A=A", 0, 1},
00088   {ERE, "(!|\\b)(!|=|~)", "==!=", 0, 2},
00089   {ERE, "(!|\\b)(!|=|~)", "==C~", 0, 3},
00090   {ERE, "(!|\\b)(!|=|~)", "=~=", 0, -1},
00091   {ERE, "(!|\\b)(!|=|~)", "~!", 0, -1},
00092   {ERE, "(!|\\b)(!|=|~)", "~=~", 0, -1},
00093   {ERE, "(\\b|A.)[ABC]", "AC", 0, 0},
00094   {ERE, "(\\b|A.)[ABC]", "=A", 0, 1},
00095   {ERE, "(\\b|A.)[ABC]", "DACC", 0, 1},
00096   {ERE, "(\\b|A.)[A~C]", "AC", 0, 0},
00097   {ERE, "(\\b|A.)[A~C]", "=A", 0, 1},
00098   {ERE, "(\\b|A.)[A~C]", "DACC", 0, 1},
00099   {ERE, "(\\b|A.)[A~C]", "B!A=", 0, 2},
00100   {ERE, "(\\b|A.)[A~C]", "B~C", 0, 1},
00101   {ERE, ".\\b.", "AA~", 0, 1},
00102   {ERE, ".\\b.", "=A=", 0, 0},
00103   {ERE, ".\\b.", "==", 0, -1},
00104   {ERE, ".\\b.", "ABA", 0, -1},
00105   {ERE, "[^k]\\b[^k]", "AA~", 0, 1},
00106   {ERE, "[^k]\\b[^k]", "=A=", 0, 0},
00107   {ERE, "[^k]\\b[^k]", "Ak~kA~", 0, 4},
00108   {ERE, "[^k]\\b[^k]", "==", 0, -1},
00109   {ERE, "[^k]\\b[^k]", "ABA", 0, -1},
00110   {ERE, "[^k]\\b[^k]", "Ak~", 0, -1},
00111   {ERE, "[^k]\\b[^k]", "k=k", 0, -1},
00112   {ERE, "[^C]\\b[^C]", "AA~", 0, 1},
00113   {ERE, "[^C]\\b[^C]", "=A=", 0, 0},
00114   {ERE, "[^C]\\b[^C]", "AC~CA~", 0, 4},
00115   {ERE, "[^C]\\b[^C]", "==", 0, -1},
00116   {ERE, "[^C]\\b[^C]", "ABA", 0, -1},
00117   {ERE, "[^C]\\b[^C]", "AC~", 0, -1},
00118   {ERE, "[^C]\\b[^C]", "C=C", 0, -1},
00119   {ERE, "\\<(A|!|.B)", "A=AC", 0, 0},
00120   {ERE, "\\<(A|!|.B)", "=AC", 0, 1},
00121   {ERE, "\\<(A|!|.B)", "!AC", 0, 1},
00122   {ERE, "\\<(A|!|.B)", "=AB", 0, 1},
00123   {ERE, "\\<(A|!|.B)", "=CB", 0, 1},
00124   {ERE, "\\<(A|!|.B)", "!CB", 0, 1},
00125   {ERE, "\\<(A|!|.B)", "DA!C", 0, -1},
00126   {ERE, "\\<(A|!|.B)", "D,B", 0, -1},
00127   {ERE, "\\<(A|!|.B)", "!.C", 0, -1},
00128   {ERE, "\\<(A|!|.B)", "BCB", 0, -1},
00129   {ERE, "(A|\\<)(A|B|C)", "DAAD", 0, 1},
00130   {ERE, "(A|\\<)(A|B|C)", "DABD", 0, 1},
00131   {ERE, "(A|\\<)(A|B|C)", "AD", 0, 0},
00132   {ERE, "(A|\\<)(A|B|C)", "C!", 0, 0},
00133   {ERE, "(A|\\<)(A|B|C)", "D,B", 0, 2},
00134   {ERE, "(A|\\<)(A|B|C)", "DA?A", 0, 3},
00135   {ERE, "(A|\\<)(A|B|C)", "BBC", 0, 0},
00136   {ERE, "(A|\\<)(A|B|C)", "DA", 0, -1},
00137   {ERE, "(!|\\<)(!|=|~)", "A!=\\", 0, 1},
00138   {ERE, "(!|\\<)(!|=|~)", "/!=A", 0, 1},
00139   {ERE, "(!|\\<)(!|=|~)", "==!=", 0, 2},
00140   {ERE, "(!|\\<)(!|=|~)", "==C~", 0, -1},
00141   {ERE, "(!|\\<)(!|=|~)", "A=A", 0, -1},
00142   {ERE, "(!|\\<)(!|=|~)", "=~=", 0, -1},
00143   {ERE, "(!|\\<)(!|=|~)", "~!", 0, -1},
00144   {ERE, "(!|\\<)(!|=|~)", "~=~", 0, -1},
00145   {ERE, "(\\<|A.)[ABC]", "AC", 0, 0},
00146   {ERE, "(\\<|A.)[ABC]", "=A", 0, 1},
00147   {ERE, "(\\<|A.)[ABC]", "DACC", 0, 1},
00148   {ERE, "(\\<|A.)[A~C]", "AC", 0, 0},
00149   {ERE, "(\\<|A.)[A~C]", "=A", 0, 1},
00150   {ERE, "(\\<|A.)[A~C]", "DACC", 0, 1},
00151   {ERE, "(\\<|A.)[A~C]", "B!A=", 0, 2},
00152   {ERE, "(\\<|A.)[A~C]", "B~C", 0, 2},
00153   {ERE, ".\\<.", "=A=", 0, 0},
00154   {ERE, ".\\<.", "AA~", 0, -1},
00155   {ERE, ".\\<.", "==", 0, -1},
00156   {ERE, ".\\<.", "ABA", 0, -1},
00157   {ERE, "[^k]\\<[^k]", "=k=A=", 0, 2},
00158   {ERE, "[^k]\\<[^k]", "kk~", 0, -1},
00159   {ERE, "[^k]\\<[^k]", "==", 0, -1},
00160   {ERE, "[^k]\\<[^k]", "ABA", 0, -1},
00161   {ERE, "[^k]\\<[^k]", "=k=", 0, -1},
00162   {ERE, "[^C]\\<[^C]", "=C=A=", 0, 2},
00163   {ERE, "[^C]\\<[^C]", "CC~", 0, -1},
00164   {ERE, "[^C]\\<[^C]", "==", 0, -1},
00165   {ERE, "[^C]\\<[^C]", "ABA", 0, -1},
00166   {ERE, "[^C]\\<[^C]", "=C=", 0, -1},
00167   {ERE, ".\\B.", "ABA", 0, 0},
00168   {ERE, ".\\B.", "=BDC", 0, 1},
00169   {ERE, "[^k]\\B[^k]", "kkkABA", 0, 3},
00170   {ERE, "[^k]\\B[^k]", "kBk", 0, -1},
00171   {ERE, "[^C]\\B[^C]", "CCCABA", 0, 3},
00172   {ERE, "[^C]\\B[^C]", "CBC", 0, -1},
00173   {ERE, ".(\\b|\\B).", "=~AB", 0, 0},
00174   {ERE, ".(\\b|\\B).", "A=C", 0, 0},
00175   {ERE, ".(\\b|\\B).", "ABC", 0, 0},
00176   {ERE, ".(\\b|\\B).", "=~\\!", 0, 0},
00177   {ERE, "[^k](\\b|\\B)[^k]", "=~AB", 0, 0},
00178   {ERE, "[^k](\\b|\\B)[^k]", "A=C", 0, 0},
00179   {ERE, "[^k](\\b|\\B)[^k]", "ABC", 0, 0},
00180   {ERE, "[^k](\\b|\\B)[^k]", "=~kBD", 0, 0},
00181   {ERE, "[^k](\\b|\\B)[^k]", "=~\\!", 0, 0},
00182   {ERE, "[^k](\\b|\\B)[^k]", "=~kB", 0, 0},
00183   {ERE, "[^C](\\b|\\B)[^C]", "=~AB", 0, 0},
00184   {ERE, "[^C](\\b|\\B)[^C]", "A=C", 0, 0},
00185   {ERE, "[^C](\\b|\\B)[^C]", "ABC", 0, 0},
00186   {ERE, "[^C](\\b|\\B)[^C]", "=~CBD", 0, 0},
00187   {ERE, "[^C](\\b|\\B)[^C]", "=~\\!", 0, 0},
00188   {ERE, "[^C](\\b|\\B)[^C]", "=~CB", 0, 0},
00189   {ERE, "\\b([A]|[!]|.B)", "A=AC", 0, 0},
00190   {ERE, "\\b([A]|[!]|.B)", "=AC", 0, 1},
00191   {ERE, "\\b([A]|[!]|.B)", "!AC", 0, 1},
00192   {ERE, "\\b([A]|[!]|.B)", "=AB", 0, 1},
00193   {ERE, "\\b([A]|[!]|.B)", "DA!C", 0, 2},
00194   {ERE, "\\b([A]|[!]|.B)", "=CB", 0, 1},
00195   {ERE, "\\b([A]|[!]|.B)", "!CB", 0, 1},
00196   {ERE, "\\b([A]|[!]|.B)", "D,B", 0, 1},
00197   {ERE, "\\b([A]|[!]|.B)", "!.C", 0, -1},
00198   {ERE, "\\b([A]|[!]|.B)", "BCB", 0, -1},
00199   {ERE, "([A]|\\b)([A]|[B]|[C])", "DAAD", 0, 1},
00200   {ERE, "([A]|\\b)([A]|[B]|[C])", "DABD", 0, 1},
00201   {ERE, "([A]|\\b)([A]|[B]|[C])", "AD", 0, 0},
00202   {ERE, "([A]|\\b)([A]|[B]|[C])", "C!", 0, 0},
00203   {ERE, "([A]|\\b)([A]|[B]|[C])", "D,B", 0, 2},
00204   {ERE, "([A]|\\b)([A]|[B]|[C])", "DA?A", 0, 3},
00205   {ERE, "([A]|\\b)([A]|[B]|[C])", "BBC", 0, 0},
00206   {ERE, "([A]|\\b)([A]|[B]|[C])", "DA", 0, -1},
00207   {ERE, "([!]|\\b)([!]|[=]|[~])", "A!=\\", 0, 1},
00208   {ERE, "([!]|\\b)([!]|[=]|[~])", "/!=A", 0, 1},
00209   {ERE, "([!]|\\b)([!]|[=]|[~])", "A=A", 0, 1},
00210   {ERE, "([!]|\\b)([!]|[=]|[~])", "==!=", 0, 2},
00211   {ERE, "([!]|\\b)([!]|[=]|[~])", "==C~", 0, 3},
00212   {ERE, "([!]|\\b)([!]|[=]|[~])", "=~=", 0, -1},
00213   {ERE, "([!]|\\b)([!]|[=]|[~])", "~!", 0, -1},
00214   {ERE, "([!]|\\b)([!]|[=]|[~])", "~=~", 0, -1},
00215   {ERE, "\\<([A]|[!]|.B)", "A=AC", 0, 0},
00216   {ERE, "\\<([A]|[!]|.B)", "=AC", 0, 1},
00217   {ERE, "\\<([A]|[!]|.B)", "!AC", 0, 1},
00218   {ERE, "\\<([A]|[!]|.B)", "=AB", 0, 1},
00219   {ERE, "\\<([A]|[!]|.B)", "=CB", 0, 1},
00220   {ERE, "\\<([A]|[!]|.B)", "!CB", 0, 1},
00221   {ERE, "\\<([A]|[!]|.B)", "DA!C", 0, -1},
00222   {ERE, "\\<([A]|[!]|.B)", "D,B", 0, -1},
00223   {ERE, "\\<([A]|[!]|.B)", "!.C", 0, -1},
00224   {ERE, "\\<([A]|[!]|.B)", "BCB", 0, -1},
00225   {ERE, "([A]|\\<)([A]|[B]|[C])", "DAAD", 0, 1},
00226   {ERE, "([A]|\\<)([A]|[B]|[C])", "DABD", 0, 1},
00227   {ERE, "([A]|\\<)([A]|[B]|[C])", "AD", 0, 0},
00228   {ERE, "([A]|\\<)([A]|[B]|[C])", "C!", 0, 0},
00229   {ERE, "([A]|\\<)([A]|[B]|[C])", "D,B", 0, 2},
00230   {ERE, "([A]|\\<)([A]|[B]|[C])", "DA?A", 0, 3},
00231   {ERE, "([A]|\\<)([A]|[B]|[C])", "BBC", 0, 0},
00232   {ERE, "([A]|\\<)([A]|[B]|[C])", "DA", 0, -1},
00233   {ERE, "([!]|\\<)([!=]|[~])", "A!=\\", 0, 1},
00234   {ERE, "([!]|\\<)([!=]|[~])", "/!=A", 0, 1},
00235   {ERE, "([!]|\\<)([!=]|[~])", "==!=", 0, 2},
00236   {ERE, "([!]|\\<)([!=]|[~])", "==C~", 0, -1},
00237   {ERE, "([!]|\\<)([!=]|[~])", "A=A", 0, -1},
00238   {ERE, "([!]|\\<)([!=]|[~])", "=~=", 0, -1},
00239   {ERE, "([!]|\\<)([!=]|[~])", "~!", 0, -1},
00240   {ERE, "([!]|\\<)([!=]|[~])", "~=~", 0, -1},
00241   {ERE, "(\\<|[A].)[ABC]", "AC", 0, 0},
00242   {ERE, "(\\<|[A].)[ABC]", "=A", 0, 1},
00243   {ERE, "(\\<|[A].)[ABC]", "DACC", 0, 1},
00244   {ERE, "(\\<|[A].)[A~C]", "AC", 0, 0},
00245   {ERE, "(\\<|[A].)[A~C]", "=A", 0, 1},
00246   {ERE, "(\\<|[A].)[A~C]", "DACC", 0, 1},
00247   {ERE, "(\\<|[A].)[A~C]", "B!A=", 0, 2},
00248   {ERE, "(\\<|[A].)[A~C]", "B~C", 0, 2},
00249   {ERE, "^[^A]*\\bB", "==B", 0, 0},
00250   {ERE, "^[^A]*\\bB", "CBD!=B", 0, 0},
00251   {ERE, "[^A]*\\bB", "==B", 2, 2}
00252 };
00253 
00254 int
00255 do_one_test (const struct test_s *test, const char *fail)
00256 {
00257   int res;
00258   const char *err;
00259   struct re_pattern_buffer regbuf;
00260 
00261   re_set_syntax (test->syntax);
00262   memset (&regbuf, '\0', sizeof (regbuf));
00263   err = re_compile_pattern (test->pattern, strlen (test->pattern),
00264                          &regbuf);
00265   if (err != NULL)
00266     {
00267       printf ("%sre_compile_pattern \"%s\" failed: %s\n", fail, test->pattern,
00268              err);
00269       return 1;
00270     }
00271 
00272   res = re_search (&regbuf, test->string, strlen (test->string),
00273                  test->start, strlen (test->string) - test->start, NULL);
00274   if (res != test->res)
00275     {
00276       printf ("%sre_search \"%s\" \"%s\" failed: %d (expected %d)\n",
00277              fail, test->pattern, test->string, res, test->res);
00278       regfree (&regbuf);
00279       return 1;
00280     }
00281 
00282   if (test->res > 0 && test->start == 0)
00283     {
00284       res = re_search (&regbuf, test->string, strlen (test->string),
00285                      test->res, strlen (test->string) - test->res, NULL);
00286       if (res != test->res)
00287        {
00288          printf ("%sre_search from expected \"%s\" \"%s\" failed: %d (expected %d)\n",
00289                 fail, test->pattern, test->string, res, test->res);
00290          regfree (&regbuf);
00291          return 1;
00292        }
00293     }
00294 
00295   regfree (&regbuf);
00296   return 0;
00297 }
00298 
00299 static char *
00300 replace (char *p, char c)
00301 {
00302   switch (c)
00303     {
00304       /* A -> A" */
00305       case 'A': *p++ = '\xc3'; *p++ = '\x84'; break;
00306       /* B -> O" */
00307       case 'B': *p++ = '\xc3'; *p++ = '\x96'; break;
00308       /* C -> U" */
00309       case 'C': *p++ = '\xc3'; *p++ = '\x9c'; break;
00310       /* D -> a" */
00311       case 'D': *p++ = '\xc3'; *p++ = '\xa4'; break;
00312       /* ! -> MULTIPLICATION SIGN */
00313       case '!': *p++ = '\xc3'; *p++ = '\x97'; break;
00314       /* = -> EM DASH */
00315       case '=': *p++ = '\xe2'; *p++ = '\x80'; *p++ = '\x94'; break;
00316       /* ~ -> MUSICAL SYMBOL HALF NOTE */
00317       case '~': *p++ = '\xf0'; *p++ = '\x9d'; *p++ = '\x85'; *p++ = '\x9e';
00318       break;
00319     }
00320   return p;
00321 }
00322 
00323 int
00324 do_mb_tests (const struct test_s *test)
00325 {
00326   int i, j;
00327   struct test_s t;
00328   const char *const chars = "ABCD!=~";
00329   char repl[8], *p;
00330   char pattern[strlen (test->pattern) * 4 + 1];
00331   char string[strlen (test->string) * 4 + 1];
00332   char fail[8 + sizeof ("UTF-8 ")];
00333 
00334   t = *test;
00335   t.pattern = pattern;
00336   t.string = string;
00337   strcpy (fail, "UTF-8 ");
00338   for (i = 1; i < 128; ++i)
00339     {
00340       p = repl;
00341       for (j = 0; j < 7; ++j)
00342        if (i & (1 << j))
00343          {
00344            if (!strchr (test->pattern, chars[j])
00345               && !strchr (test->string, chars[j]))
00346              break;
00347            *p++ = chars[j];
00348          }
00349       if (j < 7)
00350        continue;
00351       *p = '\0';
00352 
00353       for (j = 0, p = pattern; test->pattern[j]; ++j)
00354        if (strchr (repl, test->pattern[j]))
00355          p = replace (p, test->pattern[j]);
00356        else if (test->pattern[j] == '\\' && test->pattern[j + 1])
00357          {
00358            *p++ = test->pattern[j++];
00359            *p++ = test->pattern[j];
00360          }
00361        else
00362          *p++ = test->pattern[j];
00363       *p = '\0';
00364 
00365       t.start = test->start;
00366       t.res = test->res;
00367 
00368       for (j = 0, p = string; test->string[j]; ++j)
00369        if (strchr (repl, test->string[j]))
00370          {
00371            char *d = replace (p, test->string[j]);
00372            if (test->start > j)
00373              t.start += d - p - 1;
00374            if (test->res > j)
00375              t.res += d - p - 1;
00376            p = d;
00377          }
00378        else
00379          *p++ = test->string[j];
00380       *p = '\0';
00381 
00382       p = stpcpy (fail + strlen ("UTF-8 "), repl);
00383       *p++ = ' ';
00384       *p = '\0';
00385 
00386       if (do_one_test (&t, fail))
00387        return 1;
00388     }
00389   return 0;
00390 }
00391 
00392 int
00393 main (void)
00394 {
00395   size_t i;
00396   int ret = 0;
00397 
00398   mtrace ();
00399 
00400   for (i = 0; i < sizeof (tests) / sizeof (tests[0]); ++i)
00401     {
00402       if (setlocale (LC_ALL, "de_DE.ISO-8859-1") == NULL)
00403        {
00404          puts ("setlocale de_DE.ISO-8859-1 failed");
00405          ret = 1;
00406        }
00407       ret |= do_one_test (&tests[i], "");
00408       if (setlocale (LC_ALL, "de_DE.UTF-8") == NULL)
00409        {
00410          puts ("setlocale de_DE.UTF-8 failed");
00411          ret = 1;
00412        }
00413       ret |= do_one_test (&tests[i], "UTF-8 ");
00414       ret |= do_mb_tests (&tests[i]);
00415     }
00416 
00417   return ret;
00418 }