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 // This test uses new symbols that were not defined in the libc++ shipped on
11 // darwin11 and darwin12:
12 // XFAIL: with_system_lib=x86_64-apple-darwin11
13 // XFAIL: with_system_lib=x86_64-apple-darwin12
14 
15 // <locale>
16 
17 // class ctype_base
18 // {
19 // public:
20 //     typedef T mask;
21 //
22 //     // numeric values are for exposition only.
23 //     static const mask space = 1 << 0;
24 //     static const mask print = 1 << 1;
25 //     static const mask cntrl = 1 << 2;
26 //     static const mask upper = 1 << 3;
27 //     static const mask lower = 1 << 4;
28 //     static const mask alpha = 1 << 5;
29 //     static const mask digit = 1 << 6;
30 //     static const mask punct = 1 << 7;
31 //     static const mask xdigit = 1 << 8;
32 //     static const mask alnum = alpha | digit;
33 //     static const mask graph = alnum | punct;
34 // };
35 
36 #include <locale>
37 #include <cassert>
38 
39 template <class _Tp>
40 void test(const _Tp &) {}
41 
42 int main()
43 {
44     assert(std::ctype_base::space);
45     assert(std::ctype_base::print);
46     assert(std::ctype_base::cntrl);
47     assert(std::ctype_base::upper);
48     assert(std::ctype_base::lower);
49     assert(std::ctype_base::alpha);
50     assert(std::ctype_base::digit);
51     assert(std::ctype_base::punct);
52     assert(std::ctype_base::xdigit);
53     assert(
54       ( std::ctype_base::space
55       & std::ctype_base::print
56       & std::ctype_base::cntrl
57       & std::ctype_base::upper
58       & std::ctype_base::lower
59       & std::ctype_base::alpha
60       & std::ctype_base::digit
61       & std::ctype_base::punct
62       & std::ctype_base::xdigit) == 0);
63     assert(std::ctype_base::alnum == (std::ctype_base::alpha | std::ctype_base::digit));
64     assert(std::ctype_base::graph == (std::ctype_base::alnum | std::ctype_base::punct));
65 
66     test(std::ctype_base::space);
67     test(std::ctype_base::print);
68     test(std::ctype_base::cntrl);
69     test(std::ctype_base::upper);
70     test(std::ctype_base::lower);
71     test(std::ctype_base::alpha);
72     test(std::ctype_base::digit);
73     test(std::ctype_base::punct);
74     test(std::ctype_base::xdigit);
75     test(std::ctype_base::blank);
76     test(std::ctype_base::alnum);
77     test(std::ctype_base::graph);
78 }
79