1 /* Based on a test case by Paul Eggert. */
3 #ifdef __UCLIBC_HAS_XLOCALE__
10 char const string
[] = "";
14 test (const char *locale
)
23 if (setlocale (LC_COLLATE
, locale
) == NULL
)
25 printf ("cannot set locale \"%s\"\n", locale
);
28 bufsize
= strxfrm (NULL
, string
, 0) + 1;
29 buf
= malloc (bufsize
);
32 printf ("cannot allocate %zd bytes\n", bufsize
);
35 r
= strxfrm (buf
, string
, bufsize
);
39 printf ("locale \"%s\": strxfrm returned %zu, strlen returned %zu\n",
44 loc
= newlocale (1 << LC_ALL
, locale
, NULL
);
46 r
= strxfrm_l (buf
, string
, bufsize
, loc
);
50 printf ("locale \"%s\": strxfrm_l returned %zu, strlen returned %zu\n",
69 result
|= test ("en_US.ISO-8859-1");
70 result
|= test ("de_DE.UTF-8");