1 /* Test program for iswctype() function in ja_JP locale.
2 Copyright (C) 2000-2024 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
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, see
17 <https://www.gnu.org/licenses/>. */
33 setlocale (LC_ALL
, "");
34 wprintf (L
"locale = %s\n", setlocale (LC_CTYPE
, NULL
));
36 wct
= wctype ("jhira");
38 error (EXIT_FAILURE
, 0, "jhira: no such character class");
40 if (fgetws (buf
, sizeof (buf
) / sizeof (buf
[0]), stdin
) != NULL
)
44 wprintf (L
"buf[] = \"%ls\"\n", buf
);
48 for (n
= 0; buf
[n
] != L
'\0'; ++n
)
50 wprintf (L
"jhira(U%04lx = %lc) = %d\n", (long) buf
[n
], buf
[n
],
51 iswctype (buf
[n
], wct
));
52 result
|= ((buf
[n
] < 0xff && iswctype (buf
[n
], wct
))
53 || (buf
[n
] > 0xff && !iswctype (buf
[n
], wct
)));
57 wct
= wctype ("jkata");
59 error (EXIT_FAILURE
, 0, "jkata: no such character class");
61 if (fgetws (buf
, sizeof (buf
) / sizeof (buf
[0]), stdin
) != NULL
)
65 wprintf (L
"buf[] = \"%ls\"\n", buf
);
69 for (n
= 0; buf
[n
] != L
'\0'; ++n
)
71 wprintf (L
"jkata(U%04lx = %lc) = %d\n", (long) buf
[n
], buf
[n
],
72 iswctype (buf
[n
], wct
));
73 result
|= ((buf
[n
] < 0xff && iswctype (buf
[n
], wct
))
74 || (buf
[n
] > 0xff && !iswctype (buf
[n
], wct
)));
78 wct
= wctype ("jdigit");
80 error (EXIT_FAILURE
, 0, "jdigit: no such character class");
82 if (fgetws (buf
, sizeof (buf
) / sizeof (buf
[0]), stdin
) != NULL
)
86 wprintf (L
"buf[] = \"%ls\"\n", buf
);
90 for (n
= 0; buf
[n
] != L
'\0'; ++n
)
92 wprintf (L
"jdigit(U%04lx = %lc) = %d\n", (long) buf
[n
], buf
[n
],
93 iswctype (buf
[n
], wct
));
94 result
|= ((buf
[n
] < 0xff && iswctype (buf
[n
], wct
))
95 || (buf
[n
] > 0xff && !iswctype (buf
[n
], wct
)));
99 wct
= wctype ("jspace");
101 error (EXIT_FAILURE
, 0, "jspace: no such character class");
103 if (fgetws (buf
, sizeof (buf
) / sizeof (buf
[0]), stdin
) != NULL
)
107 wprintf (L
"buf[] = \"%ls\"\n", buf
);
111 for (n
= 0; buf
[n
] != L
'\0'; ++n
)
113 wprintf (L
"jspace(U%04lx = %lc) = %d\n", (long) buf
[n
], buf
[n
],
114 iswctype (buf
[n
], wct
));
115 result
|= ((buf
[n
] < 0xff && iswctype (buf
[n
], wct
))
116 || (buf
[n
] > 0xff && !iswctype (buf
[n
], wct
)));
120 wct
= wctype ("jkanji");
122 error (EXIT_FAILURE
, 0, "jkanji: no such character class");
124 if (fgetws (buf
, sizeof (buf
) / sizeof (buf
[0]), stdin
) != NULL
)
128 wprintf (L
"buf[] = \"%ls\"\n", buf
);
132 for (n
= 0; buf
[n
] != L
'\0'; ++n
)
134 wprintf (L
"jkanji(U%04lx = %lc) = %d\n", (long) buf
[n
], buf
[n
],
135 iswctype (buf
[n
], wct
));
136 result
|= ((buf
[n
] < 0xff && iswctype (buf
[n
], wct
))
137 || (buf
[n
] > 0xff && !iswctype (buf
[n
], wct
)));
144 #define TEST_FUNCTION do_test ()
145 #include "../test-skeleton.c"