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
24int 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> >(loc: l);
31 assert(np.decimal_point() == '.');
32 }
33#ifndef TEST_HAS_NO_WIDE_CHARACTERS
34 {
35 typedef wchar_t C;
36 const std::numpunct<C>& np = std::use_facet<std::numpunct<C> >(loc: l);
37 assert(np.decimal_point() == L'.');
38 }
39#endif
40 }
41 {
42 std::locale l(LOCALE_en_US_UTF_8);
43 {
44 typedef char C;
45 const std::numpunct<C>& np = std::use_facet<std::numpunct<C> >(l);
46 assert(np.decimal_point() == '.');
47 }
48#ifndef TEST_HAS_NO_WIDE_CHARACTERS
49 {
50 typedef wchar_t C;
51 const std::numpunct<C>& np = std::use_facet<std::numpunct<C> >(l);
52 assert(np.decimal_point() == L'.');
53 }
54#endif
55 }
56 {
57 std::locale l(LOCALE_fr_FR_UTF_8);
58 {
59 typedef char C;
60 const std::numpunct<C>& np = std::use_facet<std::numpunct<C> >(l);
61 assert(np.decimal_point() == ',');
62 }
63#ifndef TEST_HAS_NO_WIDE_CHARACTERS
64 {
65 typedef wchar_t C;
66 const std::numpunct<C>& np = std::use_facet<std::numpunct<C> >(l);
67 assert(np.decimal_point() == L',');
68 }
69#endif
70 }
71
72 return 0;
73}
74

source code of libcxx/test/std/localization/locale.categories/facet.numpunct/locale.numpunct.byname/decimal_point.pass.cpp