Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / third_party / libc++ / trunk / test / localization / locale.categories / category.time / locale.time.get.byname / date_order.pass.cpp
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 // REQUIRES: locale.en_US.UTF-8
11 // REQUIRES: locale.fr_FR.UTF-8
12 // REQUIRES: locale.ru_RU.UTF-8
13 // REQUIRES: locale.zh_CN.UTF-8
14
15 // <locale>
16
17 // class time_get_byname<charT, InputIterator>
18
19 // dateorder date_order() const;
20
21 #include <locale>
22 #include <cassert>
23 #include "test_iterators.h"
24
25 #include "platform_support.h" // locale name macros
26
27 typedef std::time_get_byname<char, input_iterator<const char*> > F;
28
29 class my_facet
30     : public F
31 {
32 public:
33     explicit my_facet(const std::string& nm, std::size_t refs = 0)
34         : F(nm, refs) {}
35 };
36
37 int main()
38 {
39     {
40         const my_facet f(LOCALE_en_US_UTF_8, 1);
41         assert(f.date_order() == std::time_base::mdy);
42     }
43     {
44         const my_facet f(LOCALE_fr_FR_UTF_8, 1);
45         assert(f.date_order() == std::time_base::dmy);
46     }
47     {
48         const my_facet f(LOCALE_ru_RU_UTF_8, 1);
49         assert(f.date_order() == std::time_base::dmy);
50     }
51     {
52         const my_facet f(LOCALE_zh_CN_UTF_8, 1);
53         assert(f.date_order() == std::time_base::ymd);
54     }
55 }