summaryrefslogtreecommitdiffstats
path: root/test/localization/locale.categories/category.ctype/locale.ctype/locale.ctype.members/is_1.pass.cpp
blob: 07c9e87ead6d14231ad57ef8a4d1e5167ea63afa (plain)
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
//===----------------------------------------------------------------------===//
//
// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <locale>

// template <class charT> class ctype;

// bool is(mask m, charT c) const;

#include <locale>
#include <cassert>

int main()
{
    std::locale l = std::locale::classic();
    {
        typedef std::ctype<wchar_t> F;
        const F& f = std::use_facet<F>(l);

        assert(f.is(F::space, L' '));
        assert(!f.is(F::space, L'A'));

        assert(f.is(F::print, L' '));
        assert(!f.is(F::print, L'\x07'));

        assert(f.is(F::cntrl, L'\x07'));
        assert(!f.is(F::cntrl, L' '));

        assert(f.is(F::upper, L'A'));
        assert(!f.is(F::upper, L'a'));

        assert(f.is(F::lower, L'a'));
        assert(!f.is(F::lower, L'A'));

        assert(f.is(F::alpha, L'a'));
        assert(!f.is(F::alpha, L'1'));

        assert(f.is(F::digit, L'1'));
        assert(!f.is(F::digit, L'a'));

        assert(f.is(F::punct, L'.'));
        assert(!f.is(F::punct, L'a'));

        assert(f.is(F::xdigit, L'a'));
        assert(!f.is(F::xdigit, L'g'));

        assert(f.is(F::alnum, L'a'));
        assert(!f.is(F::alnum, L'.'));

        assert(f.is(F::graph, L'.'));
        assert(!f.is(F::graph,  L'\x07'));
    }
}