[libcxx-commits] [libcxx] b2d9340 - [libcxx] [test] Fix get_string_en_US, get_long_double_en_US for Windows
Martin Storsjö via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Mar 4 00:19:18 PST 2022
Author: Martin Storsjö
Date: 2022-03-04T10:18:07+02:00
New Revision: b2d93400a96cfe88d0f027e717d51a4f6450a163
URL: https://github.com/llvm/llvm-project/commit/b2d93400a96cfe88d0f027e717d51a4f6450a163
DIFF: https://github.com/llvm/llvm-project/commit/b2d93400a96cfe88d0f027e717d51a4f6450a163.diff
LOG: [libcxx] [test] Fix get_string_en_US, get_long_double_en_US for Windows
In the en_US locale on Windows, negative currency amounts is formatted
as "($0.01)" instead of "-$0.01".
Differential Revision: https://reviews.llvm.org/D120799
Added:
Modified:
libcxx/test/std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_en_US.pass.cpp
libcxx/test/std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_string_en_US.pass.cpp
libcxx/test/support/locale_helpers.h
Removed:
################################################################################
diff --git a/libcxx/test/std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_en_US.pass.cpp b/libcxx/test/std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_en_US.pass.cpp
index 8881aa8813a82..21117da3c2887 100644
--- a/libcxx/test/std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_en_US.pass.cpp
+++ b/libcxx/test/std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_en_US.pass.cpp
@@ -14,7 +14,6 @@
// ios_base::iostate& err, long double& v) const;
// REQUIRES: locale.en_US.UTF-8
-// XFAIL: LIBCXX-WINDOWS-FIXME
#include <locale>
#include <ios>
@@ -23,6 +22,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;
@@ -76,7 +76,7 @@ int main(int, char**)
assert(ex == 0);
}
{ // negative one
- std::string v = "-0.01";
+ std::string v = LocaleHelpers::negate_en_US("0.01");
typedef cpp17_input_iterator<const char*> I;
long double ex;
std::ios_base::iostate err = std::ios_base::goodbit;
@@ -98,7 +98,7 @@ int main(int, char**)
assert(ex == 123456789);
}
{ // negative
- std::string v = "-1,234,567.89";
+ std::string v = LocaleHelpers::negate_en_US("1,234,567.89");
typedef cpp17_input_iterator<const char*> I;
long double ex;
std::ios_base::iostate err = std::ios_base::goodbit;
@@ -109,7 +109,7 @@ int main(int, char**)
assert(ex == -123456789);
}
{ // negative
- std::string v = "-1234567.89";
+ std::string v = LocaleHelpers::negate_en_US("1234567.89");
typedef cpp17_input_iterator<const char*> I;
long double ex;
std::ios_base::iostate err = std::ios_base::goodbit;
@@ -144,7 +144,7 @@ int main(int, char**)
std::noshowbase(ios);
}
{ // negative one, showbase
- std::string v = "-$0.01";
+ std::string v = LocaleHelpers::negate_en_US("$0.01");
typedef cpp17_input_iterator<const char*> I;
long double ex;
std::ios_base::iostate err = std::ios_base::goodbit;
@@ -155,7 +155,7 @@ int main(int, char**)
assert(ex == -1);
}
{ // negative one, showbase
- std::string v = "-$0.01";
+ std::string v = LocaleHelpers::negate_en_US("$0.01");
std::showbase(ios);
typedef cpp17_input_iterator<const char*> I;
long double ex;
@@ -192,7 +192,7 @@ int main(int, char**)
std::noshowbase(ios);
}
{ // negative, showbase
- std::string v = "-$1,234,567.89";
+ std::string v = LocaleHelpers::negate_en_US("$1,234,567.89");
std::showbase(ios);
typedef cpp17_input_iterator<const char*> I;
long double ex;
@@ -205,7 +205,7 @@ int main(int, char**)
std::noshowbase(ios);
}
{ // negative, showbase
- std::string v = "-USD 1,234,567.89";
+ std::string v = LocaleHelpers::negate_en_US("USD 1,234,567.89");
std::showbase(ios);
typedef cpp17_input_iterator<const char*> I;
long double ex;
@@ -217,7 +217,7 @@ int main(int, char**)
std::noshowbase(ios);
}
{ // negative, showbase
- std::string v = "-USD 1,234,567.89";
+ std::string v = LocaleHelpers::negate_en_US("USD 1,234,567.89");
typedef cpp17_input_iterator<const char*> I;
long double ex;
std::ios_base::iostate err = std::ios_base::goodbit;
@@ -242,7 +242,7 @@ int main(int, char**)
assert(ex == 0);
}
{ // negative one
- std::string v = "-0.01";
+ std::string v = LocaleHelpers::negate_en_US("0.01");
typedef cpp17_input_iterator<const char*> I;
long double ex;
std::ios_base::iostate err = std::ios_base::goodbit;
@@ -264,7 +264,7 @@ int main(int, char**)
assert(ex == 123456789);
}
{ // negative
- std::string v = "-1,234,567.89";
+ std::string v = LocaleHelpers::negate_en_US("1,234,567.89");
typedef cpp17_input_iterator<const char*> I;
long double ex;
std::ios_base::iostate err = std::ios_base::goodbit;
@@ -275,7 +275,7 @@ int main(int, char**)
assert(ex == -123456789);
}
{ // negative
- std::string v = "-1234567.89";
+ std::string v = LocaleHelpers::negate_en_US("1234567.89");
typedef cpp17_input_iterator<const char*> I;
long double ex;
std::ios_base::iostate err = std::ios_base::goodbit;
@@ -310,7 +310,7 @@ int main(int, char**)
std::noshowbase(ios);
}
{ // negative one, showbase
- std::string v = "-USD 0.01";
+ std::string v = LocaleHelpers::negate_en_US("USD 0.01");
typedef cpp17_input_iterator<const char*> I;
long double ex;
std::ios_base::iostate err = std::ios_base::goodbit;
@@ -321,7 +321,7 @@ int main(int, char**)
assert(ex == -1);
}
{ // negative one, showbase
- std::string v = "-USD 0.01";
+ std::string v = LocaleHelpers::negate_en_US("USD 0.01");
std::showbase(ios);
typedef cpp17_input_iterator<const char*> I;
long double ex;
@@ -358,7 +358,7 @@ int main(int, char**)
std::noshowbase(ios);
}
{ // negative, showbase
- std::string v = "-USD 1,234,567.89";
+ std::string v = LocaleHelpers::negate_en_US("USD 1,234,567.89");
std::showbase(ios);
typedef cpp17_input_iterator<const char*> I;
long double ex;
@@ -371,7 +371,7 @@ int main(int, char**)
std::noshowbase(ios);
}
{ // negative, showbase
- std::string v = "-$1,234,567.89";
+ std::string v = LocaleHelpers::negate_en_US("$1,234,567.89");
std::showbase(ios);
typedef cpp17_input_iterator<const char*> I;
long double ex;
@@ -383,7 +383,7 @@ int main(int, char**)
std::noshowbase(ios);
}
{ // negative, showbase
- std::string v = "-$1,234,567.89";
+ std::string v = LocaleHelpers::negate_en_US("$1,234,567.89");
typedef cpp17_input_iterator<const char*> I;
long double ex;
std::ios_base::iostate err = std::ios_base::goodbit;
@@ -409,7 +409,7 @@ int main(int, char**)
assert(ex == 0);
}
{ // negative one
- std::wstring v = L"-0.01";
+ std::wstring v = LocaleHelpers::negate_en_US(L"0.01");
typedef cpp17_input_iterator<const wchar_t*> I;
long double ex;
std::ios_base::iostate err = std::ios_base::goodbit;
@@ -431,7 +431,7 @@ int main(int, char**)
assert(ex == 123456789);
}
{ // negative
- std::wstring v = L"-1,234,567.89";
+ std::wstring v = LocaleHelpers::negate_en_US(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;
@@ -442,7 +442,7 @@ int main(int, char**)
assert(ex == -123456789);
}
{ // negative
- std::wstring v = L"-1234567.89";
+ std::wstring v = LocaleHelpers::negate_en_US(L"1234567.89");
typedef cpp17_input_iterator<const wchar_t*> I;
long double ex;
std::ios_base::iostate err = std::ios_base::goodbit;
@@ -477,7 +477,7 @@ int main(int, char**)
std::noshowbase(ios);
}
{ // negative one, showbase
- std::wstring v = L"-$0.01";
+ std::wstring v = LocaleHelpers::negate_en_US(L"$0.01");
typedef cpp17_input_iterator<const wchar_t*> I;
long double ex;
std::ios_base::iostate err = std::ios_base::goodbit;
@@ -488,7 +488,7 @@ int main(int, char**)
assert(ex == -1);
}
{ // negative one, showbase
- std::wstring v = L"-$0.01";
+ std::wstring v = LocaleHelpers::negate_en_US(L"$0.01");
std::showbase(ios);
typedef cpp17_input_iterator<const wchar_t*> I;
long double ex;
@@ -525,7 +525,7 @@ int main(int, char**)
std::noshowbase(ios);
}
{ // negative, showbase
- std::wstring v = L"-$1,234,567.89";
+ std::wstring v = LocaleHelpers::negate_en_US(L"$1,234,567.89");
std::showbase(ios);
typedef cpp17_input_iterator<const wchar_t*> I;
long double ex;
@@ -538,7 +538,7 @@ int main(int, char**)
std::noshowbase(ios);
}
{ // negative, showbase
- std::wstring v = L"-USD 1,234,567.89";
+ std::wstring v = LocaleHelpers::negate_en_US(L"USD 1,234,567.89");
std::showbase(ios);
typedef cpp17_input_iterator<const wchar_t*> I;
long double ex;
@@ -550,7 +550,7 @@ int main(int, char**)
std::noshowbase(ios);
}
{ // negative, showbase
- std::wstring v = L"-USD 1,234,567.89";
+ std::wstring v = LocaleHelpers::negate_en_US(L"USD 1,234,567.89");
typedef cpp17_input_iterator<const wchar_t*> I;
long double ex;
std::ios_base::iostate err = std::ios_base::goodbit;
@@ -575,7 +575,7 @@ int main(int, char**)
assert(ex == 0);
}
{ // negative one
- std::wstring v = L"-0.01";
+ std::wstring v = LocaleHelpers::negate_en_US(L"0.01");
typedef cpp17_input_iterator<const wchar_t*> I;
long double ex;
std::ios_base::iostate err = std::ios_base::goodbit;
@@ -597,7 +597,7 @@ int main(int, char**)
assert(ex == 123456789);
}
{ // negative
- std::wstring v = L"-1,234,567.89";
+ std::wstring v = LocaleHelpers::negate_en_US(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;
@@ -608,7 +608,7 @@ int main(int, char**)
assert(ex == -123456789);
}
{ // negative
- std::wstring v = L"-1234567.89";
+ std::wstring v = LocaleHelpers::negate_en_US(L"1234567.89");
typedef cpp17_input_iterator<const wchar_t*> I;
long double ex;
std::ios_base::iostate err = std::ios_base::goodbit;
@@ -643,7 +643,7 @@ int main(int, char**)
std::noshowbase(ios);
}
{ // negative one, showbase
- std::wstring v = L"-USD 0.01";
+ std::wstring v = LocaleHelpers::negate_en_US(L"USD 0.01");
typedef cpp17_input_iterator<const wchar_t*> I;
long double ex;
std::ios_base::iostate err = std::ios_base::goodbit;
@@ -654,7 +654,7 @@ int main(int, char**)
assert(ex == -1);
}
{ // negative one, showbase
- std::wstring v = L"-USD 0.01";
+ std::wstring v = LocaleHelpers::negate_en_US(L"USD 0.01");
std::showbase(ios);
typedef cpp17_input_iterator<const wchar_t*> I;
long double ex;
@@ -691,7 +691,7 @@ int main(int, char**)
std::noshowbase(ios);
}
{ // negative, showbase
- std::wstring v = L"-USD 1,234,567.89";
+ std::wstring v = LocaleHelpers::negate_en_US(L"USD 1,234,567.89");
std::showbase(ios);
typedef cpp17_input_iterator<const wchar_t*> I;
long double ex;
@@ -704,7 +704,7 @@ int main(int, char**)
std::noshowbase(ios);
}
{ // negative, showbase
- std::wstring v = L"-$1,234,567.89";
+ std::wstring v = LocaleHelpers::negate_en_US(L"$1,234,567.89");
std::showbase(ios);
typedef cpp17_input_iterator<const wchar_t*> I;
long double ex;
@@ -716,7 +716,7 @@ int main(int, char**)
std::noshowbase(ios);
}
{ // negative, showbase
- std::wstring v = L"-$1,234,567.89";
+ std::wstring v = LocaleHelpers::negate_en_US(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;
diff --git a/libcxx/test/std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_string_en_US.pass.cpp b/libcxx/test/std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_string_en_US.pass.cpp
index ecb88801ca473..80e84a425ee2a 100644
--- a/libcxx/test/std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_string_en_US.pass.cpp
+++ b/libcxx/test/std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_string_en_US.pass.cpp
@@ -14,7 +14,6 @@
// ios_base::iostate& err, string_type& v) const;
// REQUIRES: locale.en_US.UTF-8
-// XFAIL: LIBCXX-WINDOWS-FIXME
#include <locale>
#include <ios>
@@ -23,6 +22,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;
@@ -76,7 +76,7 @@ int main(int, char**)
assert(ex == "0");
}
{ // negative one
- std::string v = "-0.01";
+ std::string v = LocaleHelpers::negate_en_US("0.01");
typedef cpp17_input_iterator<const char*> I;
std::string ex;
std::ios_base::iostate err = std::ios_base::goodbit;
@@ -98,7 +98,7 @@ int main(int, char**)
assert(ex == "123456789");
}
{ // negative
- std::string v = "-1,234,567.89";
+ std::string v = LocaleHelpers::negate_en_US("1,234,567.89");
typedef cpp17_input_iterator<const char*> I;
std::string ex;
std::ios_base::iostate err = std::ios_base::goodbit;
@@ -109,7 +109,7 @@ int main(int, char**)
assert(ex == "-123456789");
}
{ // negative
- std::string v = "-1234567.89";
+ std::string v = LocaleHelpers::negate_en_US("1234567.89");
typedef cpp17_input_iterator<const char*> I;
std::string ex;
std::ios_base::iostate err = std::ios_base::goodbit;
@@ -144,7 +144,7 @@ int main(int, char**)
std::noshowbase(ios);
}
{ // negative one, showbase
- std::string v = "-$0.01";
+ std::string v = LocaleHelpers::negate_en_US("$0.01");
typedef cpp17_input_iterator<const char*> I;
std::string ex;
std::ios_base::iostate err = std::ios_base::goodbit;
@@ -155,7 +155,7 @@ int main(int, char**)
assert(ex == "-1");
}
{ // negative one, showbase
- std::string v = "-$0.01";
+ std::string v = LocaleHelpers::negate_en_US("$0.01");
std::showbase(ios);
typedef cpp17_input_iterator<const char*> I;
std::string ex;
@@ -192,7 +192,7 @@ int main(int, char**)
std::noshowbase(ios);
}
{ // negative, showbase
- std::string v = "-$1,234,567.89";
+ std::string v = LocaleHelpers::negate_en_US("$1,234,567.89");
std::showbase(ios);
typedef cpp17_input_iterator<const char*> I;
std::string ex;
@@ -205,7 +205,7 @@ int main(int, char**)
std::noshowbase(ios);
}
{ // negative, showbase
- std::string v = "-USD 1,234,567.89";
+ std::string v = LocaleHelpers::negate_en_US("USD 1,234,567.89");
std::showbase(ios);
typedef cpp17_input_iterator<const char*> I;
std::string ex;
@@ -218,7 +218,7 @@ int main(int, char**)
std::noshowbase(ios);
}
{ // negative, showbase
- std::string v = "-USD 1,234,567.89";
+ std::string v = LocaleHelpers::negate_en_US("USD 1,234,567.89");
typedef cpp17_input_iterator<const char*> I;
std::string ex;
std::ios_base::iostate err = std::ios_base::goodbit;
@@ -244,7 +244,7 @@ int main(int, char**)
assert(ex == "0");
}
{ // negative one
- std::string v = "-0.01";
+ std::string v = LocaleHelpers::negate_en_US("0.01");
typedef cpp17_input_iterator<const char*> I;
std::string ex;
std::ios_base::iostate err = std::ios_base::goodbit;
@@ -266,7 +266,7 @@ int main(int, char**)
assert(ex == "123456789");
}
{ // negative
- std::string v = "-1,234,567.89";
+ std::string v = LocaleHelpers::negate_en_US("1,234,567.89");
typedef cpp17_input_iterator<const char*> I;
std::string ex;
std::ios_base::iostate err = std::ios_base::goodbit;
@@ -277,7 +277,7 @@ int main(int, char**)
assert(ex == "-123456789");
}
{ // negative
- std::string v = "-1234567.89";
+ std::string v = LocaleHelpers::negate_en_US("1234567.89");
typedef cpp17_input_iterator<const char*> I;
std::string ex;
std::ios_base::iostate err = std::ios_base::goodbit;
@@ -312,7 +312,7 @@ int main(int, char**)
std::noshowbase(ios);
}
{ // negative one, showbase
- std::string v = "-USD 0.01";
+ std::string v = LocaleHelpers::negate_en_US("USD 0.01");
typedef cpp17_input_iterator<const char*> I;
std::string ex;
std::ios_base::iostate err = std::ios_base::goodbit;
@@ -323,7 +323,7 @@ int main(int, char**)
assert(ex == "-1");
}
{ // negative one, showbase
- std::string v = "-USD 0.01";
+ std::string v = LocaleHelpers::negate_en_US("USD 0.01");
std::showbase(ios);
typedef cpp17_input_iterator<const char*> I;
std::string ex;
@@ -360,7 +360,7 @@ int main(int, char**)
std::noshowbase(ios);
}
{ // negative, showbase
- std::string v = "-USD 1,234,567.89";
+ std::string v = LocaleHelpers::negate_en_US("USD 1,234,567.89");
std::showbase(ios);
typedef cpp17_input_iterator<const char*> I;
std::string ex;
@@ -373,7 +373,7 @@ int main(int, char**)
std::noshowbase(ios);
}
{ // negative, showbase
- std::string v = "-$1,234,567.89";
+ std::string v = LocaleHelpers::negate_en_US("$1,234,567.89");
std::showbase(ios);
typedef cpp17_input_iterator<const char*> I;
std::string ex;
@@ -386,7 +386,7 @@ int main(int, char**)
std::noshowbase(ios);
}
{ // negative, showbase
- std::string v = "-$1,234,567.89";
+ std::string v = LocaleHelpers::negate_en_US("$1,234,567.89");
typedef cpp17_input_iterator<const char*> I;
std::string ex;
std::ios_base::iostate err = std::ios_base::goodbit;
@@ -413,7 +413,7 @@ int main(int, char**)
assert(ex == L"0");
}
{ // negative one
- std::wstring v = L"-0.01";
+ std::wstring v = LocaleHelpers::negate_en_US(L"0.01");
typedef cpp17_input_iterator<const wchar_t*> I;
std::wstring ex;
std::ios_base::iostate err = std::ios_base::goodbit;
@@ -435,7 +435,7 @@ int main(int, char**)
assert(ex == L"123456789");
}
{ // negative
- std::wstring v = L"-1,234,567.89";
+ std::wstring v = LocaleHelpers::negate_en_US(L"1,234,567.89");
typedef cpp17_input_iterator<const wchar_t*> I;
std::wstring ex;
std::ios_base::iostate err = std::ios_base::goodbit;
@@ -446,7 +446,7 @@ int main(int, char**)
assert(ex == L"-123456789");
}
{ // negative
- std::wstring v = L"-1234567.89";
+ std::wstring v = LocaleHelpers::negate_en_US(L"1234567.89");
typedef cpp17_input_iterator<const wchar_t*> I;
std::wstring ex;
std::ios_base::iostate err = std::ios_base::goodbit;
@@ -481,7 +481,7 @@ int main(int, char**)
std::noshowbase(ios);
}
{ // negative one, showbase
- std::wstring v = L"-$0.01";
+ std::wstring v = LocaleHelpers::negate_en_US(L"$0.01");
typedef cpp17_input_iterator<const wchar_t*> I;
std::wstring ex;
std::ios_base::iostate err = std::ios_base::goodbit;
@@ -492,7 +492,7 @@ int main(int, char**)
assert(ex == L"-1");
}
{ // negative one, showbase
- std::wstring v = L"-$0.01";
+ std::wstring v = LocaleHelpers::negate_en_US(L"$0.01");
std::showbase(ios);
typedef cpp17_input_iterator<const wchar_t*> I;
std::wstring ex;
@@ -529,7 +529,7 @@ int main(int, char**)
std::noshowbase(ios);
}
{ // negative, showbase
- std::wstring v = L"-$1,234,567.89";
+ std::wstring v = LocaleHelpers::negate_en_US(L"$1,234,567.89");
std::showbase(ios);
typedef cpp17_input_iterator<const wchar_t*> I;
std::wstring ex;
@@ -542,7 +542,7 @@ int main(int, char**)
std::noshowbase(ios);
}
{ // negative, showbase
- std::wstring v = L"-USD 1,234,567.89";
+ std::wstring v = LocaleHelpers::negate_en_US(L"USD 1,234,567.89");
std::showbase(ios);
typedef cpp17_input_iterator<const wchar_t*> I;
std::wstring ex;
@@ -555,7 +555,7 @@ int main(int, char**)
std::noshowbase(ios);
}
{ // negative, showbase
- std::wstring v = L"-USD 1,234,567.89";
+ std::wstring v = LocaleHelpers::negate_en_US(L"USD 1,234,567.89");
typedef cpp17_input_iterator<const wchar_t*> I;
std::wstring ex;
std::ios_base::iostate err = std::ios_base::goodbit;
@@ -581,7 +581,7 @@ int main(int, char**)
assert(ex == L"0");
}
{ // negative one
- std::wstring v = L"-0.01";
+ std::wstring v = LocaleHelpers::negate_en_US(L"0.01");
typedef cpp17_input_iterator<const wchar_t*> I;
std::wstring ex;
std::ios_base::iostate err = std::ios_base::goodbit;
@@ -603,7 +603,7 @@ int main(int, char**)
assert(ex == L"123456789");
}
{ // negative
- std::wstring v = L"-1,234,567.89";
+ std::wstring v = LocaleHelpers::negate_en_US(L"1,234,567.89");
typedef cpp17_input_iterator<const wchar_t*> I;
std::wstring ex;
std::ios_base::iostate err = std::ios_base::goodbit;
@@ -614,7 +614,7 @@ int main(int, char**)
assert(ex == L"-123456789");
}
{ // negative
- std::wstring v = L"-1234567.89";
+ std::wstring v = LocaleHelpers::negate_en_US(L"1234567.89");
typedef cpp17_input_iterator<const wchar_t*> I;
std::wstring ex;
std::ios_base::iostate err = std::ios_base::goodbit;
@@ -649,7 +649,7 @@ int main(int, char**)
std::noshowbase(ios);
}
{ // negative one, showbase
- std::wstring v = L"-USD 0.01";
+ std::wstring v = LocaleHelpers::negate_en_US(L"USD 0.01");
typedef cpp17_input_iterator<const wchar_t*> I;
std::wstring ex;
std::ios_base::iostate err = std::ios_base::goodbit;
@@ -660,7 +660,7 @@ int main(int, char**)
assert(ex == L"-1");
}
{ // negative one, showbase
- std::wstring v = L"-USD 0.01";
+ std::wstring v = LocaleHelpers::negate_en_US(L"USD 0.01");
std::showbase(ios);
typedef cpp17_input_iterator<const wchar_t*> I;
std::wstring ex;
@@ -697,7 +697,7 @@ int main(int, char**)
std::noshowbase(ios);
}
{ // negative, showbase
- std::wstring v = L"-USD 1,234,567.89";
+ std::wstring v = LocaleHelpers::negate_en_US(L"USD 1,234,567.89");
std::showbase(ios);
typedef cpp17_input_iterator<const wchar_t*> I;
std::wstring ex;
@@ -710,7 +710,7 @@ int main(int, char**)
std::noshowbase(ios);
}
{ // negative, showbase
- std::wstring v = L"-$1,234,567.89";
+ std::wstring v = LocaleHelpers::negate_en_US(L"$1,234,567.89");
std::showbase(ios);
typedef cpp17_input_iterator<const wchar_t*> I;
std::wstring ex;
@@ -723,7 +723,7 @@ int main(int, char**)
std::noshowbase(ios);
}
{ // negative, showbase
- std::wstring v = L"-$1,234,567.89";
+ std::wstring v = LocaleHelpers::negate_en_US(L"$1,234,567.89");
typedef cpp17_input_iterator<const wchar_t*> I;
std::wstring ex;
std::ios_base::iostate err = std::ios_base::goodbit;
diff --git a/libcxx/test/support/locale_helpers.h b/libcxx/test/support/locale_helpers.h
index 69df19399b473..782e0e4e1e843 100644
--- a/libcxx/test/support/locale_helpers.h
+++ b/libcxx/test/support/locale_helpers.h
@@ -71,8 +71,24 @@ std::wstring convert_thousands_sep_ru_RU(std::wstring const& in) {
#endif
}
+std::wstring negate_en_US(std::wstring s) {
+#if defined(_WIN32)
+ return L"(" + s + L")";
+#else
+ return L"-" + s;
+#endif
+}
+
#endif // TEST_HAS_NO_WIDE_CHARACTERS
+std::string negate_en_US(std::string s) {
+#if defined(_WIN32)
+ return "(" + s + ")";
+#else
+ return "-" + s;
+#endif
+}
+
MultiStringType currency_symbol_ru_RU() {
#if defined(_CS_GNU_LIBC_VERSION)
if (glibc_version_less_than("2.24"))
More information about the libcxx-commits
mailing list