diff --git a/libcxx/test/std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_zh_CN.pass.cpp b/libcxx/test/std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_zh_CN.pass.cpp --- a/libcxx/test/std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_zh_CN.pass.cpp +++ b/libcxx/test/std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_zh_CN.pass.cpp @@ -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 @@ -68,6 +67,13 @@ new std::moneypunct_byname(loc_name))); ios.imbue(std::locale(ios.getloc(), new std::moneypunct_byname(loc_name))); +#endif +#ifdef _WIN32 + std::string curr_symbol = "\u00A5"; + std::string curr_text = "CNY"; +#else + std::string curr_symbol = "\uFFE5"; + std::string curr_text = "CNY "; #endif { const my_facet f(1); @@ -128,7 +134,7 @@ assert(ex == -123456789); } { // zero, showbase - std::string v = "\xEF\xBF\xA5""0.00"; + std::string v = curr_symbol + "0.00"; typedef cpp17_input_iterator I; long double ex; std::ios_base::iostate err = std::ios_base::goodbit; @@ -139,7 +145,7 @@ assert(ex == 0); } { // zero, showbase - std::string v = "\xEF\xBF\xA5""0.00"; + std::string v = curr_symbol + "0.00"; std::showbase(ios); typedef cpp17_input_iterator I; long double ex; @@ -152,7 +158,7 @@ std::noshowbase(ios); } { // negative one, showbase - std::string v = "\xEF\xBF\xA5""-0.01"; + std::string v = curr_symbol + "-0.01"; typedef cpp17_input_iterator I; long double ex; std::ios_base::iostate err = std::ios_base::goodbit; @@ -163,7 +169,7 @@ assert(ex == -1); } { // negative one, showbase - std::string v = "\xEF\xBF\xA5""-0.01"; + std::string v = curr_symbol + "-0.01"; std::showbase(ios); typedef cpp17_input_iterator I; long double ex; @@ -176,7 +182,7 @@ std::noshowbase(ios); } { // positive, showbase - std::string v = "\xEF\xBF\xA5""1,234,567.89"; + std::string v = curr_symbol + "1,234,567.89"; typedef cpp17_input_iterator I; long double ex; std::ios_base::iostate err = std::ios_base::goodbit; @@ -187,7 +193,7 @@ assert(ex == 123456789); } { // positive, showbase - std::string v = "\xEF\xBF\xA5""1,234,567.89"; + std::string v = curr_symbol + "1,234,567.89"; std::showbase(ios); typedef cpp17_input_iterator I; long double ex; @@ -200,7 +206,7 @@ std::noshowbase(ios); } { // negative, showbase - std::string v = "\xEF\xBF\xA5""-1,234,567.89"; + std::string v = curr_symbol + "-1,234,567.89"; std::showbase(ios); typedef cpp17_input_iterator I; long double ex; @@ -305,7 +311,7 @@ assert(ex == 0); } { // zero, showbase - std::string v = "CNY 0.00"; + std::string v = curr_text + "0.00"; std::showbase(ios); typedef cpp17_input_iterator I; long double ex; @@ -318,7 +324,7 @@ std::noshowbase(ios); } { // negative one, showbase - std::string v = "CNY -0.01"; + std::string v = curr_text + "-0.01"; typedef cpp17_input_iterator I; long double ex; std::ios_base::iostate err = std::ios_base::goodbit; @@ -329,7 +335,7 @@ assert(ex == -1); } { // negative one, showbase - std::string v = "CNY -0.01"; + std::string v = curr_text + "-0.01"; std::showbase(ios); typedef cpp17_input_iterator I; long double ex; @@ -342,7 +348,7 @@ std::noshowbase(ios); } { // positive, showbase - std::string v = "CNY 1,234,567.89"; + std::string v = curr_text + "1,234,567.89"; typedef cpp17_input_iterator I; long double ex; std::ios_base::iostate err = std::ios_base::goodbit; @@ -353,7 +359,7 @@ assert(ex == 123456789); } { // positive, showbase - std::string v = "CNY 1,234,567.89"; + std::string v = curr_text + "1,234,567.89"; std::showbase(ios); typedef cpp17_input_iterator I; long double ex; @@ -366,7 +372,7 @@ std::noshowbase(ios); } { // negative, showbase - std::string v = "CNY -1,234,567.89"; + std::string v = curr_text + "-1,234,567.89"; std::showbase(ios); typedef cpp17_input_iterator I; long double ex; @@ -379,7 +385,7 @@ std::noshowbase(ios); } { // negative, showbase - std::string v = "\xEF\xBF\xA5""-1,234,567.89"; + std::string v = curr_symbol + "-1,234,567.89"; std::showbase(ios); typedef cpp17_input_iterator I; long double ex; @@ -391,7 +397,7 @@ std::noshowbase(ios); } { // negative, showbase - std::string v = "\xEF\xBF\xA5""-1,234,567.89"; + std::string v = curr_symbol + "-1,234,567.89"; typedef cpp17_input_iterator I; long double ex; std::ios_base::iostate err = std::ios_base::goodbit; @@ -402,6 +408,13 @@ } } #ifndef TEST_HAS_NO_WIDE_CHARACTERS +#ifdef _WIN32 + std::wstring w_curr_symbol = L"\u00A5"; + std::wstring w_curr_text = L"CNY"; +#else + std::wstring w_curr_symbol = L"\uFFE5"; + std::wstring w_curr_text = L"CNY "; +#endif { const my_facetw f(1); // wchar_t, national @@ -461,7 +474,7 @@ assert(ex == -123456789); } { // zero, showbase - std::wstring v = L"\xFFE5""0.00"; + std::wstring v = w_curr_symbol + L"0.00"; typedef cpp17_input_iterator I; long double ex; std::ios_base::iostate err = std::ios_base::goodbit; @@ -472,7 +485,7 @@ assert(ex == 0); } { // zero, showbase - std::wstring v = L"\xFFE5""0.00"; + std::wstring v = w_curr_symbol + L"0.00"; std::showbase(ios); typedef cpp17_input_iterator I; long double ex; @@ -485,7 +498,7 @@ std::noshowbase(ios); } { // negative one, showbase - std::wstring v = L"\xFFE5""-0.01"; + std::wstring v = w_curr_symbol + L"-0.01"; typedef cpp17_input_iterator I; long double ex; std::ios_base::iostate err = std::ios_base::goodbit; @@ -496,7 +509,7 @@ assert(ex == -1); } { // negative one, showbase - std::wstring v = L"\xFFE5""-0.01"; + std::wstring v = w_curr_symbol + L"-0.01"; std::showbase(ios); typedef cpp17_input_iterator I; long double ex; @@ -509,7 +522,7 @@ std::noshowbase(ios); } { // positive, showbase - std::wstring v = L"\xFFE5""1,234,567.89"; + std::wstring v = w_curr_symbol + L"1,234,567.89"; typedef cpp17_input_iterator I; long double ex; std::ios_base::iostate err = std::ios_base::goodbit; @@ -520,7 +533,7 @@ assert(ex == 123456789); } { // positive, showbase - std::wstring v = L"\xFFE5""1,234,567.89"; + std::wstring v = w_curr_symbol + L"1,234,567.89"; std::showbase(ios); typedef cpp17_input_iterator I; long double ex; @@ -533,7 +546,7 @@ std::noshowbase(ios); } { // negative, showbase - std::wstring v = L"\xFFE5""-1,234,567.89"; + std::wstring v = w_curr_symbol + L"-1,234,567.89"; std::showbase(ios); typedef cpp17_input_iterator I; long double ex; @@ -638,7 +651,7 @@ assert(ex == 0); } { // zero, showbase - std::wstring v = L"CNY 0.00"; + std::wstring v = w_curr_text + L"0.00"; std::showbase(ios); typedef cpp17_input_iterator I; long double ex; @@ -651,7 +664,7 @@ std::noshowbase(ios); } { // negative one, showbase - std::wstring v = L"CNY -0.01"; + std::wstring v = w_curr_text + L"-0.01"; typedef cpp17_input_iterator I; long double ex; std::ios_base::iostate err = std::ios_base::goodbit; @@ -662,7 +675,7 @@ assert(ex == -1); } { // negative one, showbase - std::wstring v = L"CNY -0.01"; + std::wstring v = w_curr_text + L"-0.01"; std::showbase(ios); typedef cpp17_input_iterator I; long double ex; @@ -675,7 +688,7 @@ std::noshowbase(ios); } { // positive, showbase - std::wstring v = L"CNY 1,234,567.89"; + std::wstring v = w_curr_text + L"1,234,567.89"; typedef cpp17_input_iterator I; long double ex; std::ios_base::iostate err = std::ios_base::goodbit; @@ -686,7 +699,7 @@ assert(ex == 123456789); } { // positive, showbase - std::wstring v = L"CNY 1,234,567.89"; + std::wstring v = w_curr_text + L"1,234,567.89"; std::showbase(ios); typedef cpp17_input_iterator I; long double ex; @@ -699,7 +712,7 @@ std::noshowbase(ios); } { // negative, showbase - std::wstring v = L"CNY -1,234,567.89"; + std::wstring v = w_curr_text + L"-1,234,567.89"; std::showbase(ios); typedef cpp17_input_iterator I; long double ex; @@ -712,7 +725,7 @@ std::noshowbase(ios); } { // negative, showbase - std::wstring v = L"\xFFE5""-1,234,567.89"; + std::wstring v = w_curr_symbol + L"-1,234,567.89"; std::showbase(ios); typedef cpp17_input_iterator I; long double ex; @@ -724,7 +737,7 @@ std::noshowbase(ios); } { // negative, showbase - std::wstring v = L"\xFFE5""-1,234,567.89"; + std::wstring v = w_curr_symbol + L"-1,234,567.89"; typedef cpp17_input_iterator I; long double ex; std::ios_base::iostate err = std::ios_base::goodbit; diff --git a/libcxx/test/std/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_zh_CN.pass.cpp b/libcxx/test/std/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_zh_CN.pass.cpp --- a/libcxx/test/std/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_zh_CN.pass.cpp +++ b/libcxx/test/std/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_zh_CN.pass.cpp @@ -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 @@ -71,6 +70,17 @@ #endif { const my_facet f(1); +#ifdef _WIN32 + std::string curr_symbol = "\u00A5"; + std::string curr_pad20 = " "; + std::string curr_text = "CNY"; + std::string curr_pad20_text = " "; +#else + std::string curr_symbol = "\uFFE5"; + std::string curr_pad20 = " "; + std::string curr_text = "CNY "; + std::string curr_pad20_text = " "; +#endif // char, national { // zero long double v = 0; @@ -106,7 +116,7 @@ char str[100]; cpp17_output_iterator iter = f.put(cpp17_output_iterator(str), false, ios, '*', v); std::string ex(str, iter.base()); - assert(ex == "\xEF\xBF\xA5""0.00"); + assert(ex == curr_symbol + "0.00"); } { // negative one, showbase long double v = -1; @@ -114,7 +124,7 @@ char str[100]; cpp17_output_iterator iter = f.put(cpp17_output_iterator(str), false, ios, '*', v); std::string ex(str, iter.base()); - assert(ex == "\xEF\xBF\xA5""-0.01"); + assert(ex == curr_symbol + "-0.01"); } { // positive, showbase long double v = 123456789; @@ -122,7 +132,7 @@ char str[100]; cpp17_output_iterator iter = f.put(cpp17_output_iterator(str), false, ios, '*', v); std::string ex(str, iter.base()); - assert(ex == "\xEF\xBF\xA5""1,234,567.89"); + assert(ex == curr_symbol + "1,234,567.89"); } { // negative, showbase long double v = -123456789; @@ -130,7 +140,7 @@ char str[100]; cpp17_output_iterator iter = f.put(cpp17_output_iterator(str), false, ios, '*', v); std::string ex(str, iter.base()); - assert(ex == "\xEF\xBF\xA5""-1,234,567.89"); + assert(ex == curr_symbol + "-1,234,567.89"); } { // negative, showbase, left long double v = -123456789; @@ -140,7 +150,7 @@ char str[100]; cpp17_output_iterator iter = f.put(cpp17_output_iterator(str), false, ios, ' ', v); std::string ex(str, iter.base()); - assert(ex == "\xEF\xBF\xA5""-1,234,567.89 "); + assert(ex == curr_symbol + "-1,234,567.89" + curr_pad20); assert(ios.width() == 0); } { // negative, showbase, internal @@ -151,7 +161,7 @@ char str[100]; cpp17_output_iterator iter = f.put(cpp17_output_iterator(str), false, ios, ' ', v); std::string ex(str, iter.base()); - assert(ex == "\xEF\xBF\xA5""- 1,234,567.89"); + assert(ex == curr_symbol + "-" + curr_pad20 + "1,234,567.89"); assert(ios.width() == 0); } { // negative, showbase, right @@ -162,7 +172,7 @@ char str[100]; cpp17_output_iterator iter = f.put(cpp17_output_iterator(str), false, ios, ' ', v); std::string ex(str, iter.base()); - assert(ex == " \xEF\xBF\xA5""-1,234,567.89"); + assert(ex == curr_pad20 + curr_symbol + "-1,234,567.89"); assert(ios.width() == 0); } @@ -203,7 +213,7 @@ char str[100]; cpp17_output_iterator iter = f.put(cpp17_output_iterator(str), true, ios, '*', v); std::string ex(str, iter.base()); - assert(ex == "CNY 0.00"); + assert(ex == curr_text + "0.00"); } { // negative one, showbase long double v = -1; @@ -211,7 +221,7 @@ char str[100]; cpp17_output_iterator iter = f.put(cpp17_output_iterator(str), true, ios, '*', v); std::string ex(str, iter.base()); - assert(ex == "CNY -0.01"); + assert(ex == curr_text + "-0.01"); } { // positive, showbase long double v = 123456789; @@ -219,7 +229,7 @@ char str[100]; cpp17_output_iterator iter = f.put(cpp17_output_iterator(str), true, ios, '*', v); std::string ex(str, iter.base()); - assert(ex == "CNY 1,234,567.89"); + assert(ex == curr_text + "1,234,567.89"); } { // negative, showbase long double v = -123456789; @@ -227,7 +237,7 @@ char str[100]; cpp17_output_iterator iter = f.put(cpp17_output_iterator(str), true, ios, '*', v); std::string ex(str, iter.base()); - assert(ex == "CNY -1,234,567.89"); + assert(ex == curr_text + "-1,234,567.89"); } { // negative, showbase, left long double v = -123456789; @@ -237,7 +247,7 @@ char str[100]; cpp17_output_iterator iter = f.put(cpp17_output_iterator(str), true, ios, ' ', v); std::string ex(str, iter.base()); - assert(ex == "CNY -1,234,567.89 "); + assert(ex == curr_text + "-1,234,567.89" + curr_pad20_text); assert(ios.width() == 0); } { // negative, showbase, internal @@ -248,7 +258,7 @@ char str[100]; cpp17_output_iterator iter = f.put(cpp17_output_iterator(str), true, ios, ' ', v); std::string ex(str, iter.base()); - assert(ex == "CNY - 1,234,567.89"); + assert(ex == curr_text + "-" + curr_pad20_text + "1,234,567.89"); assert(ios.width() == 0); } { // negative, showbase, right @@ -259,12 +269,21 @@ char str[100]; cpp17_output_iterator iter = f.put(cpp17_output_iterator(str), true, ios, ' ', v); std::string ex(str, iter.base()); - assert(ex == " CNY -1,234,567.89"); + assert(ex == curr_pad20_text + curr_text + "-1,234,567.89"); assert(ios.width() == 0); } } #ifndef TEST_HAS_NO_WIDE_CHARACTERS { +#ifdef _WIN32 + std::wstring w_curr_symbol = L"\u00A5"; + std::wstring w_curr_text = L"CNY"; + std::wstring w_curr_pad20_text = L" "; +#else + std::wstring w_curr_symbol = L"\uFFE5"; + std::wstring w_curr_text = L"CNY "; + std::wstring w_curr_pad20_text = L" "; +#endif const my_facetw f(1); // wchar_t, national std::noshowbase(ios); @@ -303,7 +322,7 @@ wchar_t str[100]; cpp17_output_iterator iter = f.put(cpp17_output_iterator(str), false, ios, '*', v); std::wstring ex(str, iter.base()); - assert(ex == L"\xFFE5""0.00"); + assert(ex == w_curr_symbol + L"0.00"); } { // negative one, showbase long double v = -1; @@ -311,7 +330,7 @@ wchar_t str[100]; cpp17_output_iterator iter = f.put(cpp17_output_iterator(str), false, ios, '*', v); std::wstring ex(str, iter.base()); - assert(ex == L"\xFFE5""-0.01"); + assert(ex == w_curr_symbol + L"-0.01"); } { // positive, showbase long double v = 123456789; @@ -319,7 +338,7 @@ wchar_t str[100]; cpp17_output_iterator iter = f.put(cpp17_output_iterator(str), false, ios, '*', v); std::wstring ex(str, iter.base()); - assert(ex == L"\xFFE5""1,234,567.89"); + assert(ex == w_curr_symbol + L"1,234,567.89"); } { // negative, showbase long double v = -123456789; @@ -327,7 +346,7 @@ wchar_t str[100]; cpp17_output_iterator iter = f.put(cpp17_output_iterator(str), false, ios, '*', v); std::wstring ex(str, iter.base()); - assert(ex == L"\xFFE5""-1,234,567.89"); + assert(ex == w_curr_symbol + L"-1,234,567.89"); } { // negative, showbase, left long double v = -123456789; @@ -337,7 +356,7 @@ wchar_t str[100]; cpp17_output_iterator iter = f.put(cpp17_output_iterator(str), false, ios, ' ', v); std::wstring ex(str, iter.base()); - assert(ex == L"\xFFE5""-1,234,567.89 "); + assert(ex == w_curr_symbol + L"-1,234,567.89 "); assert(ios.width() == 0); } { // negative, showbase, internal @@ -348,7 +367,7 @@ wchar_t str[100]; cpp17_output_iterator iter = f.put(cpp17_output_iterator(str), false, ios, ' ', v); std::wstring ex(str, iter.base()); - assert(ex == L"\xFFE5""- 1,234,567.89"); + assert(ex == w_curr_symbol + L"- 1,234,567.89"); assert(ios.width() == 0); } { // negative, showbase, right @@ -359,7 +378,7 @@ wchar_t str[100]; cpp17_output_iterator iter = f.put(cpp17_output_iterator(str), false, ios, ' ', v); std::wstring ex(str, iter.base()); - assert(ex == L" \xFFE5""-1,234,567.89"); + assert(ex == L" " + w_curr_symbol + L"-1,234,567.89"); assert(ios.width() == 0); } @@ -400,7 +419,7 @@ wchar_t str[100]; cpp17_output_iterator iter = f.put(cpp17_output_iterator(str), true, ios, '*', v); std::wstring ex(str, iter.base()); - assert(ex == L"CNY 0.00"); + assert(ex == w_curr_text + L"0.00"); } { // negative one, showbase long double v = -1; @@ -408,7 +427,7 @@ wchar_t str[100]; cpp17_output_iterator iter = f.put(cpp17_output_iterator(str), true, ios, '*', v); std::wstring ex(str, iter.base()); - assert(ex == L"CNY -0.01"); + assert(ex == w_curr_text + L"-0.01"); } { // positive, showbase long double v = 123456789; @@ -416,7 +435,7 @@ wchar_t str[100]; cpp17_output_iterator iter = f.put(cpp17_output_iterator(str), true, ios, '*', v); std::wstring ex(str, iter.base()); - assert(ex == L"CNY 1,234,567.89"); + assert(ex == w_curr_text + L"1,234,567.89"); } { // negative, showbase long double v = -123456789; @@ -424,7 +443,7 @@ wchar_t str[100]; cpp17_output_iterator iter = f.put(cpp17_output_iterator(str), true, ios, '*', v); std::wstring ex(str, iter.base()); - assert(ex == L"CNY -1,234,567.89"); + assert(ex == w_curr_text + L"-1,234,567.89"); } { // negative, showbase, left long double v = -123456789; @@ -434,7 +453,7 @@ wchar_t str[100]; cpp17_output_iterator iter = f.put(cpp17_output_iterator(str), true, ios, ' ', v); std::wstring ex(str, iter.base()); - assert(ex == L"CNY -1,234,567.89 "); + assert(ex == w_curr_text + L"-1,234,567.89" + w_curr_pad20_text); assert(ios.width() == 0); } { // negative, showbase, internal @@ -445,7 +464,7 @@ wchar_t str[100]; cpp17_output_iterator iter = f.put(cpp17_output_iterator(str), true, ios, ' ', v); std::wstring ex(str, iter.base()); - assert(ex == L"CNY - 1,234,567.89"); + assert(ex == w_curr_text + L"-" + w_curr_pad20_text + L"1,234,567.89"); assert(ios.width() == 0); } { // negative, showbase, right @@ -456,7 +475,7 @@ wchar_t str[100]; cpp17_output_iterator iter = f.put(cpp17_output_iterator(str), true, ios, ' ', v); std::wstring ex(str, iter.base()); - assert(ex == L" CNY -1,234,567.89"); + assert(ex == w_curr_pad20_text + w_curr_text + L"-1,234,567.89"); assert(ios.width() == 0); } }