[libcxx-commits] [libcxx] 1425011 - [libcxx] [test] Fix en_US money locale formatting tests on Windows

Martin Storsjö via libcxx-commits libcxx-commits at lists.llvm.org
Wed Mar 2 13:24:57 PST 2022


Author: Martin Storsjö
Date: 2022-03-02T23:24:37+02:00
New Revision: 142501117a78080d2615074d3986fa42aa6a0734

URL: https://github.com/llvm/llvm-project/commit/142501117a78080d2615074d3986fa42aa6a0734
DIFF: https://github.com/llvm/llvm-project/commit/142501117a78080d2615074d3986fa42aa6a0734.diff

LOG: [libcxx] [test] Fix en_US money locale formatting tests on Windows

In the en_US locale on Windows, negative currency amounts is formatted
as "($0.01)" instead of "-$0.01".

Adjust the test references accordingly, making these tests pass.

Differential Revision: https://reviews.llvm.org/D120798

Added: 
    

Modified: 
    libcxx/test/std/input.output/iostream.format/ext.manip/get_money.pass.cpp
    libcxx/test/std/input.output/iostream.format/ext.manip/put_money.pass.cpp
    libcxx/test/std/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_en_US.pass.cpp
    libcxx/test/std/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_string_en_US.pass.cpp

Removed: 
    


################################################################################
diff  --git a/libcxx/test/std/input.output/iostream.format/ext.manip/get_money.pass.cpp b/libcxx/test/std/input.output/iostream.format/ext.manip/get_money.pass.cpp
index e6cce946a7391..92b82e5f02786 100644
--- a/libcxx/test/std/input.output/iostream.format/ext.manip/get_money.pass.cpp
+++ b/libcxx/test/std/input.output/iostream.format/ext.manip/get_money.pass.cpp
@@ -12,8 +12,6 @@
 
 // REQUIRES: locale.en_US.UTF-8
 
-// XFAIL: LIBCXX-WINDOWS-FIXME
-
 #include <iomanip>
 #include <istream>
 #include <cassert>
@@ -44,7 +42,11 @@ struct testbuf
 int main(int, char**)
 {
     {
+#if defined(_WIN32)
+        testbuf<char> sb("  ($1,234,567.89)");
+#else
         testbuf<char> sb("  -$1,234,567.89");
+#endif
         std::istream is(&sb);
         is.imbue(std::locale(LOCALE_en_US_UTF_8));
         long double x = 0;
@@ -52,7 +54,11 @@ int main(int, char**)
         assert(x == -123456789);
     }
     {
+#if defined(_WIN32)
+        testbuf<char> sb("  (USD 1,234,567.89)");
+#else
         testbuf<char> sb("  -USD 1,234,567.89");
+#endif
         std::istream is(&sb);
         is.imbue(std::locale(LOCALE_en_US_UTF_8));
         long double x = 0;
@@ -61,7 +67,11 @@ int main(int, char**)
     }
 #ifndef TEST_HAS_NO_WIDE_CHARACTERS
     {
+#if defined(_WIN32)
+        testbuf<wchar_t> sb(L"  ($1,234,567.89)");
+#else
         testbuf<wchar_t> sb(L"  -$1,234,567.89");
+#endif
         std::wistream is(&sb);
         is.imbue(std::locale(LOCALE_en_US_UTF_8));
         long double x = 0;
@@ -69,7 +79,11 @@ int main(int, char**)
         assert(x == -123456789);
     }
     {
+#if defined(_WIN32)
+        testbuf<wchar_t> sb(L"  (USD 1,234,567.89)");
+#else
         testbuf<wchar_t> sb(L"  -USD 1,234,567.89");
+#endif
         std::wistream is(&sb);
         is.imbue(std::locale(LOCALE_en_US_UTF_8));
         long double x = 0;

diff  --git a/libcxx/test/std/input.output/iostream.format/ext.manip/put_money.pass.cpp b/libcxx/test/std/input.output/iostream.format/ext.manip/put_money.pass.cpp
index 199e792e80a11..0cfbcee0c4e28 100644
--- a/libcxx/test/std/input.output/iostream.format/ext.manip/put_money.pass.cpp
+++ b/libcxx/test/std/input.output/iostream.format/ext.manip/put_money.pass.cpp
@@ -12,8 +12,6 @@
 
 // REQUIRES: locale.en_US.UTF-8
 
-// XFAIL: LIBCXX-WINDOWS-FIXME
-
 #include <iomanip>
 #include <ostream>
 #include <cassert>
@@ -62,7 +60,11 @@ int main(int, char**)
         std::showbase(os);
         long double x = -123456789;
         os << std::put_money(x, false);
+#if defined(_WIN32)
+        assert(sb.str() == "($1,234,567.89)");
+#else
         assert(sb.str() == "-$1,234,567.89");
+#endif
     }
     {
         testbuf<char> sb;
@@ -71,7 +73,11 @@ int main(int, char**)
         std::showbase(os);
         long double x = -123456789;
         os << std::put_money(x, true);
+#if defined(_WIN32)
+        assert(sb.str() == "(USD1,234,567.89)");
+#else
         assert(sb.str() == "-USD 1,234,567.89");
+#endif
     }
 #ifndef TEST_HAS_NO_WIDE_CHARACTERS
     {
@@ -81,7 +87,11 @@ int main(int, char**)
         std::showbase(os);
         long double x = -123456789;
         os << std::put_money(x, false);
+#if defined(_WIN32)
+        assert(sb.str() == L"($1,234,567.89)");
+#else
         assert(sb.str() == L"-$1,234,567.89");
+#endif
     }
     {
         testbuf<wchar_t> sb;
@@ -90,7 +100,11 @@ int main(int, char**)
         std::showbase(os);
         long double x = -123456789;
         os << std::put_money(x, true);
+#if defined(_WIN32)
+        assert(sb.str() == L"(USD1,234,567.89)");
+#else
         assert(sb.str() == L"-USD 1,234,567.89");
+#endif
     }
 #endif
 

diff  --git a/libcxx/test/std/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_en_US.pass.cpp b/libcxx/test/std/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_en_US.pass.cpp
index ca8a4bb298fc9..d229f5a676efa 100644
--- a/libcxx/test/std/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_en_US.pass.cpp
+++ b/libcxx/test/std/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_en_US.pass.cpp
@@ -14,7 +14,6 @@
 //               long double units) const;
 
 // REQUIRES: locale.en_US.UTF-8
-// XFAIL: LIBCXX-WINDOWS-FIXME
 
 #include <locale>
 #include <ios>
@@ -76,7 +75,11 @@ 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, iter.base());
+#if defined(_WIN32)
+        assert(ex == "(0.01)");
+#else
         assert(ex == "-0.01");
+#endif
     }
     {   // positive
         long double v = 123456789;
@@ -90,7 +93,11 @@ 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, iter.base());
+#if defined(_WIN32)
+        assert(ex == "(1,234,567.89)");
+#else
         assert(ex == "-1,234,567.89");
+#endif
     }
     {   // zero, showbase
         long double v = 0;
@@ -106,7 +113,11 @@ 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, iter.base());
+#if defined(_WIN32)
+        assert(ex == "($0.01)");
+#else
         assert(ex == "-$0.01");
+#endif
     }
     {   // positive, showbase
         long double v = 123456789;
@@ -122,7 +133,11 @@ 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, iter.base());
+#if defined(_WIN32)
+        assert(ex == "($1,234,567.89)");
+#else
         assert(ex == "-$1,234,567.89");
+#endif
     }
     {   // negative, showbase, left
         long double v = -123456789;
@@ -132,7 +147,11 @@ 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, iter.base());
+#if defined(_WIN32)
+        assert(ex == "($1,234,567.89)     ");
+#else
         assert(ex == "-$1,234,567.89      ");
+#endif
         assert(ios.width() == 0);
     }
     {   // negative, showbase, internal
@@ -143,7 +162,11 @@ 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, iter.base());
+#if defined(_WIN32)
+        assert(ex == "($     1,234,567.89)");
+#else
         assert(ex == "-$      1,234,567.89");
+#endif
         assert(ios.width() == 0);
     }
     {   // negative, showbase, right
@@ -154,7 +177,11 @@ 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, iter.base());
+#if defined(_WIN32)
+        assert(ex == "     ($1,234,567.89)");
+#else
         assert(ex == "      -$1,234,567.89");
+#endif
         assert(ios.width() == 0);
     }
 
@@ -173,7 +200,11 @@ 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, iter.base());
+#if defined(_WIN32)
+        assert(ex == "(0.01)");
+#else
         assert(ex == "-0.01");
+#endif
     }
     {   // positive
         long double v = 123456789;
@@ -187,7 +218,11 @@ 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, iter.base());
+#if defined(_WIN32)
+        assert(ex == "(1,234,567.89)");
+#else
         assert(ex == "-1,234,567.89");
+#endif
     }
     {   // zero, showbase
         long double v = 0;
@@ -195,7 +230,11 @@ 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, iter.base());
+#if defined(_WIN32)
+        assert(ex == "USD0.00");
+#else
         assert(ex == "USD 0.00");
+#endif
     }
     {   // negative one, showbase
         long double v = -1;
@@ -203,7 +242,11 @@ 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, iter.base());
+#if defined(_WIN32)
+        assert(ex == "(USD0.01)");
+#else
         assert(ex == "-USD 0.01");
+#endif
     }
     {   // positive, showbase
         long double v = 123456789;
@@ -211,7 +254,11 @@ 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, iter.base());
+#if defined(_WIN32)
+        assert(ex == "USD1,234,567.89");
+#else
         assert(ex == "USD 1,234,567.89");
+#endif
     }
     {   // negative, showbase
         long double v = -123456789;
@@ -219,7 +266,11 @@ 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, iter.base());
+#if defined(_WIN32)
+        assert(ex == "(USD1,234,567.89)");
+#else
         assert(ex == "-USD 1,234,567.89");
+#endif
     }
     {   // negative, showbase, left
         long double v = -123456789;
@@ -229,7 +280,11 @@ 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, iter.base());
+#if defined(_WIN32)
+        assert(ex == "(USD1,234,567.89)   ");
+#else
         assert(ex == "-USD 1,234,567.89   ");
+#endif
         assert(ios.width() == 0);
     }
     {   // negative, showbase, internal
@@ -240,7 +295,11 @@ 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, iter.base());
+#if defined(_WIN32)
+        assert(ex == "(USD   1,234,567.89)");
+#else
         assert(ex == "-USD    1,234,567.89");
+#endif
         assert(ios.width() == 0);
     }
     {   // negative, showbase, right
@@ -251,7 +310,11 @@ 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, iter.base());
+#if defined(_WIN32)
+        assert(ex == "   (USD1,234,567.89)");
+#else
         assert(ex == "   -USD 1,234,567.89");
+#endif
         assert(ios.width() == 0);
     }
 }
@@ -273,7 +336,11 @@ 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, iter.base());
+#if defined(_WIN32)
+        assert(ex == L"(0.01)");
+#else
         assert(ex == L"-0.01");
+#endif
     }
     {   // positive
         long double v = 123456789;
@@ -287,7 +354,11 @@ 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, iter.base());
+#if defined(_WIN32)
+        assert(ex == L"(1,234,567.89)");
+#else
         assert(ex == L"-1,234,567.89");
+#endif
     }
     {   // zero, showbase
         long double v = 0;
@@ -303,7 +374,11 @@ 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, iter.base());
+#if defined(_WIN32)
+        assert(ex == L"($0.01)");
+#else
         assert(ex == L"-$0.01");
+#endif
     }
     {   // positive, showbase
         long double v = 123456789;
@@ -319,7 +394,11 @@ 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, iter.base());
+#if defined(_WIN32)
+        assert(ex == L"($1,234,567.89)");
+#else
         assert(ex == L"-$1,234,567.89");
+#endif
     }
     {   // negative, showbase, left
         long double v = -123456789;
@@ -329,7 +408,11 @@ 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, iter.base());
+#if defined(_WIN32)
+        assert(ex == L"($1,234,567.89)     ");
+#else
         assert(ex == L"-$1,234,567.89      ");
+#endif
         assert(ios.width() == 0);
     }
     {   // negative, showbase, internal
@@ -340,7 +423,11 @@ 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, iter.base());
+#if defined(_WIN32)
+        assert(ex == L"($     1,234,567.89)");
+#else
         assert(ex == L"-$      1,234,567.89");
+#endif
         assert(ios.width() == 0);
     }
     {   // negative, showbase, right
@@ -351,7 +438,11 @@ 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, iter.base());
+#if defined(_WIN32)
+        assert(ex == L"     ($1,234,567.89)");
+#else
         assert(ex == L"      -$1,234,567.89");
+#endif
         assert(ios.width() == 0);
     }
 
@@ -370,7 +461,11 @@ 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, iter.base());
+#if defined(_WIN32)
+        assert(ex == L"(0.01)");
+#else
         assert(ex == L"-0.01");
+#endif
     }
     {   // positive
         long double v = 123456789;
@@ -384,7 +479,11 @@ 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, iter.base());
+#if defined(_WIN32)
+        assert(ex == L"(1,234,567.89)");
+#else
         assert(ex == L"-1,234,567.89");
+#endif
     }
     {   // zero, showbase
         long double v = 0;
@@ -392,7 +491,11 @@ 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, iter.base());
+#if defined(_WIN32)
+        assert(ex == L"USD0.00");
+#else
         assert(ex == L"USD 0.00");
+#endif
     }
     {   // negative one, showbase
         long double v = -1;
@@ -400,7 +503,11 @@ 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, iter.base());
+#if defined(_WIN32)
+        assert(ex == L"(USD0.01)");
+#else
         assert(ex == L"-USD 0.01");
+#endif
     }
     {   // positive, showbase
         long double v = 123456789;
@@ -408,7 +515,11 @@ 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, iter.base());
+#if defined(_WIN32)
+        assert(ex == L"USD1,234,567.89");
+#else
         assert(ex == L"USD 1,234,567.89");
+#endif
     }
     {   // negative, showbase
         long double v = -123456789;
@@ -416,7 +527,11 @@ 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, iter.base());
+#if defined(_WIN32)
+        assert(ex == L"(USD1,234,567.89)");
+#else
         assert(ex == L"-USD 1,234,567.89");
+#endif
     }
     {   // negative, showbase, left
         long double v = -123456789;
@@ -426,7 +541,11 @@ 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, iter.base());
+#if defined(_WIN32)
+        assert(ex == L"(USD1,234,567.89)   ");
+#else
         assert(ex == L"-USD 1,234,567.89   ");
+#endif
         assert(ios.width() == 0);
     }
     {   // negative, showbase, internal
@@ -437,7 +556,11 @@ 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, iter.base());
+#if defined(_WIN32)
+        assert(ex == L"(USD   1,234,567.89)");
+#else
         assert(ex == L"-USD    1,234,567.89");
+#endif
         assert(ios.width() == 0);
     }
     {   // negative, showbase, right
@@ -448,7 +571,11 @@ 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, iter.base());
+#if defined(_WIN32)
+        assert(ex == L"   (USD1,234,567.89)");
+#else
         assert(ex == L"   -USD 1,234,567.89");
+#endif
         assert(ios.width() == 0);
     }
 }

diff  --git a/libcxx/test/std/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_string_en_US.pass.cpp b/libcxx/test/std/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_string_en_US.pass.cpp
index 2917166138fe0..5790a68f86500 100644
--- a/libcxx/test/std/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_string_en_US.pass.cpp
+++ b/libcxx/test/std/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_string_en_US.pass.cpp
@@ -15,8 +15,6 @@
 
 // REQUIRES: locale.en_US.UTF-8
 
-// XFAIL: LIBCXX-WINDOWS-FIXME
-
 #include <locale>
 #include <ios>
 #include <streambuf>
@@ -77,7 +75,11 @@ 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, iter.base());
+#ifdef _WIN32
+        assert(ex == "(0.01)");
+#else
         assert(ex == "-0.01");
+#endif
     }
     {   // positive
         std::string v = "123456789";
@@ -91,7 +93,11 @@ 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, iter.base());
+#ifdef _WIN32
+        assert(ex == "(1,234,567.89)");
+#else
         assert(ex == "-1,234,567.89");
+#endif
     }
     {   // zero, showbase
         std::string v = "0";
@@ -107,7 +113,11 @@ 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, iter.base());
+#ifdef _WIN32
+        assert(ex == "($0.01)");
+#else
         assert(ex == "-$0.01");
+#endif
     }
     {   // positive, showbase
         std::string v = "123456789";
@@ -123,7 +133,11 @@ 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, iter.base());
+#ifdef _WIN32
+        assert(ex == "($1,234,567.89)");
+#else
         assert(ex == "-$1,234,567.89");
+#endif
     }
     {   // negative, showbase, left
         std::string v = "-123456789";
@@ -133,7 +147,11 @@ 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, iter.base());
+#ifdef _WIN32
+        assert(ex == "($1,234,567.89)     ");
+#else
         assert(ex == "-$1,234,567.89      ");
+#endif
         assert(ios.width() == 0);
     }
     {   // negative, showbase, internal
@@ -144,7 +162,11 @@ 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, iter.base());
+#ifdef _WIN32
+        assert(ex == "($     1,234,567.89)");
+#else
         assert(ex == "-$      1,234,567.89");
+#endif
         assert(ios.width() == 0);
     }
     {   // negative, showbase, right
@@ -155,7 +177,11 @@ 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, iter.base());
+#ifdef _WIN32
+        assert(ex == "     ($1,234,567.89)");
+#else
         assert(ex == "      -$1,234,567.89");
+#endif
         assert(ios.width() == 0);
     }
 
@@ -174,7 +200,11 @@ 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, iter.base());
+#ifdef _WIN32
+        assert(ex == "(0.01)");
+#else
         assert(ex == "-0.01");
+#endif
     }
     {   // positive
         std::string v = "123456789";
@@ -188,7 +218,11 @@ 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, iter.base());
+#ifdef _WIN32
+        assert(ex == "(1,234,567.89)");
+#else
         assert(ex == "-1,234,567.89");
+#endif
     }
     {   // zero, showbase
         std::string v = "0";
@@ -196,7 +230,11 @@ 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, iter.base());
+#ifdef _WIN32
+        assert(ex == "USD0.00");
+#else
         assert(ex == "USD 0.00");
+#endif
     }
     {   // negative one, showbase
         std::string v = "-1";
@@ -204,7 +242,11 @@ 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, iter.base());
+#ifdef _WIN32
+        assert(ex == "(USD0.01)");
+#else
         assert(ex == "-USD 0.01");
+#endif
     }
     {   // positive, showbase
         std::string v = "123456789";
@@ -212,7 +254,11 @@ 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, iter.base());
+#ifdef _WIN32
+        assert(ex == "USD1,234,567.89");
+#else
         assert(ex == "USD 1,234,567.89");
+#endif
     }
     {   // negative, showbase
         std::string v = "-123456789";
@@ -220,7 +266,11 @@ 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, iter.base());
+#ifdef _WIN32
+        assert(ex == "(USD1,234,567.89)");
+#else
         assert(ex == "-USD 1,234,567.89");
+#endif
     }
     {   // negative, showbase, left
         std::string v = "-123456789";
@@ -230,7 +280,11 @@ 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, iter.base());
+#ifdef _WIN32
+        assert(ex == "(USD1,234,567.89)   ");
+#else
         assert(ex == "-USD 1,234,567.89   ");
+#endif
         assert(ios.width() == 0);
     }
     {   // negative, showbase, internal
@@ -241,7 +295,11 @@ 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, iter.base());
+#ifdef _WIN32
+        assert(ex == "(USD   1,234,567.89)");
+#else
         assert(ex == "-USD    1,234,567.89");
+#endif
         assert(ios.width() == 0);
     }
     {   // negative, showbase, right
@@ -252,7 +310,11 @@ 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, iter.base());
+#ifdef _WIN32
+        assert(ex == "   (USD1,234,567.89)");
+#else
         assert(ex == "   -USD 1,234,567.89");
+#endif
         assert(ios.width() == 0);
     }
 }
@@ -274,7 +336,11 @@ 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, iter.base());
+#ifdef _WIN32
+        assert(ex == L"(0.01)");
+#else
         assert(ex == L"-0.01");
+#endif
     }
     {   // positive
         std::wstring v = L"123456789";
@@ -288,7 +354,11 @@ 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, iter.base());
+#ifdef _WIN32
+        assert(ex == L"(1,234,567.89)");
+#else
         assert(ex == L"-1,234,567.89");
+#endif
     }
     {   // zero, showbase
         std::wstring v = L"0";
@@ -304,7 +374,11 @@ 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, iter.base());
+#ifdef _WIN32
+        assert(ex == L"($0.01)");
+#else
         assert(ex == L"-$0.01");
+#endif
     }
     {   // positive, showbase
         std::wstring v = L"123456789";
@@ -320,7 +394,11 @@ 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, iter.base());
+#ifdef _WIN32
+        assert(ex == L"($1,234,567.89)");
+#else
         assert(ex == L"-$1,234,567.89");
+#endif
     }
     {   // negative, showbase, left
         std::wstring v = L"-123456789";
@@ -330,7 +408,11 @@ 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, iter.base());
+#ifdef _WIN32
+        assert(ex == L"($1,234,567.89)     ");
+#else
         assert(ex == L"-$1,234,567.89      ");
+#endif
         assert(ios.width() == 0);
     }
     {   // negative, showbase, internal
@@ -341,7 +423,11 @@ 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, iter.base());
+#ifdef _WIN32
+        assert(ex == L"($     1,234,567.89)");
+#else
         assert(ex == L"-$      1,234,567.89");
+#endif
         assert(ios.width() == 0);
     }
     {   // negative, showbase, right
@@ -352,7 +438,11 @@ 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, iter.base());
+#ifdef _WIN32
+        assert(ex == L"     ($1,234,567.89)");
+#else
         assert(ex == L"      -$1,234,567.89");
+#endif
         assert(ios.width() == 0);
     }
 
@@ -371,7 +461,11 @@ 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, iter.base());
+#ifdef _WIN32
+        assert(ex == L"(0.01)");
+#else
         assert(ex == L"-0.01");
+#endif
     }
     {   // positive
         std::wstring v = L"123456789";
@@ -385,7 +479,11 @@ 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, iter.base());
+#ifdef _WIN32
+        assert(ex == L"(1,234,567.89)");
+#else
         assert(ex == L"-1,234,567.89");
+#endif
     }
     {   // zero, showbase
         std::wstring v = L"0";
@@ -393,7 +491,11 @@ 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, iter.base());
+#ifdef _WIN32
+        assert(ex == L"USD0.00");
+#else
         assert(ex == L"USD 0.00");
+#endif
     }
     {   // negative one, showbase
         std::wstring v = L"-1";
@@ -401,7 +503,11 @@ 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, iter.base());
+#ifdef _WIN32
+        assert(ex == L"(USD0.01)");
+#else
         assert(ex == L"-USD 0.01");
+#endif
     }
     {   // positive, showbase
         std::wstring v = L"123456789";
@@ -409,7 +515,11 @@ 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, iter.base());
+#ifdef _WIN32
+        assert(ex == L"USD1,234,567.89");
+#else
         assert(ex == L"USD 1,234,567.89");
+#endif
     }
     {   // negative, showbase
         std::wstring v = L"-123456789";
@@ -417,7 +527,11 @@ 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, iter.base());
+#ifdef _WIN32
+        assert(ex == L"(USD1,234,567.89)");
+#else
         assert(ex == L"-USD 1,234,567.89");
+#endif
     }
     {   // negative, showbase, left
         std::wstring v = L"-123456789";
@@ -427,7 +541,11 @@ 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, iter.base());
+#ifdef _WIN32
+        assert(ex == L"(USD1,234,567.89)   ");
+#else
         assert(ex == L"-USD 1,234,567.89   ");
+#endif
         assert(ios.width() == 0);
     }
     {   // negative, showbase, internal
@@ -438,7 +556,11 @@ 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, iter.base());
+#ifdef _WIN32
+        assert(ex == L"(USD   1,234,567.89)");
+#else
         assert(ex == L"-USD    1,234,567.89");
+#endif
         assert(ios.width() == 0);
     }
     {   // negative, showbase, right
@@ -449,7 +571,11 @@ 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, iter.base());
+#ifdef _WIN32
+        assert(ex == L"   (USD1,234,567.89)");
+#else
         assert(ex == L"   -USD 1,234,567.89");
+#endif
         assert(ios.width() == 0);
     }
 }


        


More information about the libcxx-commits mailing list