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 // pattern neg_format() const;
14 
15 #include <locale>
16 #include <limits>
17 #include <cassert>
18 
19 #include "test_macros.h"
20 
21 typedef std::moneypunct<char> F;
22 
23 class Fnf
24     : public std::moneypunct<char, false>
25 {
26 public:
Fnf(std::size_t refs=0)27     explicit Fnf(std::size_t refs = 0)
28         : std::moneypunct<char, false>(refs) {}
29 };
30 
31 class Fnt
32     : public std::moneypunct<char, true>
33 {
34 public:
Fnt(std::size_t refs=0)35     explicit Fnt(std::size_t refs = 0)
36         : std::moneypunct<char, true>(refs) {}
37 };
38 
39 class Fwf
40     : public std::moneypunct<wchar_t, false>
41 {
42 public:
Fwf(std::size_t refs=0)43     explicit Fwf(std::size_t refs = 0)
44         : std::moneypunct<wchar_t, false>(refs) {}
45 };
46 
47 class Fwt
48     : public std::moneypunct<wchar_t, true>
49 {
50 public:
Fwt(std::size_t refs=0)51     explicit Fwt(std::size_t refs = 0)
52         : std::moneypunct<wchar_t, true>(refs) {}
53 };
54 
main(int,char **)55 int main(int, char**)
56 {
57     {
58         Fnf f(1);
59         std::money_base::pattern p = f.neg_format();
60         assert(p.field[0] == std::money_base::symbol);
61         assert(p.field[1] == std::money_base::sign);
62         assert(p.field[2] == std::money_base::none);
63         assert(p.field[3] == std::money_base::value);
64     }
65     {
66         Fnt f(1);
67         std::money_base::pattern p = f.neg_format();
68         assert(p.field[0] == std::money_base::symbol);
69         assert(p.field[1] == std::money_base::sign);
70         assert(p.field[2] == std::money_base::none);
71         assert(p.field[3] == std::money_base::value);
72     }
73     {
74         Fwf f(1);
75         std::money_base::pattern p = f.neg_format();
76         assert(p.field[0] == std::money_base::symbol);
77         assert(p.field[1] == std::money_base::sign);
78         assert(p.field[2] == std::money_base::none);
79         assert(p.field[3] == std::money_base::value);
80     }
81     {
82         Fwt f(1);
83         std::money_base::pattern p = f.neg_format();
84         assert(p.field[0] == std::money_base::symbol);
85         assert(p.field[1] == std::money_base::sign);
86         assert(p.field[2] == std::money_base::none);
87         assert(p.field[3] == std::money_base::value);
88     }
89 
90   return 0;
91 }
92