1 //===----------------------------------------------------------------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 // REQUIRES: locale.en_US.UTF-8
11 // REQUIRES: locale.fr_FR.UTF-8
12 // REQUIRES: locale.ru_RU.UTF-8
13 // REQUIRES: locale.zh_CN.UTF-8
14 
15 // <locale>
16 
17 // class moneypunct_byname<charT, International>
18 
19 // string_type positive_sign() const;
20 
21 #include <locale>
22 #include <limits>
23 #include <cassert>
24 
25 #include "platform_support.h" // locale name macros
26 
27 class Fnf
28     : public std::moneypunct_byname<char, false>
29 {
30 public:
Fnf(const std::string & nm,std::size_t refs=0)31     explicit Fnf(const std::string& nm, std::size_t refs = 0)
32         : std::moneypunct_byname<char, false>(nm, refs) {}
33 };
34 
35 class Fnt
36     : public std::moneypunct_byname<char, true>
37 {
38 public:
Fnt(const std::string & nm,std::size_t refs=0)39     explicit Fnt(const std::string& nm, std::size_t refs = 0)
40         : std::moneypunct_byname<char, true>(nm, refs) {}
41 };
42 
43 class Fwf
44     : public std::moneypunct_byname<wchar_t, false>
45 {
46 public:
Fwf(const std::string & nm,std::size_t refs=0)47     explicit Fwf(const std::string& nm, std::size_t refs = 0)
48         : std::moneypunct_byname<wchar_t, false>(nm, refs) {}
49 };
50 
51 class Fwt
52     : public std::moneypunct_byname<wchar_t, true>
53 {
54 public:
Fwt(const std::string & nm,std::size_t refs=0)55     explicit Fwt(const std::string& nm, std::size_t refs = 0)
56         : std::moneypunct_byname<wchar_t, true>(nm, refs) {}
57 };
58 
main()59 int main()
60 {
61     {
62         Fnf f("C", 1);
63         assert(f.positive_sign() == std::string());
64     }
65     {
66         Fnt f("C", 1);
67         assert(f.positive_sign() == std::string());
68     }
69     {
70         Fwf f("C", 1);
71         assert(f.positive_sign() == std::wstring());
72     }
73     {
74         Fwt f("C", 1);
75         assert(f.positive_sign() == std::wstring());
76     }
77 
78     {
79         Fnf f(LOCALE_en_US_UTF_8, 1);
80         assert(f.positive_sign() == "");
81     }
82     {
83         Fnt f(LOCALE_en_US_UTF_8, 1);
84         assert(f.positive_sign() == "");
85     }
86     {
87         Fwf f(LOCALE_en_US_UTF_8, 1);
88         assert(f.positive_sign() == L"");
89     }
90     {
91         Fwt f(LOCALE_en_US_UTF_8, 1);
92         assert(f.positive_sign() == L"");
93     }
94 
95     {
96         Fnf f(LOCALE_fr_FR_UTF_8, 1);
97         assert(f.positive_sign() == "");
98     }
99     {
100         Fnt f(LOCALE_fr_FR_UTF_8, 1);
101         assert(f.positive_sign() == "");
102     }
103     {
104         Fwf f(LOCALE_fr_FR_UTF_8, 1);
105         assert(f.positive_sign() == L"");
106     }
107     {
108         Fwt f(LOCALE_fr_FR_UTF_8, 1);
109         assert(f.positive_sign() == L"");
110     }
111 
112     {
113         Fnf f(LOCALE_ru_RU_UTF_8, 1);
114         assert(f.positive_sign() == "");
115     }
116     {
117         Fnt f(LOCALE_ru_RU_UTF_8, 1);
118         assert(f.positive_sign() == "");
119     }
120     {
121         Fwf f(LOCALE_ru_RU_UTF_8, 1);
122         assert(f.positive_sign() == L"");
123     }
124     {
125         Fwt f(LOCALE_ru_RU_UTF_8, 1);
126         assert(f.positive_sign() == L"");
127     }
128 
129     {
130         Fnf f(LOCALE_zh_CN_UTF_8, 1);
131         assert(f.positive_sign() == "");
132     }
133     {
134         Fnt f(LOCALE_zh_CN_UTF_8, 1);
135         assert(f.positive_sign() == "");
136     }
137     {
138         Fwf f(LOCALE_zh_CN_UTF_8, 1);
139         assert(f.positive_sign() == L"");
140     }
141     {
142         Fwt f(LOCALE_zh_CN_UTF_8, 1);
143         assert(f.positive_sign() == L"");
144     }
145 }
146