aboutsummaryrefslogtreecommitdiff
path: root/test/std/localization/locale.categories/category.ctype/ctype_base.pass.cpp
blob: 06c171f56da6a6b8eb276afb6707b1e63faccc2a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This test uses new symbols that were not defined in the libc++ shipped on
// darwin11 and darwin12:
// XFAIL: with_system_cxx_lib=macosx10.7
// XFAIL: with_system_cxx_lib=macosx10.8

// <locale>

// class ctype_base
// {
// public:
//     typedef T mask;
//
//     // numeric values are for exposition only.
//     static const mask space = 1 << 0;
//     static const mask print = 1 << 1;
//     static const mask cntrl = 1 << 2;
//     static const mask upper = 1 << 3;
//     static const mask lower = 1 << 4;
//     static const mask alpha = 1 << 5;
//     static const mask digit = 1 << 6;
//     static const mask punct = 1 << 7;
//     static const mask xdigit = 1 << 8;
//     static const mask alnum = alpha | digit;
//     static const mask graph = alnum | punct;
// };

#include <locale>
#include <cassert>

template <class _Tp>
void test(const _Tp &) {}

int main()
{
    assert(std::ctype_base::space);
    assert(std::ctype_base::print);
    assert(std::ctype_base::cntrl);
    assert(std::ctype_base::upper);
    assert(std::ctype_base::lower);
    assert(std::ctype_base::alpha);
    assert(std::ctype_base::digit);
    assert(std::ctype_base::punct);
    assert(std::ctype_base::xdigit);
    assert(
      ( std::ctype_base::space
      & std::ctype_base::print
      & std::ctype_base::cntrl
      & std::ctype_base::upper
      & std::ctype_base::lower
      & std::ctype_base::alpha
      & std::ctype_base::digit
      & std::ctype_base::punct
      & std::ctype_base::xdigit) == 0);
    assert(std::ctype_base::alnum == (std::ctype_base::alpha | std::ctype_base::digit));
    assert(std::ctype_base::graph == (std::ctype_base::alnum | std::ctype_base::punct));

    test(std::ctype_base::space);
    test(std::ctype_base::print);
    test(std::ctype_base::cntrl);
    test(std::ctype_base::upper);
    test(std::ctype_base::lower);
    test(std::ctype_base::alpha);
    test(std::ctype_base::digit);
    test(std::ctype_base::punct);
    test(std::ctype_base::xdigit);
    test(std::ctype_base::blank);
    test(std::ctype_base::alnum);
    test(std::ctype_base::graph);
}