[libcxx] [test] Fix the get/put long_double_zh_CN tests on Windows
authorMartin Storsjö <martin@martin.st>
Tue, 15 Feb 2022 13:49:40 +0000 (13:49 +0000)
committerMartin Storsjö <martin@martin.st>
Fri, 4 Mar 2022 08:17:44 +0000 (10:17 +0200)
Differential Revision: https://reviews.llvm.org/D120889

libcxx/test/std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_zh_CN.pass.cpp
libcxx/test/std/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_zh_CN.pass.cpp
libcxx/test/support/locale_helpers.h

index fef7b3e..a189696 100644 (file)
@@ -9,7 +9,6 @@
 // NetBSD does not support LC_MONETARY at the moment
 // XFAIL: netbsd
 
-// XFAIL: LIBCXX-WINDOWS-FIXME
 // XFAIL: LIBCXX-AIX-FIXME
 
 // REQUIRES: locale.zh_CN.UTF-8
@@ -31,6 +30,7 @@
 #include "test_macros.h"
 #include "test_iterators.h"
 
+#include "locale_helpers.h"
 #include "platform_support.h" // locale name macros
 
 typedef std::money_get<char, cpp17_input_iterator<const char*> > Fn;
@@ -69,6 +69,12 @@ int main(int, char**)
     ios.imbue(std::locale(ios.getloc(),
                           new std::moneypunct_byname<wchar_t, true>(loc_name)));
 #endif
+#ifdef _WIN32
+    std::string currency_name = "CNY";
+#else
+    std::string currency_name = "CNY ";
+#endif
+    std::string currency_symbol(LocaleHelpers::currency_symbol_zh_CN());
     {
         const my_facet f(1);
         // char, national
@@ -128,7 +134,7 @@ int main(int, char**)
             assert(ex == -123456789);
         }
         {   // zero, showbase
-            std::string v = "\xEF\xBF\xA5""0.00";
+            std::string v = currency_symbol + "0.00";
             typedef cpp17_input_iterator<const char*> I;
             long double ex;
             std::ios_base::iostate err = std::ios_base::goodbit;
@@ -139,7 +145,7 @@ int main(int, char**)
             assert(ex == 0);
         }
         {   // zero, showbase
-            std::string v = "\xEF\xBF\xA5""0.00";
+            std::string v = currency_symbol + "0.00";
             std::showbase(ios);
             typedef cpp17_input_iterator<const char*> I;
             long double ex;
@@ -152,7 +158,7 @@ int main(int, char**)
             std::noshowbase(ios);
         }
         {   // negative one, showbase
-            std::string v = "\xEF\xBF\xA5""-0.01";
+            std::string v = currency_symbol + "-0.01";
             typedef cpp17_input_iterator<const char*> I;
             long double ex;
             std::ios_base::iostate err = std::ios_base::goodbit;
@@ -163,7 +169,7 @@ int main(int, char**)
             assert(ex == -1);
         }
         {   // negative one, showbase
-            std::string v = "\xEF\xBF\xA5""-0.01";
+            std::string v = currency_symbol + "-0.01";
             std::showbase(ios);
             typedef cpp17_input_iterator<const char*> I;
             long double ex;
@@ -176,7 +182,7 @@ int main(int, char**)
             std::noshowbase(ios);
         }
         {   // positive, showbase
-            std::string v = "\xEF\xBF\xA5""1,234,567.89";
+            std::string v = currency_symbol + "1,234,567.89";
             typedef cpp17_input_iterator<const char*> I;
             long double ex;
             std::ios_base::iostate err = std::ios_base::goodbit;
@@ -187,7 +193,7 @@ int main(int, char**)
             assert(ex == 123456789);
         }
         {   // positive, showbase
-            std::string v = "\xEF\xBF\xA5""1,234,567.89";
+            std::string v = currency_symbol + "1,234,567.89";
             std::showbase(ios);
             typedef cpp17_input_iterator<const char*> I;
             long double ex;
@@ -200,7 +206,7 @@ int main(int, char**)
             std::noshowbase(ios);
         }
         {   // negative, showbase
-            std::string v = "\xEF\xBF\xA5""-1,234,567.89";
+            std::string v = currency_symbol + "-1,234,567.89";
             std::showbase(ios);
             typedef cpp17_input_iterator<const char*> I;
             long double ex;
@@ -305,7 +311,7 @@ int main(int, char**)
             assert(ex == 0);
         }
         {   // zero, showbase
-            std::string v = "CNY 0.00";
+            std::string v = currency_name + "0.00";
             std::showbase(ios);
             typedef cpp17_input_iterator<const char*> I;
             long double ex;
@@ -318,7 +324,7 @@ int main(int, char**)
             std::noshowbase(ios);
         }
         {   // negative one, showbase
-            std::string v = "CNY -0.01";
+            std::string v = currency_name + "-0.01";
             typedef cpp17_input_iterator<const char*> I;
             long double ex;
             std::ios_base::iostate err = std::ios_base::goodbit;
@@ -329,7 +335,7 @@ int main(int, char**)
             assert(ex == -1);
         }
         {   // negative one, showbase
-            std::string v = "CNY -0.01";
+            std::string v = currency_name + "-0.01";
             std::showbase(ios);
             typedef cpp17_input_iterator<const char*> I;
             long double ex;
@@ -342,7 +348,7 @@ int main(int, char**)
             std::noshowbase(ios);
         }
         {   // positive, showbase
-            std::string v = "CNY 1,234,567.89";
+            std::string v = currency_name + "1,234,567.89";
             typedef cpp17_input_iterator<const char*> I;
             long double ex;
             std::ios_base::iostate err = std::ios_base::goodbit;
@@ -353,7 +359,7 @@ int main(int, char**)
             assert(ex == 123456789);
         }
         {   // positive, showbase
-            std::string v = "CNY 1,234,567.89";
+            std::string v = currency_name + "1,234,567.89";
             std::showbase(ios);
             typedef cpp17_input_iterator<const char*> I;
             long double ex;
@@ -366,7 +372,7 @@ int main(int, char**)
             std::noshowbase(ios);
         }
         {   // negative, showbase
-            std::string v = "CNY -1,234,567.89";
+            std::string v = currency_name + "-1,234,567.89";
             std::showbase(ios);
             typedef cpp17_input_iterator<const char*> I;
             long double ex;
@@ -379,7 +385,7 @@ int main(int, char**)
             std::noshowbase(ios);
         }
         {   // negative, showbase
-            std::string v = "\xEF\xBF\xA5""-1,234,567.89";
+            std::string v = currency_symbol + "-1,234,567.89";
             std::showbase(ios);
             typedef cpp17_input_iterator<const char*> I;
             long double ex;
@@ -391,7 +397,7 @@ int main(int, char**)
             std::noshowbase(ios);
         }
         {   // negative, showbase
-            std::string v = "\xEF\xBF\xA5""-1,234,567.89";
+            std::string v = currency_symbol + "-1,234,567.89";
             typedef cpp17_input_iterator<const char*> I;
             long double ex;
             std::ios_base::iostate err = std::ios_base::goodbit;
@@ -402,6 +408,12 @@ int main(int, char**)
         }
     }
 #ifndef TEST_HAS_NO_WIDE_CHARACTERS
+#ifdef _WIN32
+    std::wstring w_currency_name = L"CNY";
+#else
+    std::wstring w_currency_name = L"CNY ";
+#endif
+    std::wstring w_currency_symbol(LocaleHelpers::currency_symbol_zh_CN());
     {
         const my_facetw f(1);
         // wchar_t, national
@@ -461,7 +473,7 @@ int main(int, char**)
             assert(ex == -123456789);
         }
         {   // zero, showbase
-            std::wstring v = L"\xFFE5""0.00";
+            std::wstring v = w_currency_symbol + L"0.00";
             typedef cpp17_input_iterator<const wchar_t*> I;
             long double ex;
             std::ios_base::iostate err = std::ios_base::goodbit;
@@ -472,7 +484,7 @@ int main(int, char**)
             assert(ex == 0);
         }
         {   // zero, showbase
-            std::wstring v = L"\xFFE5""0.00";
+            std::wstring v = w_currency_symbol + L"0.00";
             std::showbase(ios);
             typedef cpp17_input_iterator<const wchar_t*> I;
             long double ex;
@@ -485,7 +497,7 @@ int main(int, char**)
             std::noshowbase(ios);
         }
         {   // negative one, showbase
-            std::wstring v = L"\xFFE5""-0.01";
+            std::wstring v = w_currency_symbol + L"-0.01";
             typedef cpp17_input_iterator<const wchar_t*> I;
             long double ex;
             std::ios_base::iostate err = std::ios_base::goodbit;
@@ -496,7 +508,7 @@ int main(int, char**)
             assert(ex == -1);
         }
         {   // negative one, showbase
-            std::wstring v = L"\xFFE5""-0.01";
+            std::wstring v = w_currency_symbol + L"-0.01";
             std::showbase(ios);
             typedef cpp17_input_iterator<const wchar_t*> I;
             long double ex;
@@ -509,7 +521,7 @@ int main(int, char**)
             std::noshowbase(ios);
         }
         {   // positive, showbase
-            std::wstring v = L"\xFFE5""1,234,567.89";
+            std::wstring v = w_currency_symbol + L"1,234,567.89";
             typedef cpp17_input_iterator<const wchar_t*> I;
             long double ex;
             std::ios_base::iostate err = std::ios_base::goodbit;
@@ -520,7 +532,7 @@ int main(int, char**)
             assert(ex == 123456789);
         }
         {   // positive, showbase
-            std::wstring v = L"\xFFE5""1,234,567.89";
+            std::wstring v = w_currency_symbol + L"1,234,567.89";
             std::showbase(ios);
             typedef cpp17_input_iterator<const wchar_t*> I;
             long double ex;
@@ -533,7 +545,7 @@ int main(int, char**)
             std::noshowbase(ios);
         }
         {   // negative, showbase
-            std::wstring v = L"\xFFE5""-1,234,567.89";
+            std::wstring v = w_currency_symbol + L"-1,234,567.89";
             std::showbase(ios);
             typedef cpp17_input_iterator<const wchar_t*> I;
             long double ex;
@@ -638,7 +650,7 @@ int main(int, char**)
             assert(ex == 0);
         }
         {   // zero, showbase
-            std::wstring v = L"CNY 0.00";
+            std::wstring v = w_currency_name + L"0.00";
             std::showbase(ios);
             typedef cpp17_input_iterator<const wchar_t*> I;
             long double ex;
@@ -651,7 +663,7 @@ int main(int, char**)
             std::noshowbase(ios);
         }
         {   // negative one, showbase
-            std::wstring v = L"CNY -0.01";
+            std::wstring v = w_currency_name + L"-0.01";
             typedef cpp17_input_iterator<const wchar_t*> I;
             long double ex;
             std::ios_base::iostate err = std::ios_base::goodbit;
@@ -662,7 +674,7 @@ int main(int, char**)
             assert(ex == -1);
         }
         {   // negative one, showbase
-            std::wstring v = L"CNY -0.01";
+            std::wstring v = w_currency_name + L"-0.01";
             std::showbase(ios);
             typedef cpp17_input_iterator<const wchar_t*> I;
             long double ex;
@@ -675,7 +687,7 @@ int main(int, char**)
             std::noshowbase(ios);
         }
         {   // positive, showbase
-            std::wstring v = L"CNY 1,234,567.89";
+            std::wstring v = w_currency_name + L"1,234,567.89";
             typedef cpp17_input_iterator<const wchar_t*> I;
             long double ex;
             std::ios_base::iostate err = std::ios_base::goodbit;
@@ -686,7 +698,7 @@ int main(int, char**)
             assert(ex == 123456789);
         }
         {   // positive, showbase
-            std::wstring v = L"CNY 1,234,567.89";
+            std::wstring v = w_currency_name + L"1,234,567.89";
             std::showbase(ios);
             typedef cpp17_input_iterator<const wchar_t*> I;
             long double ex;
@@ -699,7 +711,7 @@ int main(int, char**)
             std::noshowbase(ios);
         }
         {   // negative, showbase
-            std::wstring v = L"CNY -1,234,567.89";
+            std::wstring v = w_currency_name + L"-1,234,567.89";
             std::showbase(ios);
             typedef cpp17_input_iterator<const wchar_t*> I;
             long double ex;
@@ -712,7 +724,7 @@ int main(int, char**)
             std::noshowbase(ios);
         }
         {   // negative, showbase
-            std::wstring v = L"\xFFE5""-1,234,567.89";
+            std::wstring v = w_currency_symbol + L"-1,234,567.89";
             std::showbase(ios);
             typedef cpp17_input_iterator<const wchar_t*> I;
             long double ex;
@@ -724,7 +736,7 @@ int main(int, char**)
             std::noshowbase(ios);
         }
         {   // negative, showbase
-            std::wstring v = L"\xFFE5""-1,234,567.89";
+            std::wstring v = w_currency_symbol + L"-1,234,567.89";
             typedef cpp17_input_iterator<const wchar_t*> I;
             long double ex;
             std::ios_base::iostate err = std::ios_base::goodbit;
index a3a2328..e9b459e 100644 (file)
@@ -9,7 +9,6 @@
 // NetBSD does not support LC_MONETARY at the moment
 // XFAIL: netbsd
 
-// XFAIL: LIBCXX-WINDOWS-FIXME
 // XFAIL: LIBCXX-AIX-FIXME
 
 // REQUIRES: locale.zh_CN.UTF-8
@@ -31,6 +30,7 @@
 #include "test_macros.h"
 #include "test_iterators.h"
 
+#include "locale_helpers.h"
 #include "platform_support.h" // locale name macros
 
 typedef std::money_put<char, cpp17_output_iterator<char*> > Fn;
@@ -71,6 +71,14 @@ int main(int, char**)
 #endif
 {
     const my_facet f(1);
+#ifdef _WIN32
+    std::string currency_name = "CNY";
+#else
+    std::string currency_name = "CNY ";
+#endif
+    std::string currency_name_padding(7 - currency_name.size(), ' ');
+    std::string currency_symbol(LocaleHelpers::currency_symbol_zh_CN());
+    std::string currency_symbol_padding(7 - currency_symbol.size(), ' ');
     // char, national
     {   // zero
         long double v = 0;
@@ -106,7 +114,7 @@ int main(int, char**)
         char str[100];
         cpp17_output_iterator<char*> iter = f.put(cpp17_output_iterator<char*>(str), false, ios, '*', v);
         std::string ex(str, base(iter));
-        assert(ex == "\xEF\xBF\xA5""0.00");
+        assert(ex == currency_symbol + "0.00");
     }
     {   // negative one, showbase
         long double v = -1;
@@ -114,7 +122,7 @@ int main(int, char**)
         char str[100];
         cpp17_output_iterator<char*> iter = f.put(cpp17_output_iterator<char*>(str), false, ios, '*', v);
         std::string ex(str, base(iter));
-        assert(ex == "\xEF\xBF\xA5""-0.01");
+        assert(ex == currency_symbol + "-0.01");
     }
     {   // positive, showbase
         long double v = 123456789;
@@ -122,7 +130,7 @@ int main(int, char**)
         char str[100];
         cpp17_output_iterator<char*> iter = f.put(cpp17_output_iterator<char*>(str), false, ios, '*', v);
         std::string ex(str, base(iter));
-        assert(ex == "\xEF\xBF\xA5""1,234,567.89");
+        assert(ex == currency_symbol + "1,234,567.89");
     }
     {   // negative, showbase
         long double v = -123456789;
@@ -130,7 +138,7 @@ int main(int, char**)
         char str[100];
         cpp17_output_iterator<char*> iter = f.put(cpp17_output_iterator<char*>(str), false, ios, '*', v);
         std::string ex(str, base(iter));
-        assert(ex == "\xEF\xBF\xA5""-1,234,567.89");
+        assert(ex == currency_symbol + "-1,234,567.89");
     }
     {   // negative, showbase, left
         long double v = -123456789;
@@ -140,7 +148,7 @@ int main(int, char**)
         char str[100];
         cpp17_output_iterator<char*> iter = f.put(cpp17_output_iterator<char*>(str), false, ios, ' ', v);
         std::string ex(str, base(iter));
-        assert(ex == "\xEF\xBF\xA5""-1,234,567.89    ");
+        assert(ex == currency_symbol + "-1,234,567.89" + currency_symbol_padding);
         assert(ios.width() == 0);
     }
     {   // negative, showbase, internal
@@ -151,7 +159,7 @@ int main(int, char**)
         char str[100];
         cpp17_output_iterator<char*> iter = f.put(cpp17_output_iterator<char*>(str), false, ios, ' ', v);
         std::string ex(str, base(iter));
-        assert(ex == "\xEF\xBF\xA5""-    1,234,567.89");
+        assert(ex == currency_symbol + "-" + currency_symbol_padding + "1,234,567.89");
         assert(ios.width() == 0);
     }
     {   // negative, showbase, right
@@ -162,7 +170,7 @@ int main(int, char**)
         char str[100];
         cpp17_output_iterator<char*> iter = f.put(cpp17_output_iterator<char*>(str), false, ios, ' ', v);
         std::string ex(str, base(iter));
-        assert(ex == "    \xEF\xBF\xA5""-1,234,567.89");
+        assert(ex == currency_symbol_padding + currency_symbol + "-1,234,567.89");
         assert(ios.width() == 0);
     }
 
@@ -203,7 +211,7 @@ int main(int, char**)
         char str[100];
         cpp17_output_iterator<char*> iter = f.put(cpp17_output_iterator<char*>(str), true, ios, '*', v);
         std::string ex(str, base(iter));
-        assert(ex == "CNY 0.00");
+        assert(ex == currency_name + "0.00");
     }
     {   // negative one, showbase
         long double v = -1;
@@ -211,7 +219,7 @@ int main(int, char**)
         char str[100];
         cpp17_output_iterator<char*> iter = f.put(cpp17_output_iterator<char*>(str), true, ios, '*', v);
         std::string ex(str, base(iter));
-        assert(ex == "CNY -0.01");
+        assert(ex == currency_name + "-0.01");
     }
     {   // positive, showbase
         long double v = 123456789;
@@ -219,7 +227,7 @@ int main(int, char**)
         char str[100];
         cpp17_output_iterator<char*> iter = f.put(cpp17_output_iterator<char*>(str), true, ios, '*', v);
         std::string ex(str, base(iter));
-        assert(ex == "CNY 1,234,567.89");
+        assert(ex == currency_name + "1,234,567.89");
     }
     {   // negative, showbase
         long double v = -123456789;
@@ -227,7 +235,7 @@ int main(int, char**)
         char str[100];
         cpp17_output_iterator<char*> iter = f.put(cpp17_output_iterator<char*>(str), true, ios, '*', v);
         std::string ex(str, base(iter));
-        assert(ex == "CNY -1,234,567.89");
+        assert(ex == currency_name + "-1,234,567.89");
     }
     {   // negative, showbase, left
         long double v = -123456789;
@@ -237,7 +245,7 @@ int main(int, char**)
         char str[100];
         cpp17_output_iterator<char*> iter = f.put(cpp17_output_iterator<char*>(str), true, ios, ' ', v);
         std::string ex(str, base(iter));
-        assert(ex == "CNY -1,234,567.89   ");
+        assert(ex == currency_name + "-1,234,567.89" + currency_name_padding);
         assert(ios.width() == 0);
     }
     {   // negative, showbase, internal
@@ -248,7 +256,7 @@ int main(int, char**)
         char str[100];
         cpp17_output_iterator<char*> iter = f.put(cpp17_output_iterator<char*>(str), true, ios, ' ', v);
         std::string ex(str, base(iter));
-        assert(ex == "CNY -   1,234,567.89");
+        assert(ex == currency_name + "-" + currency_name_padding + "1,234,567.89");
         assert(ios.width() == 0);
     }
     {   // negative, showbase, right
@@ -259,12 +267,19 @@ int main(int, char**)
         char str[100];
         cpp17_output_iterator<char*> iter = f.put(cpp17_output_iterator<char*>(str), true, ios, ' ', v);
         std::string ex(str, base(iter));
-        assert(ex == "   CNY -1,234,567.89");
+        assert(ex == currency_name_padding + currency_name + "-1,234,567.89");
         assert(ios.width() == 0);
     }
 }
 #ifndef TEST_HAS_NO_WIDE_CHARACTERS
 {
+#ifdef _WIN32
+    std::wstring currency_name = L"CNY";
+#else
+    std::wstring currency_name = L"CNY ";
+#endif
+    std::wstring currency_name_padding(7 - currency_name.size(), ' ');
+    std::wstring currency_symbol(LocaleHelpers::currency_symbol_zh_CN());
     const my_facetw f(1);
     // wchar_t, national
     std::noshowbase(ios);
@@ -303,7 +318,7 @@ int main(int, char**)
         wchar_t str[100];
         cpp17_output_iterator<wchar_t*> iter = f.put(cpp17_output_iterator<wchar_t*>(str), false, ios, '*', v);
         std::wstring ex(str, base(iter));
-        assert(ex == L"\xFFE5""0.00");
+        assert(ex == currency_symbol + L"0.00");
     }
     {   // negative one, showbase
         long double v = -1;
@@ -311,7 +326,7 @@ int main(int, char**)
         wchar_t str[100];
         cpp17_output_iterator<wchar_t*> iter = f.put(cpp17_output_iterator<wchar_t*>(str), false, ios, '*', v);
         std::wstring ex(str, base(iter));
-        assert(ex == L"\xFFE5""-0.01");
+        assert(ex == currency_symbol + L"-0.01");
     }
     {   // positive, showbase
         long double v = 123456789;
@@ -319,7 +334,7 @@ int main(int, char**)
         wchar_t str[100];
         cpp17_output_iterator<wchar_t*> iter = f.put(cpp17_output_iterator<wchar_t*>(str), false, ios, '*', v);
         std::wstring ex(str, base(iter));
-        assert(ex == L"\xFFE5""1,234,567.89");
+        assert(ex == currency_symbol + L"1,234,567.89");
     }
     {   // negative, showbase
         long double v = -123456789;
@@ -327,7 +342,7 @@ int main(int, char**)
         wchar_t str[100];
         cpp17_output_iterator<wchar_t*> iter = f.put(cpp17_output_iterator<wchar_t*>(str), false, ios, '*', v);
         std::wstring ex(str, base(iter));
-        assert(ex == L"\xFFE5""-1,234,567.89");
+        assert(ex == currency_symbol + L"-1,234,567.89");
     }
     {   // negative, showbase, left
         long double v = -123456789;
@@ -337,7 +352,7 @@ int main(int, char**)
         wchar_t str[100];
         cpp17_output_iterator<wchar_t*> iter = f.put(cpp17_output_iterator<wchar_t*>(str), false, ios, ' ', v);
         std::wstring ex(str, base(iter));
-        assert(ex == L"\xFFE5""-1,234,567.89      ");
+        assert(ex == currency_symbol + L"-1,234,567.89      ");
         assert(ios.width() == 0);
     }
     {   // negative, showbase, internal
@@ -348,7 +363,7 @@ int main(int, char**)
         wchar_t str[100];
         cpp17_output_iterator<wchar_t*> iter = f.put(cpp17_output_iterator<wchar_t*>(str), false, ios, ' ', v);
         std::wstring ex(str, base(iter));
-        assert(ex == L"\xFFE5""-      1,234,567.89");
+        assert(ex == currency_symbol + L"-      1,234,567.89");
         assert(ios.width() == 0);
     }
     {   // negative, showbase, right
@@ -359,7 +374,7 @@ int main(int, char**)
         wchar_t str[100];
         cpp17_output_iterator<wchar_t*> iter = f.put(cpp17_output_iterator<wchar_t*>(str), false, ios, ' ', v);
         std::wstring ex(str, base(iter));
-        assert(ex == L"      \xFFE5""-1,234,567.89");
+        assert(ex == L"      " + currency_symbol + L"-1,234,567.89");
         assert(ios.width() == 0);
     }
 
@@ -400,7 +415,7 @@ int main(int, char**)
         wchar_t str[100];
         cpp17_output_iterator<wchar_t*> iter = f.put(cpp17_output_iterator<wchar_t*>(str), true, ios, '*', v);
         std::wstring ex(str, base(iter));
-        assert(ex == L"CNY 0.00");
+        assert(ex == currency_name + L"0.00");
     }
     {   // negative one, showbase
         long double v = -1;
@@ -408,7 +423,7 @@ int main(int, char**)
         wchar_t str[100];
         cpp17_output_iterator<wchar_t*> iter = f.put(cpp17_output_iterator<wchar_t*>(str), true, ios, '*', v);
         std::wstring ex(str, base(iter));
-        assert(ex == L"CNY -0.01");
+        assert(ex == currency_name + L"-0.01");
     }
     {   // positive, showbase
         long double v = 123456789;
@@ -416,7 +431,7 @@ int main(int, char**)
         wchar_t str[100];
         cpp17_output_iterator<wchar_t*> iter = f.put(cpp17_output_iterator<wchar_t*>(str), true, ios, '*', v);
         std::wstring ex(str, base(iter));
-        assert(ex == L"CNY 1,234,567.89");
+        assert(ex == currency_name + L"1,234,567.89");
     }
     {   // negative, showbase
         long double v = -123456789;
@@ -424,7 +439,7 @@ int main(int, char**)
         wchar_t str[100];
         cpp17_output_iterator<wchar_t*> iter = f.put(cpp17_output_iterator<wchar_t*>(str), true, ios, '*', v);
         std::wstring ex(str, base(iter));
-        assert(ex == L"CNY -1,234,567.89");
+        assert(ex == currency_name + L"-1,234,567.89");
     }
     {   // negative, showbase, left
         long double v = -123456789;
@@ -434,7 +449,7 @@ int main(int, char**)
         wchar_t str[100];
         cpp17_output_iterator<wchar_t*> iter = f.put(cpp17_output_iterator<wchar_t*>(str), true, ios, ' ', v);
         std::wstring ex(str, base(iter));
-        assert(ex == L"CNY -1,234,567.89   ");
+        assert(ex == currency_name + L"-1,234,567.89" + currency_name_padding);
         assert(ios.width() == 0);
     }
     {   // negative, showbase, internal
@@ -445,7 +460,7 @@ int main(int, char**)
         wchar_t str[100];
         cpp17_output_iterator<wchar_t*> iter = f.put(cpp17_output_iterator<wchar_t*>(str), true, ios, ' ', v);
         std::wstring ex(str, base(iter));
-        assert(ex == L"CNY -   1,234,567.89");
+        assert(ex == currency_name + L"-" + currency_name_padding + L"1,234,567.89");
         assert(ios.width() == 0);
     }
     {   // negative, showbase, right
@@ -456,7 +471,7 @@ int main(int, char**)
         wchar_t str[100];
         cpp17_output_iterator<wchar_t*> iter = f.put(cpp17_output_iterator<wchar_t*>(str), true, ios, ' ', v);
         std::wstring ex(str, base(iter));
-        assert(ex == L"   CNY -1,234,567.89");
+        assert(ex == currency_name_padding + currency_name + L"-1,234,567.89");
         assert(ios.width() == 0);
     }
 }
index 9fb11b9..69df193 100644 (file)
@@ -86,6 +86,14 @@ MultiStringType currency_symbol_ru_RU() {
 #endif
 }
 
+MultiStringType currency_symbol_zh_CN() {
+#if defined(_WIN32)
+  return MKSTR("\u00A5"); // U+00A5 YEN SIGN
+#else
+  return MKSTR("\uFFE5"); // U+FFE5 FULLWIDTH YEN SIGN
+#endif
+}
+
 } // namespace LocaleHelpers
 
 #endif // LIBCXX_TEST_SUPPORT_LOCALE_HELPERS_H