decimal_point.pass.cpp revision f5256e16dfc425c1d466f6308d4026d529ce9e0b
1//===----------------------------------------------------------------------===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// 9 10// <locale> 11 12// template <class charT> class numpunct_byname; 13 14// char_type decimal_point() const; 15 16#include <locale> 17#include <cassert> 18 19int main() 20{ 21 { 22 std::locale l("C"); 23 { 24 typedef char C; 25 const std::numpunct<C>& np = std::use_facet<std::numpunct<C> >(l); 26 assert(np.decimal_point() == '.'); 27 } 28 { 29 typedef wchar_t C; 30 const std::numpunct<C>& np = std::use_facet<std::numpunct<C> >(l); 31 assert(np.decimal_point() == L'.'); 32 } 33 } 34 { 35 std::locale l("en_US"); 36 { 37 typedef char C; 38 const std::numpunct<C>& np = std::use_facet<std::numpunct<C> >(l); 39 assert(np.decimal_point() == '.'); 40 } 41 { 42 typedef wchar_t C; 43 const std::numpunct<C>& np = std::use_facet<std::numpunct<C> >(l); 44 assert(np.decimal_point() == L'.'); 45 } 46 } 47 { 48 std::locale l("fr_FR"); 49 { 50 typedef char C; 51 const std::numpunct<C>& np = std::use_facet<std::numpunct<C> >(l); 52 assert(np.decimal_point() == ','); 53 } 54 { 55 typedef wchar_t C; 56 const std::numpunct<C>& np = std::use_facet<std::numpunct<C> >(l); 57 assert(np.decimal_point() == L','); 58 } 59 } 60} 61