Home | History | Annotate | Download | only in locale.time.get.byname
      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 "test_iterators.h"
     19 
     20 #include "platform_support.h" // locale name macros
     21 
     22 typedef std::time_get_byname<wchar_t, input_iterator<const wchar_t*> > F;
     23 
     24 class my_facet
     25     : public F
     26 {
     27 public:
     28     explicit my_facet(const std::string& nm, std::size_t refs = 0)
     29         : F(nm, refs) {}
     30 };
     31 
     32 int main()
     33 {
     34     {
     35         const my_facet f(LOCALE_en_US_UTF_8, 1);
     36         assert(f.date_order() == std::time_base::mdy);
     37     }
     38     {
     39         const my_facet f(LOCALE_fr_FR_UTF_8, 1);
     40         assert(f.date_order() == std::time_base::dmy);
     41     }
     42     {
     43         const my_facet f(LOCALE_ru_RU_UTF_8, 1);
     44         assert(f.date_order() == std::time_base::dmy);
     45     }
     46     {
     47         const my_facet f(LOCALE_zh_CN_UTF_8, 1);
     48         assert(f.date_order() == std::time_base::ymd);
     49     }
     50 }
     51