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 // <locale>
10 
11 // template <class charT> class ctype;
12 
13 // bool is(mask m, charT c) const;
14 
15 // XFAIL: libcpp-has-no-wide-characters
16 
17 #include <locale>
18 #include <cassert>
19 
20 #include "test_macros.h"
21 
main(int,char **)22 int main(int, char**)
23 {
24     std::locale l = std::locale::classic();
25     {
26         typedef std::ctype<wchar_t> F;
27         const F& f = std::use_facet<F>(l);
28 
29         assert(f.is(F::space, L' '));
30         assert(!f.is(F::space, L'A'));
31 
32         assert(f.is(F::print, L' '));
33         assert(!f.is(F::print, L'\x07'));
34 
35         assert(f.is(F::cntrl, L'\x07'));
36         assert(!f.is(F::cntrl, L' '));
37 
38         assert(f.is(F::upper, L'A'));
39         assert(!f.is(F::upper, L'a'));
40 
41         assert(f.is(F::lower, L'a'));
42         assert(!f.is(F::lower, L'A'));
43 
44         assert(f.is(F::alpha, L'a'));
45         assert(!f.is(F::alpha, L'1'));
46 
47         assert(f.is(F::digit, L'1'));
48         assert(!f.is(F::digit, L'a'));
49 
50         assert(f.is(F::punct, L'.'));
51         assert(!f.is(F::punct, L'a'));
52 
53         assert(f.is(F::xdigit, L'a'));
54         assert(!f.is(F::xdigit, L'g'));
55 
56         assert(f.is(F::alnum, L'a'));
57         assert(!f.is(F::alnum, L'.'));
58 
59         assert(f.is(F::graph, L'.'));
60         assert(!f.is(F::graph,  L'\x07'));
61     }
62 
63   return 0;
64 }
65