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