1 /* Test program for iswctype() function in ja_JP locale.
2 Copyright (C) 2000-2014 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4 Contributed by Ulrich Drepper <drepper@cygnus.com>.
6 The GNU C Library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
11 The GNU C Library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
16 You should have received a copy of the GNU Lesser General Public
17 License along with the GNU C Library; if not, see
18 <http://www.gnu.org/licenses/>. */
34 setlocale (LC_ALL
, "");
35 wprintf (L
"locale = %s\n", setlocale (LC_CTYPE
, NULL
));
37 wct
= wctype ("jhira");
39 error (EXIT_FAILURE
, 0, "jhira: no such character class");
41 if (fgetws (buf
, sizeof (buf
) / sizeof (buf
[0]), stdin
) != NULL
)
45 wprintf (L
"buf[] = \"%ls\"\n", buf
);
49 for (n
= 0; buf
[n
] != L
'\0'; ++n
)
51 wprintf (L
"jhira(U%04lx = %lc) = %d\n", (long) buf
[n
], buf
[n
],
52 iswctype (buf
[n
], wct
));
53 result
|= ((buf
[n
] < 0xff && iswctype (buf
[n
], wct
))
54 || (buf
[n
] > 0xff && !iswctype (buf
[n
], wct
)));
58 wct
= wctype ("jkata");
60 error (EXIT_FAILURE
, 0, "jkata: no such character class");
62 if (fgetws (buf
, sizeof (buf
) / sizeof (buf
[0]), stdin
) != NULL
)
66 wprintf (L
"buf[] = \"%ls\"\n", buf
);
70 for (n
= 0; buf
[n
] != L
'\0'; ++n
)
72 wprintf (L
"jkata(U%04lx = %lc) = %d\n", (long) buf
[n
], buf
[n
],
73 iswctype (buf
[n
], wct
));
74 result
|= ((buf
[n
] < 0xff && iswctype (buf
[n
], wct
))
75 || (buf
[n
] > 0xff && !iswctype (buf
[n
], wct
)));
79 wct
= wctype ("jdigit");
81 error (EXIT_FAILURE
, 0, "jdigit: no such character class");
83 if (fgetws (buf
, sizeof (buf
) / sizeof (buf
[0]), stdin
) != NULL
)
87 wprintf (L
"buf[] = \"%ls\"\n", buf
);
91 for (n
= 0; buf
[n
] != L
'\0'; ++n
)
93 wprintf (L
"jdigit(U%04lx = %lc) = %d\n", (long) buf
[n
], buf
[n
],
94 iswctype (buf
[n
], wct
));
95 result
|= ((buf
[n
] < 0xff && iswctype (buf
[n
], wct
))
96 || (buf
[n
] > 0xff && !iswctype (buf
[n
], wct
)));
100 wct
= wctype ("jspace");
102 error (EXIT_FAILURE
, 0, "jspace: no such character class");
104 if (fgetws (buf
, sizeof (buf
) / sizeof (buf
[0]), stdin
) != NULL
)
108 wprintf (L
"buf[] = \"%ls\"\n", buf
);
112 for (n
= 0; buf
[n
] != L
'\0'; ++n
)
114 wprintf (L
"jspace(U%04lx = %lc) = %d\n", (long) buf
[n
], buf
[n
],
115 iswctype (buf
[n
], wct
));
116 result
|= ((buf
[n
] < 0xff && iswctype (buf
[n
], wct
))
117 || (buf
[n
] > 0xff && !iswctype (buf
[n
], wct
)));
121 wct
= wctype ("jkanji");
123 error (EXIT_FAILURE
, 0, "jkanji: no such character class");
125 if (fgetws (buf
, sizeof (buf
) / sizeof (buf
[0]), stdin
) != NULL
)
129 wprintf (L
"buf[] = \"%ls\"\n", buf
);
133 for (n
= 0; buf
[n
] != L
'\0'; ++n
)
135 wprintf (L
"jkanji(U%04lx = %lc) = %d\n", (long) buf
[n
], buf
[n
],
136 iswctype (buf
[n
], wct
));
137 result
|= ((buf
[n
] < 0xff && iswctype (buf
[n
], wct
))
138 || (buf
[n
] > 0xff && !iswctype (buf
[n
], wct
)));