S390: Use s390-64 specific ionv-modules on s390-32, too.
[glibc.git] / localedata / tst-wctype.c
blobca557a62bc1202f8ffb9062071b2a3beaec001c2
1 /* Test program for iswctype() function in ja_JP locale.
2 Copyright (C) 2000-2016 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/>. */
20 #include <error.h>
21 #include <locale.h>
22 #include <stdio.h>
23 #include <stdlib.h>
24 #include <wchar.h>
25 #include <wctype.h>
27 static int
28 do_test (void)
30 wctype_t wct;
31 wchar_t buf[1000];
32 int result = 1;
34 setlocale (LC_ALL, "");
35 wprintf (L"locale = %s\n", setlocale (LC_CTYPE, NULL));
37 wct = wctype ("jhira");
38 if (wct == 0)
39 error (EXIT_FAILURE, 0, "jhira: no such character class");
41 if (fgetws (buf, sizeof (buf) / sizeof (buf[0]), stdin) != NULL)
43 int n;
45 wprintf (L"buf[] = \"%ls\"\n", buf);
47 result = 0;
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");
59 if (wct == 0)
60 error (EXIT_FAILURE, 0, "jkata: no such character class");
62 if (fgetws (buf, sizeof (buf) / sizeof (buf[0]), stdin) != NULL)
64 int n;
66 wprintf (L"buf[] = \"%ls\"\n", buf);
68 result = 0;
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");
80 if (wct == 0)
81 error (EXIT_FAILURE, 0, "jdigit: no such character class");
83 if (fgetws (buf, sizeof (buf) / sizeof (buf[0]), stdin) != NULL)
85 int n;
87 wprintf (L"buf[] = \"%ls\"\n", buf);
89 result = 0;
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");
101 if (wct == 0)
102 error (EXIT_FAILURE, 0, "jspace: no such character class");
104 if (fgetws (buf, sizeof (buf) / sizeof (buf[0]), stdin) != NULL)
106 int n;
108 wprintf (L"buf[] = \"%ls\"\n", buf);
110 result = 0;
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");
122 if (wct == 0)
123 error (EXIT_FAILURE, 0, "jkanji: no such character class");
125 if (fgetws (buf, sizeof (buf) / sizeof (buf[0]), stdin) != NULL)
127 int n;
129 wprintf (L"buf[] = \"%ls\"\n", buf);
131 result = 0;
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)));
142 return result;
145 #define TEST_FUNCTION do_test ()
146 #include "../test-skeleton.c"