PageRenderTime 27ms CodeModel.GetById 37ms RepoModel.GetById 0ms app.codeStats 0ms

/eglibc-2.13/posix/bug-regex19.c

https://github.com/GNA-SERVICES-INC/MoNGate
C | 418 lines | 372 code | 20 blank | 26 comment | 32 complexity | 82a3b8aa27ce54c3e34ebdc03b5f77ea MD5 | raw file
  1. /* Regular expression tests.
  2. Copyright (C) 2003, 2005 Free Software Foundation, Inc.
  3. This file is part of the GNU C Library.
  4. Contributed by Jakub Jelinek <jakub@redhat.com>, 2003.
  5. The GNU C Library is free software; you can redistribute it and/or
  6. modify it under the terms of the GNU Lesser General Public
  7. License as published by the Free Software Foundation; either
  8. version 2.1 of the License, or (at your option) any later version.
  9. The GNU C Library is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. Lesser General Public License for more details.
  13. You should have received a copy of the GNU Lesser General Public
  14. License along with the GNU C Library; if not, write to the Free
  15. Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
  16. 02111-1307 USA. */
  17. #include <sys/types.h>
  18. #include <mcheck.h>
  19. #include <regex.h>
  20. #include <stdio.h>
  21. #include <stdlib.h>
  22. #include <string.h>
  23. #include <locale.h>
  24. #define BRE RE_SYNTAX_POSIX_BASIC
  25. #define ERE RE_SYNTAX_POSIX_EXTENDED
  26. static struct test_s
  27. {
  28. int syntax;
  29. const char *pattern;
  30. const char *string;
  31. int start, res;
  32. } tests[] = {
  33. {BRE, "\\<A", "CBAA", 0, -1},
  34. {BRE, "\\<A", "CBAA", 2, -1},
  35. {BRE, "A\\>", "CAAB", 1, -1},
  36. {BRE, "\\bA", "CBAA", 0, -1},
  37. {BRE, "\\bA", "CBAA", 2, -1},
  38. {BRE, "A\\b", "CAAB", 1, -1},
  39. {BRE, "\\<A", "AA", 0, 0},
  40. {BRE, "\\<A", "C-AA", 2, 2},
  41. {BRE, "A\\>", "CAA-", 1, 2},
  42. {BRE, "A\\>", "CAA", 1, 2},
  43. {BRE, "\\bA", "AA", 0, 0},
  44. {BRE, "\\bA", "C-AA", 2, 2},
  45. {BRE, "A\\b", "CAA-", 1, 2},
  46. {BRE, "A\\b", "CAA", 1, 2},
  47. {BRE, "\\<[A]", "CBAA", 0, -1},
  48. {BRE, "\\<[A]", "CBAA", 2, -1},
  49. {BRE, "[A]\\>", "CAAB", 1, -1},
  50. {BRE, "\\b[A]", "CBAA", 0, -1},
  51. {BRE, "\\b[A]", "CBAA", 2, -1},
  52. {BRE, "[A]\\b", "CAAB", 1, -1},
  53. {BRE, "\\<[A]", "AA", 0, 0},
  54. {BRE, "\\<[A]", "C-AA", 2, 2},
  55. {BRE, "[A]\\>", "CAA-", 1, 2},
  56. {BRE, "[A]\\>", "CAA", 1, 2},
  57. {BRE, "\\b[A]", "AA", 0, 0},
  58. {BRE, "\\b[A]", "C-AA", 2, 2},
  59. {BRE, "[A]\\b", "CAA-", 1, 2},
  60. {BRE, "[A]\\b", "CAA", 1, 2},
  61. {ERE, "\\b(A|!|.B)", "A=AC", 0, 0},
  62. {ERE, "\\b(A|!|.B)", "=AC", 0, 1},
  63. {ERE, "\\b(A|!|.B)", "!AC", 0, 1},
  64. {ERE, "\\b(A|!|.B)", "=AB", 0, 1},
  65. {ERE, "\\b(A|!|.B)", "DA!C", 0, 2},
  66. {ERE, "\\b(A|!|.B)", "=CB", 0, 1},
  67. {ERE, "\\b(A|!|.B)", "!CB", 0, 1},
  68. {ERE, "\\b(A|!|.B)", "D,B", 0, 1},
  69. {ERE, "\\b(A|!|.B)", "!.C", 0, -1},
  70. {ERE, "\\b(A|!|.B)", "BCB", 0, -1},
  71. {ERE, "(A|\\b)(A|B|C)", "DAAD", 0, 1},
  72. {ERE, "(A|\\b)(A|B|C)", "DABD", 0, 1},
  73. {ERE, "(A|\\b)(A|B|C)", "AD", 0, 0},
  74. {ERE, "(A|\\b)(A|B|C)", "C!", 0, 0},
  75. {ERE, "(A|\\b)(A|B|C)", "D,B", 0, 2},
  76. {ERE, "(A|\\b)(A|B|C)", "DA?A", 0, 3},
  77. {ERE, "(A|\\b)(A|B|C)", "BBC", 0, 0},
  78. {ERE, "(A|\\b)(A|B|C)", "DA", 0, -1},
  79. {ERE, "(!|\\b)(!|=|~)", "A!=\\", 0, 1},
  80. {ERE, "(!|\\b)(!|=|~)", "/!=A", 0, 1},
  81. {ERE, "(!|\\b)(!|=|~)", "A=A", 0, 1},
  82. {ERE, "(!|\\b)(!|=|~)", "==!=", 0, 2},
  83. {ERE, "(!|\\b)(!|=|~)", "==C~", 0, 3},
  84. {ERE, "(!|\\b)(!|=|~)", "=~=", 0, -1},
  85. {ERE, "(!|\\b)(!|=|~)", "~!", 0, -1},
  86. {ERE, "(!|\\b)(!|=|~)", "~=~", 0, -1},
  87. {ERE, "(\\b|A.)[ABC]", "AC", 0, 0},
  88. {ERE, "(\\b|A.)[ABC]", "=A", 0, 1},
  89. {ERE, "(\\b|A.)[ABC]", "DACC", 0, 1},
  90. {ERE, "(\\b|A.)[A~C]", "AC", 0, 0},
  91. {ERE, "(\\b|A.)[A~C]", "=A", 0, 1},
  92. {ERE, "(\\b|A.)[A~C]", "DACC", 0, 1},
  93. {ERE, "(\\b|A.)[A~C]", "B!A=", 0, 2},
  94. {ERE, "(\\b|A.)[A~C]", "B~C", 0, 1},
  95. {ERE, ".\\b.", "AA~", 0, 1},
  96. {ERE, ".\\b.", "=A=", 0, 0},
  97. {ERE, ".\\b.", "==", 0, -1},
  98. {ERE, ".\\b.", "ABA", 0, -1},
  99. {ERE, "[^k]\\b[^k]", "AA~", 0, 1},
  100. {ERE, "[^k]\\b[^k]", "=A=", 0, 0},
  101. {ERE, "[^k]\\b[^k]", "Ak~kA~", 0, 4},
  102. {ERE, "[^k]\\b[^k]", "==", 0, -1},
  103. {ERE, "[^k]\\b[^k]", "ABA", 0, -1},
  104. {ERE, "[^k]\\b[^k]", "Ak~", 0, -1},
  105. {ERE, "[^k]\\b[^k]", "k=k", 0, -1},
  106. {ERE, "[^C]\\b[^C]", "AA~", 0, 1},
  107. {ERE, "[^C]\\b[^C]", "=A=", 0, 0},
  108. {ERE, "[^C]\\b[^C]", "AC~CA~", 0, 4},
  109. {ERE, "[^C]\\b[^C]", "==", 0, -1},
  110. {ERE, "[^C]\\b[^C]", "ABA", 0, -1},
  111. {ERE, "[^C]\\b[^C]", "AC~", 0, -1},
  112. {ERE, "[^C]\\b[^C]", "C=C", 0, -1},
  113. {ERE, "\\<(A|!|.B)", "A=AC", 0, 0},
  114. {ERE, "\\<(A|!|.B)", "=AC", 0, 1},
  115. {ERE, "\\<(A|!|.B)", "!AC", 0, 1},
  116. {ERE, "\\<(A|!|.B)", "=AB", 0, 1},
  117. {ERE, "\\<(A|!|.B)", "=CB", 0, 1},
  118. {ERE, "\\<(A|!|.B)", "!CB", 0, 1},
  119. {ERE, "\\<(A|!|.B)", "DA!C", 0, -1},
  120. {ERE, "\\<(A|!|.B)", "D,B", 0, -1},
  121. {ERE, "\\<(A|!|.B)", "!.C", 0, -1},
  122. {ERE, "\\<(A|!|.B)", "BCB", 0, -1},
  123. {ERE, "(A|\\<)(A|B|C)", "DAAD", 0, 1},
  124. {ERE, "(A|\\<)(A|B|C)", "DABD", 0, 1},
  125. {ERE, "(A|\\<)(A|B|C)", "AD", 0, 0},
  126. {ERE, "(A|\\<)(A|B|C)", "C!", 0, 0},
  127. {ERE, "(A|\\<)(A|B|C)", "D,B", 0, 2},
  128. {ERE, "(A|\\<)(A|B|C)", "DA?A", 0, 3},
  129. {ERE, "(A|\\<)(A|B|C)", "BBC", 0, 0},
  130. {ERE, "(A|\\<)(A|B|C)", "DA", 0, -1},
  131. {ERE, "(!|\\<)(!|=|~)", "A!=\\", 0, 1},
  132. {ERE, "(!|\\<)(!|=|~)", "/!=A", 0, 1},
  133. {ERE, "(!|\\<)(!|=|~)", "==!=", 0, 2},
  134. {ERE, "(!|\\<)(!|=|~)", "==C~", 0, -1},
  135. {ERE, "(!|\\<)(!|=|~)", "A=A", 0, -1},
  136. {ERE, "(!|\\<)(!|=|~)", "=~=", 0, -1},
  137. {ERE, "(!|\\<)(!|=|~)", "~!", 0, -1},
  138. {ERE, "(!|\\<)(!|=|~)", "~=~", 0, -1},
  139. {ERE, "(\\<|A.)[ABC]", "AC", 0, 0},
  140. {ERE, "(\\<|A.)[ABC]", "=A", 0, 1},
  141. {ERE, "(\\<|A.)[ABC]", "DACC", 0, 1},
  142. {ERE, "(\\<|A.)[A~C]", "AC", 0, 0},
  143. {ERE, "(\\<|A.)[A~C]", "=A", 0, 1},
  144. {ERE, "(\\<|A.)[A~C]", "DACC", 0, 1},
  145. {ERE, "(\\<|A.)[A~C]", "B!A=", 0, 2},
  146. {ERE, "(\\<|A.)[A~C]", "B~C", 0, 2},
  147. {ERE, ".\\<.", "=A=", 0, 0},
  148. {ERE, ".\\<.", "AA~", 0, -1},
  149. {ERE, ".\\<.", "==", 0, -1},
  150. {ERE, ".\\<.", "ABA", 0, -1},
  151. {ERE, "[^k]\\<[^k]", "=k=A=", 0, 2},
  152. {ERE, "[^k]\\<[^k]", "kk~", 0, -1},
  153. {ERE, "[^k]\\<[^k]", "==", 0, -1},
  154. {ERE, "[^k]\\<[^k]", "ABA", 0, -1},
  155. {ERE, "[^k]\\<[^k]", "=k=", 0, -1},
  156. {ERE, "[^C]\\<[^C]", "=C=A=", 0, 2},
  157. {ERE, "[^C]\\<[^C]", "CC~", 0, -1},
  158. {ERE, "[^C]\\<[^C]", "==", 0, -1},
  159. {ERE, "[^C]\\<[^C]", "ABA", 0, -1},
  160. {ERE, "[^C]\\<[^C]", "=C=", 0, -1},
  161. {ERE, ".\\B.", "ABA", 0, 0},
  162. {ERE, ".\\B.", "=BDC", 0, 1},
  163. {ERE, "[^k]\\B[^k]", "kkkABA", 0, 3},
  164. {ERE, "[^k]\\B[^k]", "kBk", 0, -1},
  165. {ERE, "[^C]\\B[^C]", "CCCABA", 0, 3},
  166. {ERE, "[^C]\\B[^C]", "CBC", 0, -1},
  167. {ERE, ".(\\b|\\B).", "=~AB", 0, 0},
  168. {ERE, ".(\\b|\\B).", "A=C", 0, 0},
  169. {ERE, ".(\\b|\\B).", "ABC", 0, 0},
  170. {ERE, ".(\\b|\\B).", "=~\\!", 0, 0},
  171. {ERE, "[^k](\\b|\\B)[^k]", "=~AB", 0, 0},
  172. {ERE, "[^k](\\b|\\B)[^k]", "A=C", 0, 0},
  173. {ERE, "[^k](\\b|\\B)[^k]", "ABC", 0, 0},
  174. {ERE, "[^k](\\b|\\B)[^k]", "=~kBD", 0, 0},
  175. {ERE, "[^k](\\b|\\B)[^k]", "=~\\!", 0, 0},
  176. {ERE, "[^k](\\b|\\B)[^k]", "=~kB", 0, 0},
  177. {ERE, "[^C](\\b|\\B)[^C]", "=~AB", 0, 0},
  178. {ERE, "[^C](\\b|\\B)[^C]", "A=C", 0, 0},
  179. {ERE, "[^C](\\b|\\B)[^C]", "ABC", 0, 0},
  180. {ERE, "[^C](\\b|\\B)[^C]", "=~CBD", 0, 0},
  181. {ERE, "[^C](\\b|\\B)[^C]", "=~\\!", 0, 0},
  182. {ERE, "[^C](\\b|\\B)[^C]", "=~CB", 0, 0},
  183. {ERE, "\\b([A]|[!]|.B)", "A=AC", 0, 0},
  184. {ERE, "\\b([A]|[!]|.B)", "=AC", 0, 1},
  185. {ERE, "\\b([A]|[!]|.B)", "!AC", 0, 1},
  186. {ERE, "\\b([A]|[!]|.B)", "=AB", 0, 1},
  187. {ERE, "\\b([A]|[!]|.B)", "DA!C", 0, 2},
  188. {ERE, "\\b([A]|[!]|.B)", "=CB", 0, 1},
  189. {ERE, "\\b([A]|[!]|.B)", "!CB", 0, 1},
  190. {ERE, "\\b([A]|[!]|.B)", "D,B", 0, 1},
  191. {ERE, "\\b([A]|[!]|.B)", "!.C", 0, -1},
  192. {ERE, "\\b([A]|[!]|.B)", "BCB", 0, -1},
  193. {ERE, "([A]|\\b)([A]|[B]|[C])", "DAAD", 0, 1},
  194. {ERE, "([A]|\\b)([A]|[B]|[C])", "DABD", 0, 1},
  195. {ERE, "([A]|\\b)([A]|[B]|[C])", "AD", 0, 0},
  196. {ERE, "([A]|\\b)([A]|[B]|[C])", "C!", 0, 0},
  197. {ERE, "([A]|\\b)([A]|[B]|[C])", "D,B", 0, 2},
  198. {ERE, "([A]|\\b)([A]|[B]|[C])", "DA?A", 0, 3},
  199. {ERE, "([A]|\\b)([A]|[B]|[C])", "BBC", 0, 0},
  200. {ERE, "([A]|\\b)([A]|[B]|[C])", "DA", 0, -1},
  201. {ERE, "([!]|\\b)([!]|[=]|[~])", "A!=\\", 0, 1},
  202. {ERE, "([!]|\\b)([!]|[=]|[~])", "/!=A", 0, 1},
  203. {ERE, "([!]|\\b)([!]|[=]|[~])", "A=A", 0, 1},
  204. {ERE, "([!]|\\b)([!]|[=]|[~])", "==!=", 0, 2},
  205. {ERE, "([!]|\\b)([!]|[=]|[~])", "==C~", 0, 3},
  206. {ERE, "([!]|\\b)([!]|[=]|[~])", "=~=", 0, -1},
  207. {ERE, "([!]|\\b)([!]|[=]|[~])", "~!", 0, -1},
  208. {ERE, "([!]|\\b)([!]|[=]|[~])", "~=~", 0, -1},
  209. {ERE, "\\<([A]|[!]|.B)", "A=AC", 0, 0},
  210. {ERE, "\\<([A]|[!]|.B)", "=AC", 0, 1},
  211. {ERE, "\\<([A]|[!]|.B)", "!AC", 0, 1},
  212. {ERE, "\\<([A]|[!]|.B)", "=AB", 0, 1},
  213. {ERE, "\\<([A]|[!]|.B)", "=CB", 0, 1},
  214. {ERE, "\\<([A]|[!]|.B)", "!CB", 0, 1},
  215. {ERE, "\\<([A]|[!]|.B)", "DA!C", 0, -1},
  216. {ERE, "\\<([A]|[!]|.B)", "D,B", 0, -1},
  217. {ERE, "\\<([A]|[!]|.B)", "!.C", 0, -1},
  218. {ERE, "\\<([A]|[!]|.B)", "BCB", 0, -1},
  219. {ERE, "([A]|\\<)([A]|[B]|[C])", "DAAD", 0, 1},
  220. {ERE, "([A]|\\<)([A]|[B]|[C])", "DABD", 0, 1},
  221. {ERE, "([A]|\\<)([A]|[B]|[C])", "AD", 0, 0},
  222. {ERE, "([A]|\\<)([A]|[B]|[C])", "C!", 0, 0},
  223. {ERE, "([A]|\\<)([A]|[B]|[C])", "D,B", 0, 2},
  224. {ERE, "([A]|\\<)([A]|[B]|[C])", "DA?A", 0, 3},
  225. {ERE, "([A]|\\<)([A]|[B]|[C])", "BBC", 0, 0},
  226. {ERE, "([A]|\\<)([A]|[B]|[C])", "DA", 0, -1},
  227. {ERE, "([!]|\\<)([!=]|[~])", "A!=\\", 0, 1},
  228. {ERE, "([!]|\\<)([!=]|[~])", "/!=A", 0, 1},
  229. {ERE, "([!]|\\<)([!=]|[~])", "==!=", 0, 2},
  230. {ERE, "([!]|\\<)([!=]|[~])", "==C~", 0, -1},
  231. {ERE, "([!]|\\<)([!=]|[~])", "A=A", 0, -1},
  232. {ERE, "([!]|\\<)([!=]|[~])", "=~=", 0, -1},
  233. {ERE, "([!]|\\<)([!=]|[~])", "~!", 0, -1},
  234. {ERE, "([!]|\\<)([!=]|[~])", "~=~", 0, -1},
  235. {ERE, "(\\<|[A].)[ABC]", "AC", 0, 0},
  236. {ERE, "(\\<|[A].)[ABC]", "=A", 0, 1},
  237. {ERE, "(\\<|[A].)[ABC]", "DACC", 0, 1},
  238. {ERE, "(\\<|[A].)[A~C]", "AC", 0, 0},
  239. {ERE, "(\\<|[A].)[A~C]", "=A", 0, 1},
  240. {ERE, "(\\<|[A].)[A~C]", "DACC", 0, 1},
  241. {ERE, "(\\<|[A].)[A~C]", "B!A=", 0, 2},
  242. {ERE, "(\\<|[A].)[A~C]", "B~C", 0, 2},
  243. {ERE, "^[^A]*\\bB", "==B", 0, 0},
  244. {ERE, "^[^A]*\\bB", "CBD!=B", 0, 0},
  245. {ERE, "[^A]*\\bB", "==B", 2, 2}
  246. };
  247. int
  248. do_one_test (const struct test_s *test, const char *fail)
  249. {
  250. int res;
  251. const char *err;
  252. struct re_pattern_buffer regbuf;
  253. re_set_syntax (test->syntax);
  254. memset (&regbuf, '\0', sizeof (regbuf));
  255. err = re_compile_pattern (test->pattern, strlen (test->pattern),
  256. &regbuf);
  257. if (err != NULL)
  258. {
  259. printf ("%sre_compile_pattern \"%s\" failed: %s\n", fail, test->pattern,
  260. err);
  261. return 1;
  262. }
  263. res = re_search (&regbuf, test->string, strlen (test->string),
  264. test->start, strlen (test->string) - test->start, NULL);
  265. if (res != test->res)
  266. {
  267. printf ("%sre_search \"%s\" \"%s\" failed: %d (expected %d)\n",
  268. fail, test->pattern, test->string, res, test->res);
  269. regfree (&regbuf);
  270. return 1;
  271. }
  272. if (test->res > 0 && test->start == 0)
  273. {
  274. res = re_search (&regbuf, test->string, strlen (test->string),
  275. test->res, strlen (test->string) - test->res, NULL);
  276. if (res != test->res)
  277. {
  278. printf ("%sre_search from expected \"%s\" \"%s\" failed: %d (expected %d)\n",
  279. fail, test->pattern, test->string, res, test->res);
  280. regfree (&regbuf);
  281. return 1;
  282. }
  283. }
  284. regfree (&regbuf);
  285. return 0;
  286. }
  287. static char *
  288. replace (char *p, char c)
  289. {
  290. switch (c)
  291. {
  292. /* A -> A" */
  293. case 'A': *p++ = '\xc3'; *p++ = '\x84'; break;
  294. /* B -> O" */
  295. case 'B': *p++ = '\xc3'; *p++ = '\x96'; break;
  296. /* C -> U" */
  297. case 'C': *p++ = '\xc3'; *p++ = '\x9c'; break;
  298. /* D -> a" */
  299. case 'D': *p++ = '\xc3'; *p++ = '\xa4'; break;
  300. /* ! -> MULTIPLICATION SIGN */
  301. case '!': *p++ = '\xc3'; *p++ = '\x97'; break;
  302. /* = -> EM DASH */
  303. case '=': *p++ = '\xe2'; *p++ = '\x80'; *p++ = '\x94'; break;
  304. /* ~ -> MUSICAL SYMBOL HALF NOTE */
  305. case '~': *p++ = '\xf0'; *p++ = '\x9d'; *p++ = '\x85'; *p++ = '\x9e';
  306. break;
  307. }
  308. return p;
  309. }
  310. int
  311. do_mb_tests (const struct test_s *test)
  312. {
  313. int i, j;
  314. struct test_s t;
  315. const char *const chars = "ABCD!=~";
  316. char repl[8], *p;
  317. char pattern[strlen (test->pattern) * 4 + 1];
  318. char string[strlen (test->string) * 4 + 1];
  319. char fail[8 + sizeof ("UTF-8 ")];
  320. t = *test;
  321. t.pattern = pattern;
  322. t.string = string;
  323. strcpy (fail, "UTF-8 ");
  324. for (i = 1; i < 128; ++i)
  325. {
  326. p = repl;
  327. for (j = 0; j < 7; ++j)
  328. if (i & (1 << j))
  329. {
  330. if (!strchr (test->pattern, chars[j])
  331. && !strchr (test->string, chars[j]))
  332. break;
  333. *p++ = chars[j];
  334. }
  335. if (j < 7)
  336. continue;
  337. *p = '\0';
  338. for (j = 0, p = pattern; test->pattern[j]; ++j)
  339. if (strchr (repl, test->pattern[j]))
  340. p = replace (p, test->pattern[j]);
  341. else if (test->pattern[j] == '\\' && test->pattern[j + 1])
  342. {
  343. *p++ = test->pattern[j++];
  344. *p++ = test->pattern[j];
  345. }
  346. else
  347. *p++ = test->pattern[j];
  348. *p = '\0';
  349. t.start = test->start;
  350. t.res = test->res;
  351. for (j = 0, p = string; test->string[j]; ++j)
  352. if (strchr (repl, test->string[j]))
  353. {
  354. char *d = replace (p, test->string[j]);
  355. if (test->start > j)
  356. t.start += d - p - 1;
  357. if (test->res > j)
  358. t.res += d - p - 1;
  359. p = d;
  360. }
  361. else
  362. *p++ = test->string[j];
  363. *p = '\0';
  364. p = stpcpy (fail + strlen ("UTF-8 "), repl);
  365. *p++ = ' ';
  366. *p = '\0';
  367. if (do_one_test (&t, fail))
  368. return 1;
  369. }
  370. return 0;
  371. }
  372. int
  373. main (void)
  374. {
  375. size_t i;
  376. int ret = 0;
  377. mtrace ();
  378. for (i = 0; i < sizeof (tests) / sizeof (tests[0]); ++i)
  379. {
  380. if (setlocale (LC_ALL, "de_DE.ISO-8859-1") == NULL)
  381. {
  382. puts ("setlocale de_DE.ISO-8859-1 failed");
  383. ret = 1;
  384. }
  385. ret |= do_one_test (&tests[i], "");
  386. if (setlocale (LC_ALL, "de_DE.UTF-8") == NULL)
  387. {
  388. puts ("setlocale de_DE.UTF-8 failed");
  389. ret = 1;
  390. }
  391. ret |= do_one_test (&tests[i], "UTF-8 ");
  392. ret |= do_mb_tests (&tests[i]);
  393. }
  394. return ret;
  395. }