1 //===----------------------------------------------------------------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 // <locale>
11 
12 // template <> class ctype<char>;
13 
14 // bool is(mask m, char c) const;
15 
16 #include <locale>
17 #include <cassert>
18 
19 int main()
20 {
21     std::locale l = std::locale::classic();
22     {
23         typedef std::ctype<char> F;
24         const F& f = std::use_facet<F>(l);
25 
26         assert(f.is(F::space, ' '));
27         assert(!f.is(F::space, 'A'));
28 
29         assert(f.is(F::print, ' '));
30         assert(!f.is(F::print, '\x07'));
31 
32         assert(f.is(F::cntrl, '\x07'));
33         assert(!f.is(F::cntrl, ' '));
34 
35         assert(f.is(F::upper, 'A'));
36         assert(!f.is(F::upper, 'a'));
37 
38         assert(f.is(F::lower, 'a'));
39         assert(!f.is(F::lower, 'A'));
40 
41         assert(f.is(F::alpha, 'a'));
42         assert(!f.is(F::alpha, '1'));
43 
44         assert(f.is(F::digit, '1'));
45         assert(!f.is(F::digit, 'a'));
46 
47         assert(f.is(F::punct, '.'));
48         assert(!f.is(F::punct, 'a'));
49 
50         assert(f.is(F::xdigit, 'a'));
51         assert(!f.is(F::xdigit, 'g'));
52 
53         assert(f.is(F::alnum, 'a'));
54         assert(!f.is(F::alnum, '.'));
55 
56         assert(f.is(F::graph, '.'));
57         assert(!f.is(F::graph,  '\x07'));
58     }
59 }
60