1 /* Copyright (C) 2000 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3 Contributed by Ulrich Drepper <drepper@redhat.com>, 2000.
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.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, write to the Free
17 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
27 static int check_ascii (const char *locname
);
35 /* Check mapping of ASCII range for some character sets which have
36 ASCII as a subset. For those the wide char generated must have
38 setlocale (LC_ALL
, "C");
39 result
|= check_ascii (setlocale (LC_ALL
, NULL
));
41 setlocale (LC_ALL
, "de_DE.UTF-8");
42 result
|= check_ascii (setlocale (LC_ALL
, NULL
));
44 setlocale (LC_ALL
, "ja_JP.EUC-JP");
45 result
|= check_ascii (setlocale (LC_ALL
, NULL
));
52 check_ascii (const char *locname
)
57 printf ("Testing locale \"%s\":\n", locname
);
59 for (wc
= 0; wc
<= 127; ++wc
)
61 char buf
[2 * MB_CUR_MAX
];
65 memset (buf
, '\xff', sizeof (buf
));
66 memset (&s
, '\0', sizeof (s
));
68 n
= wcrtomb (buf
, wc
, &s
);
71 printf ("%s: '\\x%x': encoding error\n", locname
, (int) wc
);
76 printf ("%s: '\\x%x': 0 returned\n", locname
, (int) wc
);
81 printf ("%s: '\\x%x': not 1 returned\n", locname
, (int) wc
);
84 else if (wc
!= (wchar_t) buf
[0])
86 printf ("%s: L'\\x%x': buf[0] != '\\x%x'\n", locname
, (int) wc
,
92 printf (res
== 1 ? "%d error\n" : "%d errors\n", res
);