date_order.pass.cpp revision e2f2a15066552758a508e8a7325e0ccad4a5389b
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// class time_get_byname<charT, InputIterator>
13
14// dateorder date_order() const;
15
16#include <locale>
17#include <cassert>
18#include "iterators.h"
19
20typedef std::time_get_byname<char, input_iterator<const char*> > F;
21
22class my_facet
23    : public F
24{
25public:
26    explicit my_facet(const std::string& nm, std::size_t refs = 0)
27        : F(nm, refs) {}
28};
29
30int main()
31{
32    {
33        const my_facet f("en_US.UTF-8", 1);
34        assert(f.date_order() == std::time_base::mdy);
35    }
36    {
37        const my_facet f("fr_FR.UTF-8", 1);
38        assert(f.date_order() == std::time_base::dmy);
39    }
40    {
41        const my_facet f("ru_RU.UTF-8", 1);
42        assert(f.date_order() == std::time_base::dmy);
43    }
44    {
45        const my_facet f("zh_CN.UTF-8", 1);
46        assert(f.date_order() == std::time_base::ymd);
47    }
48}
49