1 /* Based on a test case by Paul Eggert. */
6 #include <gnu/option-groups.h>
9 char const string[] = "";
13 test (const char *locale)
22 if (setlocale (LC_COLLATE, locale) == NULL)
24 printf ("cannot set locale \"%s\"\n", locale);
27 bufsize = strxfrm (NULL, string, 0) + 1;
28 buf = malloc (bufsize);
31 printf ("cannot allocate %zd bytes\n", bufsize);
34 r = strxfrm (buf, string, bufsize);
38 printf ("locale \"%s\": strxfrm returned %zu, strlen returned %zu\n",
43 loc = newlocale (1 << LC_ALL, locale, NULL);
45 r = strxfrm_l (buf, string, bufsize, loc);
49 printf ("locale \"%s\": strxfrm_l returned %zu, strlen returned %zu\n",
68 #if __OPTION_EGLIBC_LOCALE_CODE
69 result |= test ("en_US.ISO-8859-1");
70 result |= test ("de_DE.UTF-8");