1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 // <cwctype>
10 
11 // XFAIL: no-wide-characters
12 
13 #include <cwctype>
14 #include <type_traits>
15 
16 #include "test_macros.h"
17 
18 
19 #ifndef WEOF
20 #error WEOF not defined
21 #endif
22 
23 #ifdef iswalnum
24 #error iswalnum defined
25 #endif
26 
27 #ifdef iswalpha
28 #error iswalpha defined
29 #endif
30 
31 #ifdef iswblank
32 #error iswblank defined
33 #endif
34 
35 #ifdef iswcntrl
36 #error iswcntrl defined
37 #endif
38 
39 #ifdef iswdigit
40 #error iswdigit defined
41 #endif
42 
43 #ifdef iswgraph
44 #error iswgraph defined
45 #endif
46 
47 #ifdef iswlower
48 #error iswlower defined
49 #endif
50 
51 #ifdef iswprint
52 #error iswprint defined
53 #endif
54 
55 #ifdef iswpunct
56 #error iswpunct defined
57 #endif
58 
59 #ifdef iswspace
60 #error iswspace defined
61 #endif
62 
63 #ifdef iswupper
64 #error iswupper defined
65 #endif
66 
67 #ifdef iswxdigit
68 #error iswxdigit defined
69 #endif
70 
71 #ifdef iswctype
72 #error iswctype defined
73 #endif
74 
75 #ifdef wctype
76 #error wctype defined
77 #endif
78 
79 #ifdef towlower
80 #error towlower defined
81 #endif
82 
83 #ifdef towupper
84 #error towupper defined
85 #endif
86 
87 #ifdef towctrans
88 #error towctrans defined
89 #endif
90 
91 #ifdef wctrans
92 #error wctrans defined
93 #endif
94 
main(int,char **)95 int main(int, char**)
96 {
97     std::wint_t w = 0;
98     ASSERT_SAME_TYPE(int, decltype(std::iswalnum(w)));
99     ASSERT_SAME_TYPE(int, decltype(std::iswalpha(w)));
100     ASSERT_SAME_TYPE(int, decltype(std::iswblank(w)));
101     ASSERT_SAME_TYPE(int, decltype(std::iswcntrl(w)));
102     ASSERT_SAME_TYPE(int, decltype(std::iswdigit(w)));
103     ASSERT_SAME_TYPE(int, decltype(std::iswgraph(w)));
104     ASSERT_SAME_TYPE(int, decltype(std::iswlower(w)));
105     ASSERT_SAME_TYPE(int, decltype(std::iswprint(w)));
106     ASSERT_SAME_TYPE(int, decltype(std::iswpunct(w)));
107     ASSERT_SAME_TYPE(int, decltype(std::iswspace(w)));
108     ASSERT_SAME_TYPE(int, decltype(std::iswupper(w)));
109     ASSERT_SAME_TYPE(int, decltype(std::iswxdigit(w)));
110 
111     ASSERT_SAME_TYPE(int, decltype(std::iswctype(w, std::wctype_t())));
112 
113     ASSERT_SAME_TYPE(std::wctype_t,  decltype(std::wctype("")));
114     ASSERT_SAME_TYPE(std::wint_t,    decltype(std::towlower(w)));
115     ASSERT_SAME_TYPE(std::wint_t,    decltype(std::towupper(w)));
116     ASSERT_SAME_TYPE(std::wint_t,    decltype(std::towctrans(w, std::wctrans_t())));
117     ASSERT_SAME_TYPE(std::wctrans_t, decltype(std::wctrans("")));
118 
119   return 0;
120 }
121