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