1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 // REQUIRES: locale.en_US.UTF-8
10 // REQUIRES: locale.fr_FR.UTF-8
11 
12 // <locale>
13 
14 // template <class charT> class numpunct_byname;
15 
16 // char_type decimal_point() const;
17 
18 #include <locale>
19 #include <cassert>
20 
21 #include "test_macros.h"
22 #include "platform_support.h" // locale name macros
23 
main(int,char **)24 int main(int, char**)
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   return 0;
67 }
68