Home | History | Annotate | Download | only in locale.numpunct.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 // REQUIRES: locale.en_US.UTF-8
     11 // REQUIRES: locale.fr_FR.UTF-8
     12 
     13 // <locale>
     14 
     15 // template <class charT> class numpunct_byname;
     16 
     17 // char_type decimal_point() const;
     18 
     19 #include <locale>
     20 #include <cassert>
     21 
     22 #include "platform_support.h" // locale name macros
     23 
     24 int main()
     25 {
     26     {
     27         std::locale l("C");
     28         {
     29             typedef char C;
     30             const std::numpunct<C>& np = std::use_facet<std::numpunct<C> >(l);
     31             assert(np.decimal_point() == '.');
     32         }
     33         {
     34             typedef wchar_t C;
     35             const std::numpunct<C>& np = std::use_facet<std::numpunct<C> >(l);
     36             assert(np.decimal_point() == L'.');
     37         }
     38     }
     39     {
     40         std::locale l(LOCALE_en_US_UTF_8);
     41         {
     42             typedef char C;
     43             const std::numpunct<C>& np = std::use_facet<std::numpunct<C> >(l);
     44             assert(np.decimal_point() == '.');
     45         }
     46         {
     47             typedef wchar_t C;
     48             const std::numpunct<C>& np = std::use_facet<std::numpunct<C> >(l);
     49             assert(np.decimal_point() == L'.');
     50         }
     51     }
     52     {
     53         std::locale l(LOCALE_fr_FR_UTF_8);
     54         {
     55             typedef char C;
     56             const std::numpunct<C>& np = std::use_facet<std::numpunct<C> >(l);
     57             assert(np.decimal_point() == ',');
     58         }
     59         {
     60             typedef wchar_t C;
     61             const std::numpunct<C>& np = std::use_facet<std::numpunct<C> >(l);
     62             assert(np.decimal_point() == L',');
     63         }
     64     }
     65 }
     66