1 //===----------------------------------------------------------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // XFAIL: apple-darwin
12 // REQUIRES: locale.en_US.UTF-8
13 // REQUIRES: locale.fr_FR.UTF-8
14 // REQUIRES: locale.ru_RU.UTF-8
15 // REQUIRES: locale.zh_CN.UTF-8
19 // class moneypunct_byname<charT, International>
21 // string_type curr_symbol() const;
27 #include "platform_support.h" // locale name macros
30 : public std::moneypunct_byname<char, false>
33 explicit Fnf(const std::string& nm, std::size_t refs = 0)
34 : std::moneypunct_byname<char, false>(nm, refs) {}
38 : public std::moneypunct_byname<char, true>
41 explicit Fnt(const std::string& nm, std::size_t refs = 0)
42 : std::moneypunct_byname<char, true>(nm, refs) {}
46 : public std::moneypunct_byname<wchar_t, false>
49 explicit Fwf(const std::string& nm, std::size_t refs = 0)
50 : std::moneypunct_byname<wchar_t, false>(nm, refs) {}
54 : public std::moneypunct_byname<wchar_t, true>
57 explicit Fwt(const std::string& nm, std::size_t refs = 0)
58 : std::moneypunct_byname<wchar_t, true>(nm, refs) {}
65 assert(f.curr_symbol() == std::string());
69 assert(f.curr_symbol() == std::string());
73 assert(f.curr_symbol() == std::wstring());
77 assert(f.curr_symbol() == std::wstring());
81 Fnf f(LOCALE_en_US_UTF_8, 1);
82 assert(f.curr_symbol() == "$");
85 Fnt f(LOCALE_en_US_UTF_8, 1);
86 assert(f.curr_symbol() == "USD ");
89 Fwf f(LOCALE_en_US_UTF_8, 1);
90 assert(f.curr_symbol() == L"$");
93 Fwt f(LOCALE_en_US_UTF_8, 1);
94 assert(f.curr_symbol() == L"USD ");
98 Fnf f(LOCALE_fr_FR_UTF_8, 1);
99 assert(f.curr_symbol() == " \u20ac");
102 Fnt f(LOCALE_fr_FR_UTF_8, 1);
103 assert(f.curr_symbol() == " EUR");
106 Fwf f(LOCALE_fr_FR_UTF_8, 1);
107 assert(f.curr_symbol() == L" \u20ac");
110 Fwt f(LOCALE_fr_FR_UTF_8, 1);
111 assert(f.curr_symbol() == L" EUR");
115 Fnf f(LOCALE_ru_RU_UTF_8, 1);
116 assert(f.curr_symbol() == " \xD1\x80\xD1\x83\xD0\xB1");
119 Fnt f(LOCALE_ru_RU_UTF_8, 1);
120 assert(f.curr_symbol() == " RUB");
123 Fwf f(LOCALE_ru_RU_UTF_8, 1);
124 assert(f.curr_symbol() == L" \x440\x443\x431");
127 Fwt f(LOCALE_ru_RU_UTF_8, 1);
128 assert(f.curr_symbol() == L" RUB");
132 Fnf f(LOCALE_zh_CN_UTF_8, 1);
133 assert(f.curr_symbol() == "\xEF\xBF\xA5");
136 Fnt f(LOCALE_zh_CN_UTF_8, 1);
137 assert(f.curr_symbol() == "CNY ");
140 Fwf f(LOCALE_zh_CN_UTF_8, 1);
141 assert(f.curr_symbol() == L"\xFFE5");
144 Fwt f(LOCALE_zh_CN_UTF_8, 1);
145 assert(f.curr_symbol() == L"CNY ");