category.pass.cpp revision 0a69fa14d2f0521e45a72068c14fe573b140d48b
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// typedef int category;
13
14#include <locale>
15#include <type_traits>
16#include <cassert>
17
18template <class _Tp>
19void test(const _Tp &) {}
20
21
22int main()
23{
24    static_assert((std::is_same<std::locale::category, int>::value), "");
25    assert(std::locale::none == 0);
26    assert(std::locale::collate);
27    assert(std::locale::ctype);
28    assert(std::locale::monetary);
29    assert(std::locale::numeric);
30    assert(std::locale::time);
31    assert(std::locale::messages);
32    assert((std::locale::collate
33          & std::locale::ctype
34          & std::locale::monetary
35          & std::locale::numeric
36          & std::locale::time
37          & std::locale::messages) == 0);
38    assert((std::locale::collate
39          | std::locale::ctype
40          | std::locale::monetary
41          | std::locale::numeric
42          | std::locale::time
43          | std::locale::messages)
44         == std::locale::all);
45
46    test(std::locale::none);
47    test(std::locale::collate);
48    test(std::locale::ctype);
49    test(std::locale::monetary);
50    test(std::locale::numeric);
51    test(std::locale::time);
52    test(std::locale::messages);
53    test(std::locale::all);
54}
55