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 grouping() 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) {}
63 // Monetary grouping strings may be terminated with 0 or CHAR_MAX, defining
64 // how the grouping is repeated.
65 std::string s = std::string(1, CHAR_MAX);
68 assert(f.grouping() == s || f.grouping() == "");
72 assert(f.grouping() == s || f.grouping() == "");
76 assert(f.grouping() == s || f.grouping() == "");
80 assert(f.grouping() == s || f.grouping() == "");
84 Fnf f(LOCALE_en_US_UTF_8, 1);
85 assert(f.grouping() == "\3\3");
88 Fnt f(LOCALE_en_US_UTF_8, 1);
89 assert(f.grouping() == "\3\3");
92 Fwf f(LOCALE_en_US_UTF_8, 1);
93 assert(f.grouping() == "\3\3");
96 Fwt f(LOCALE_en_US_UTF_8, 1);
97 assert(f.grouping() == "\3\3");
101 Fnf f(LOCALE_fr_FR_UTF_8, 1);
102 assert(f.grouping() == "\3");
105 Fnt f(LOCALE_fr_FR_UTF_8, 1);
106 assert(f.grouping() == "\3");
109 Fwf f(LOCALE_fr_FR_UTF_8, 1);
110 assert(f.grouping() == "\3");
113 Fwt f(LOCALE_fr_FR_UTF_8, 1);
114 assert(f.grouping() == "\3");
118 Fnf f(LOCALE_ru_RU_UTF_8, 1);
119 assert(f.grouping() == "\3\3");
122 Fnt f(LOCALE_ru_RU_UTF_8, 1);
123 assert(f.grouping() == "\3\3");
126 Fwf f(LOCALE_ru_RU_UTF_8, 1);
127 assert(f.grouping() == "\3\3");
130 Fwt f(LOCALE_ru_RU_UTF_8, 1);
131 assert(f.grouping() == "\3\3");
135 Fnf f(LOCALE_zh_CN_UTF_8, 1);
136 assert(f.grouping() == "\3");
139 Fnt f(LOCALE_zh_CN_UTF_8, 1);
140 assert(f.grouping() == "\3");
143 Fwf f(LOCALE_zh_CN_UTF_8, 1);
144 assert(f.grouping() == "\3");
147 Fwt f(LOCALE_zh_CN_UTF_8, 1);
148 assert(f.grouping() == "\3");