Hi mclow.lists, danalbert,
This gets test/localization/locale.categories/category.monetary tests passing
on linux.
http://reviews.llvm.org/D4998
Files:
test/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_zh_CN.pass.cpp
test/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_zh_CN.pass.cpp
test/localization/locale.categories/category.monetary/locale.moneypunct.byname/thousands_sep.pass.cpp
Index: test/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_zh_CN.pass.cpp
===================================================================
--- test/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_zh_CN.pass.cpp
+++ test/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_zh_CN.pass.cpp
@@ -16,6 +16,9 @@
// iter_type get(iter_type b, iter_type e, bool intl, ios_base& iob,
// ios_base::iostate& err, long double& v) const;
+// NOTE: GLIBC locale data specifies that the negative sign goes before
+// the currency name. However if a currency symbol is used the negative goes after.
+
#include <locale>
#include <ios>
#include <streambuf>
@@ -305,7 +308,11 @@
noshowbase(ios);
}
{ // negative one, showbase
+# if !defined(__GLIBC__)
std::string v = "CNY -0.01";
+# else
+ std::string v = "-CNY 0.01";
+# endif
typedef input_iterator<const char*> I;
long double ex;
std::ios_base::iostate err = std::ios_base::goodbit;
@@ -316,7 +323,11 @@
assert(ex == -1);
}
{ // negative one, showbase
+# if !defined(__GLIBC__)
std::string v = "CNY -0.01";
+# else
+ std::string v = "-CNY 0.01";
+# endif
showbase(ios);
typedef input_iterator<const char*> I;
long double ex;
@@ -353,7 +364,11 @@
noshowbase(ios);
}
{ // negative, showbase
+# if !defined(__GLIBC__)
std::string v = "CNY -1,234,567.89";
+# else
+ std::string v = "-CNY 1,234,567.89";
+# endif
showbase(ios);
typedef input_iterator<const char*> I;
long double ex;
@@ -637,7 +652,11 @@
noshowbase(ios);
}
{ // negative one, showbase
+# if !defined(__GLIBC__)
std::wstring v = L"CNY -0.01";
+# else
+ std::wstring v = L"-CNY 0.01";
+# endif
typedef input_iterator<const wchar_t*> I;
long double ex;
std::ios_base::iostate err = std::ios_base::goodbit;
@@ -648,7 +667,11 @@
assert(ex == -1);
}
{ // negative one, showbase
+# if !defined(__GLIBC__)
std::wstring v = L"CNY -0.01";
+# else
+ std::wstring v = L"-CNY 0.01";
+# endif
showbase(ios);
typedef input_iterator<const wchar_t*> I;
long double ex;
@@ -685,7 +708,11 @@
noshowbase(ios);
}
{ // negative, showbase
+# if !defined(__GLIBC__)
std::wstring v = L"CNY -1,234,567.89";
+# else
+ std::wstring v = L"-CNY 1,234,567.89";
+# endif
showbase(ios);
typedef input_iterator<const wchar_t*> I;
long double ex;
Index: test/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_zh_CN.pass.cpp
===================================================================
--- test/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_zh_CN.pass.cpp
+++ test/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_zh_CN.pass.cpp
@@ -16,6 +16,9 @@
// iter_type put(iter_type s, bool intl, ios_base& f, char_type fill,
// long double units) const;
+// NOTE: GLIBC locale data specifies that the negative sign goes before
+// the currency name. However if a currency symbol is used the negative goes after.
+
#include <locale>
#include <ios>
#include <streambuf>
@@ -215,7 +218,11 @@
output_iterator<char*> iter = f.put(output_iterator<char*>(str),
true, ios, '*', v);
std::string ex(str, iter.base());
+# if !defined(__GLIBC__)
assert(ex == "CNY -0.01");
+# else
+ assert(ex == "-CNY 0.01");
+# endif
}
{ // positive, showbase
long double v = 123456789;
@@ -233,7 +240,11 @@
output_iterator<char*> iter = f.put(output_iterator<char*>(str),
true, ios, '*', v);
std::string ex(str, iter.base());
+# if !defined(__GLIBC__)
assert(ex == "CNY -1,234,567.89");
+# else
+ assert(ex == "-CNY 1,234,567.89");
+# endif
}
{ // negative, showbase, left
long double v = -123456789;
@@ -244,7 +255,11 @@
output_iterator<char*> iter = f.put(output_iterator<char*>(str),
true, ios, ' ', v);
std::string ex(str, iter.base());
+# if !defined(__GLIBC__)
assert(ex == "CNY -1,234,567.89 ");
+# else
+ assert(ex == "-CNY 1,234,567.89 ");
+# endif
assert(ios.width() == 0);
}
{ // negative, showbase, internal
@@ -256,7 +271,11 @@
output_iterator<char*> iter = f.put(output_iterator<char*>(str),
true, ios, ' ', v);
std::string ex(str, iter.base());
+# if !defined(__GLIBC__)
assert(ex == "CNY - 1,234,567.89");
+# else
+ assert(ex == "-CNY 1,234,567.89");
+# endif
assert(ios.width() == 0);
}
{ // negative, showbase, right
@@ -268,7 +287,11 @@
output_iterator<char*> iter = f.put(output_iterator<char*>(str),
true, ios, ' ', v);
std::string ex(str, iter.base());
+# if !defined(__GLIBC__)
assert(ex == " CNY -1,234,567.89");
+# else
+ assert(ex == " -CNY 1,234,567.89");
+# endif
assert(ios.width() == 0);
}
}
@@ -433,7 +456,11 @@
output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
true, ios, '*', v);
std::wstring ex(str, iter.base());
+# if !defined(__GLIBC__)
assert(ex == L"CNY -0.01");
+# else
+ assert(ex == L"-CNY 0.01");
+# endif
}
{ // positive, showbase
long double v = 123456789;
@@ -451,7 +478,11 @@
output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
true, ios, '*', v);
std::wstring ex(str, iter.base());
+# if !defined(__GLIBC__)
assert(ex == L"CNY -1,234,567.89");
+# else
+ assert(ex == L"-CNY 1,234,567.89");
+# endif
}
{ // negative, showbase, left
long double v = -123456789;
@@ -462,7 +493,11 @@
output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
true, ios, ' ', v);
std::wstring ex(str, iter.base());
+# if !defined(__GLIBC__)
assert(ex == L"CNY -1,234,567.89 ");
+# else
+ assert(ex == L"-CNY 1,234,567.89 ");
+# endif
assert(ios.width() == 0);
}
{ // negative, showbase, internal
@@ -474,7 +509,11 @@
output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
true, ios, ' ', v);
std::wstring ex(str, iter.base());
+# if !defined(__GLIBC__)
assert(ex == L"CNY - 1,234,567.89");
+# else
+ assert(ex == L"-CNY 1,234,567.89");
+# endif
assert(ios.width() == 0);
}
{ // negative, showbase, right
@@ -486,7 +525,11 @@
output_iterator<wchar_t*> iter = f.put(output_iterator<wchar_t*>(str),
true, ios, ' ', v);
std::wstring ex(str, iter.base());
+# if !defined(__GLIBC__)
assert(ex == L" CNY -1,234,567.89");
+# else
+ assert(ex == L" -CNY 1,234,567.89");
+# endif
assert(ios.width() == 0);
}
}
Index: test/localization/locale.categories/category.monetary/locale.moneypunct.byname/thousands_sep.pass.cpp
===================================================================
--- test/localization/locale.categories/category.monetary/locale.moneypunct.byname/thousands_sep.pass.cpp
+++ test/localization/locale.categories/category.monetary/locale.moneypunct.byname/thousands_sep.pass.cpp
@@ -12,6 +12,12 @@
// REQUIRES: locale.ru_RU.UTF-8
// REQUIRES: locale.zh_CN.UTF-8
+// Failure related to GLIBC's use of U00A0 as mon_thousands_sep
+// and U002E as mon_decimal_point.
+// TODO: U00A0 should be investigated.
+// Possibly related to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=16006
+// XFAIL: linux
+
// <locale>
// class moneypunct_byname<charT, International>
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits