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 thousands_sep() const;
18 
19 // TODO: investigation needed
20 // XFAIL: linux-gnu
21 
22 #include <locale>
23 #include <cassert>
24 
25 #include "platform_support.h" // locale name macros
26 
27 int main()
28 {
29     {
30         std::locale l("C");
31         {
32             typedef char C;
33             const std::numpunct<C>& np = std::use_facet<std::numpunct<C> >(l);
34             assert(np.thousands_sep() == ',');
35         }
36         {
37             typedef wchar_t C;
38             const std::numpunct<C>& np = std::use_facet<std::numpunct<C> >(l);
39             assert(np.thousands_sep() == L',');
40         }
41     }
42     {
43         std::locale l(LOCALE_en_US_UTF_8);
44         {
45             typedef char C;
46             const std::numpunct<C>& np = std::use_facet<std::numpunct<C> >(l);
47             assert(np.thousands_sep() == ',');
48         }
49         {
50             typedef wchar_t C;
51             const std::numpunct<C>& np = std::use_facet<std::numpunct<C> >(l);
52             assert(np.thousands_sep() == L',');
53         }
54     }
55     {
56         std::locale l(LOCALE_fr_FR_UTF_8);
57         {
58             typedef char C;
59             const std::numpunct<C>& np = std::use_facet<std::numpunct<C> >(l);
60             assert(np.thousands_sep() == ',');
61         }
62         {
63             typedef wchar_t C;
64             const std::numpunct<C>& np = std::use_facet<std::numpunct<C> >(l);
65             assert(np.thousands_sep() == L',');
66         }
67     }
68 }
69