sparc: Remove unwind information from signal return stubs [BZ #31244]
[glibc.git] / localedata / tst-wctype.c
blobcabb92f379220a2f18ba844727c4b7383d9d8585
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/>. */
19 #include <error.h>
20 #include <locale.h>
21 #include <stdio.h>
22 #include <stdlib.h>
23 #include <wchar.h>
24 #include <wctype.h>
26 static int
27 do_test (void)
29 wctype_t wct;
30 wchar_t buf[1000];
31 int result = 1;
33 setlocale (LC_ALL, "");
34 wprintf (L"locale = %s\n", setlocale (LC_CTYPE, NULL));
36 wct = wctype ("jhira");
37 if (wct == 0)
38 error (EXIT_FAILURE, 0, "jhira: no such character class");
40 if (fgetws (buf, sizeof (buf) / sizeof (buf[0]), stdin) != NULL)
42 int n;
44 wprintf (L"buf[] = \"%ls\"\n", buf);
46 result = 0;
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");
58 if (wct == 0)
59 error (EXIT_FAILURE, 0, "jkata: no such character class");
61 if (fgetws (buf, sizeof (buf) / sizeof (buf[0]), stdin) != NULL)
63 int n;
65 wprintf (L"buf[] = \"%ls\"\n", buf);
67 result = 0;
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");
79 if (wct == 0)
80 error (EXIT_FAILURE, 0, "jdigit: no such character class");
82 if (fgetws (buf, sizeof (buf) / sizeof (buf[0]), stdin) != NULL)
84 int n;
86 wprintf (L"buf[] = \"%ls\"\n", buf);
88 result = 0;
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");
100 if (wct == 0)
101 error (EXIT_FAILURE, 0, "jspace: no such character class");
103 if (fgetws (buf, sizeof (buf) / sizeof (buf[0]), stdin) != NULL)
105 int n;
107 wprintf (L"buf[] = \"%ls\"\n", buf);
109 result = 0;
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");
121 if (wct == 0)
122 error (EXIT_FAILURE, 0, "jkanji: no such character class");
124 if (fgetws (buf, sizeof (buf) / sizeof (buf[0]), stdin) != NULL)
126 int n;
128 wprintf (L"buf[] = \"%ls\"\n", buf);
130 result = 0;
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)));
141 return result;
144 #define TEST_FUNCTION do_test ()
145 #include "../test-skeleton.c"