date_order.pass.cpp revision 239e341c94184e2ed2357f2e054c84fbb1fbed2a
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 20#include "../../../../platform_support.h" // locale name macros 21 22typedef std::time_get_byname<char, input_iterator<const char*> > F; 23 24class my_facet 25 : public F 26{ 27public: 28 explicit my_facet(const std::string& nm, std::size_t refs = 0) 29 : F(nm, refs) {} 30}; 31 32int 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