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 // <locale>
10
11 // class moneypunct<charT, International>
12
13 // string grouping() const;
14
15 // The C++ and C standards are silent.
16 // POSIX standard is being followed (as a guideline).
17
18 #include <locale>
19 #include <limits>
20 #include <cassert>
21
22 #include "test_macros.h"
23
24 typedef std::moneypunct<char> F;
25
26 class Fnf
27 : public std::moneypunct<char, false>
28 {
29 public:
Fnf(std::size_t refs=0)30 explicit Fnf(std::size_t refs = 0)
31 : std::moneypunct<char, false>(refs) {}
32 };
33
34 class Fnt
35 : public std::moneypunct<char, true>
36 {
37 public:
Fnt(std::size_t refs=0)38 explicit Fnt(std::size_t refs = 0)
39 : std::moneypunct<char, true>(refs) {}
40 };
41
42 #ifndef TEST_HAS_NO_WIDE_CHARACTERS
43 class Fwf
44 : public std::moneypunct<wchar_t, false>
45 {
46 public:
Fwf(std::size_t refs=0)47 explicit Fwf(std::size_t refs = 0)
48 : std::moneypunct<wchar_t, false>(refs) {}
49 };
50
51 class Fwt
52 : public std::moneypunct<wchar_t, true>
53 {
54 public:
Fwt(std::size_t refs=0)55 explicit Fwt(std::size_t refs = 0)
56 : std::moneypunct<wchar_t, true>(refs) {}
57 };
58 #endif // TEST_HAS_NO_WIDE_CHARACTERS
59
main(int,char **)60 int main(int, char**)
61 {
62 {
63 Fnf f(1);
64 assert(f.grouping() == std::string());
65 }
66 {
67 Fnt f(1);
68 assert(f.grouping() == std::string());
69 }
70 #ifndef TEST_HAS_NO_WIDE_CHARACTERS
71 {
72 Fwf f(1);
73 assert(f.grouping() == std::string());
74 }
75 {
76 Fwt f(1);
77 assert(f.grouping() == std::string());
78 }
79 #endif
80
81 return 0;
82 }
83