Home | History | Annotate | Download | only in locale.cons
      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.fr_FR.UTF-8
     11 
     12 // <locale>
     13 
     14 // locale(const locale& other) throw();
     15 
     16 #include <locale>
     17 #include <cassert>
     18 #include <new>
     19 
     20 #include "count_new.hpp"
     21 #include "platform_support.h" // locale name macros
     22 
     23 void check(const std::locale& loc)
     24 {
     25     assert(std::has_facet<std::collate<char> >(loc));
     26     assert(std::has_facet<std::collate<wchar_t> >(loc));
     27 
     28     assert(std::has_facet<std::ctype<char> >(loc));
     29     assert(std::has_facet<std::ctype<wchar_t> >(loc));
     30     assert((std::has_facet<std::codecvt<char, char, std::mbstate_t> >(loc)));
     31     assert((std::has_facet<std::codecvt<char16_t, char, std::mbstate_t> >(loc)));
     32     assert((std::has_facet<std::codecvt<char32_t, char, std::mbstate_t> >(loc)));
     33     assert((std::has_facet<std::codecvt<wchar_t, char, std::mbstate_t> >(loc)));
     34 
     35     assert((std::has_facet<std::moneypunct<char> >(loc)));
     36     assert((std::has_facet<std::moneypunct<wchar_t> >(loc)));
     37     assert((std::has_facet<std::money_get<char> >(loc)));
     38     assert((std::has_facet<std::money_get<wchar_t> >(loc)));
     39     assert((std::has_facet<std::money_put<char> >(loc)));
     40     assert((std::has_facet<std::money_put<wchar_t> >(loc)));
     41 
     42     assert((std::has_facet<std::numpunct<char> >(loc)));
     43     assert((std::has_facet<std::numpunct<wchar_t> >(loc)));
     44     assert((std::has_facet<std::num_get<char> >(loc)));
     45     assert((std::has_facet<std::num_get<wchar_t> >(loc)));
     46     assert((std::has_facet<std::num_put<char> >(loc)));
     47     assert((std::has_facet<std::num_put<wchar_t> >(loc)));
     48 
     49     assert((std::has_facet<std::time_get<char> >(loc)));
     50     assert((std::has_facet<std::time_get<wchar_t> >(loc)));
     51     assert((std::has_facet<std::time_put<char> >(loc)));
     52     assert((std::has_facet<std::time_put<wchar_t> >(loc)));
     53 
     54     assert((std::has_facet<std::messages<char> >(loc)));
     55     assert((std::has_facet<std::messages<wchar_t> >(loc)));
     56 }
     57 
     58 int main()
     59 {
     60     {
     61         std::locale loc(LOCALE_fr_FR_UTF_8);
     62         std::locale loc2 = loc;
     63         assert(loc == loc2);
     64         check(loc);
     65         check(loc2);
     66     }
     67     assert(globalMemCounter.checkOutstandingNewEq(0));
     68 }
     69