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_type negative_sign() const;
14 
15 // The C++ and C standards are silent.
16 //   On this one, common sense is the guideline.
17 //   If customers complain, I'll endeavor to minimize customer complaints
18 
19 #include <locale>
20 #include <limits>
21 #include <cassert>
22 
23 #include "test_macros.h"
24 
25 typedef std::moneypunct<char> F;
26 
27 class Fnf
28     : public std::moneypunct<char, false>
29 {
30 public:
Fnf(std::size_t refs=0)31     explicit Fnf(std::size_t refs = 0)
32         : std::moneypunct<char, false>(refs) {}
33 };
34 
35 class Fnt
36     : public std::moneypunct<char, true>
37 {
38 public:
Fnt(std::size_t refs=0)39     explicit Fnt(std::size_t refs = 0)
40         : std::moneypunct<char, true>(refs) {}
41 };
42 
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 
main(int,char **)59 int main(int, char**)
60 {
61     {
62         Fnf f(1);
63         assert(f.negative_sign() == "-");
64     }
65     {
66         Fnt f(1);
67         assert(f.negative_sign() == "-");
68     }
69     {
70         Fwf f(1);
71         assert(f.negative_sign() == L"-");
72     }
73     {
74         Fwt f(1);
75         assert(f.negative_sign() == L"-");
76     }
77 
78   return 0;
79 }
80