1 /* Based on a test case by Paul Eggert. */
8 char const string
[] = "";
12 test (const char *locale
)
21 if (setlocale (LC_COLLATE
, locale
) == NULL
)
23 printf ("cannot set locale \"%s\"\n", locale
);
26 bufsize
= strxfrm (NULL
, string
, 0) + 1;
27 buf
= malloc (bufsize
);
30 printf ("cannot allocate %zd bytes\n", bufsize
);
33 r
= strxfrm (buf
, string
, bufsize
);
37 printf ("locale \"%s\": strxfrm returned %zu, strlen returned %zu\n",
42 loc
= __newlocale (1 << LC_ALL
, locale
, NULL
);
44 r
= __strxfrm_l (buf
, string
, bufsize
, loc
);
48 printf ("locale \"%s\": strxfrm_l returned %zu, strlen returned %zu\n",
67 result
|= test ("en_US.ISO-8859-1");
68 result
|= test ("de_DE.UTF-8");