Implement most of Dan's comments. I've also backed out any changes to ctype
tests. They need more investigation. They are just marked xfail now.
http://reviews.llvm.org/D4861
Files:
test/localization/locale.categories/category.collate/locale.collate.byname/compare.pass.cpp
test/localization/locale.categories/category.ctype/locale.ctype.byname/tolower_1.pass.cpp
test/localization/locale.categories/category.ctype/locale.ctype.byname/tolower_many.pass.cpp
test/localization/locale.categories/category.ctype/locale.ctype.byname/toupper_1.pass.cpp
test/localization/locale.categories/category.ctype/locale.ctype.byname/toupper_many.pass.cpp
test/localization/locale.categories/category.ctype/locale.ctype.byname/widen_1.pass.cpp
test/localization/locale.categories/category.ctype/locale.ctype.byname/widen_many.pass.cpp
test/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_ru_RU.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.put/locale.money.put.members/put_long_double_ru_RU.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/decimal_point.pass.cpp
test/localization/locale.categories/category.monetary/locale.moneypunct.byname/thousands_sep.pass.cpp
test/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_long_double.pass.cpp
test/localization/locale.categories/category.time/locale.time.get.byname/get_date.pass.cpp
test/localization/locale.categories/category.time/locale.time.get.byname/get_date_wide.pass.cpp
test/localization/locale.categories/category.time/locale.time.get.byname/get_one.pass.cpp
test/localization/locale.categories/category.time/locale.time.get.byname/get_one_wide.pass.cpp
test/localization/locale.categories/category.time/locale.time.get.byname/get_weekday.pass.cpp
test/localization/locale.categories/category.time/locale.time.get.byname/get_weekday_wide.pass.cpp
test/localization/locale.categories/category.time/locale.time.put.byname/put1.pass.cpp
test/localization/locale.categories/category.time/locale.time.put/locale.time.put.members/put2.pass.cpp
test/localization/locale.categories/facet.numpunct/locale.numpunct.byname/grouping.pass.cpp
test/localization/locale.categories/facet.numpunct/locale.numpunct.byname/thousands_sep.pass.cpp
Index: test/localization/locale.categories/category.collate/locale.collate.byname/compare.pass.cpp
===================================================================
--- test/localization/locale.categories/category.collate/locale.collate.byname/compare.pass.cpp
+++ test/localization/locale.categories/category.collate/locale.collate.byname/compare.pass.cpp
@@ -28,6 +28,11 @@
int main()
{
+#if !defined(__GLIBC__)
+ int const expect = 1;
+#else
+ int const expect = -1;
+#endif
{
std::locale l(LOCALE_en_US_UTF_8);
{
@@ -35,31 +40,14 @@
std::string s2("aaaaaaA");
std::string s3("BaaaaaA");
assert(f.compare(s2.data(), s2.data() + s2.size(),
- s3.data(), s3.data() + s3.size()) == 1);
- }
- {
- const std::collate<wchar_t>& f = std::use_facet<std::collate<wchar_t> >(l);
- std::wstring s2(L"aaaaaaA");
- std::wstring s3(L"BaaaaaA");
- assert(f.compare(s2.data(), s2.data() + s2.size(),
- s3.data(), s3.data() + s3.size()) == 1);
- }
- }
- {
- std::locale l("");
- {
- const std::collate<char>& f = std::use_facet<std::collate<char> >(l);
- std::string s2("aaaaaaA");
- std::string s3("BaaaaaA");
- assert(f.compare(s2.data(), s2.data() + s2.size(),
- s3.data(), s3.data() + s3.size()) == 1);
+ s3.data(), s3.data() + s3.size()) == expect);
}
{
const std::collate<wchar_t>& f = std::use_facet<std::collate<wchar_t> >(l);
std::wstring s2(L"aaaaaaA");
std::wstring s3(L"BaaaaaA");
assert(f.compare(s2.data(), s2.data() + s2.size(),
- s3.data(), s3.data() + s3.size()) == 1);
+ s3.data(), s3.data() + s3.size()) == expect);
}
}
{
Index: test/localization/locale.categories/category.ctype/locale.ctype.byname/tolower_1.pass.cpp
===================================================================
--- test/localization/locale.categories/category.ctype/locale.ctype.byname/tolower_1.pass.cpp
+++ test/localization/locale.categories/category.ctype/locale.ctype.byname/tolower_1.pass.cpp
@@ -15,6 +15,9 @@
// XFAIL: with_system_lib=x86_64-apple-darwin11
// XFAIL: with_system_lib=x86_64-apple-darwin12
+// Investigation needed for linux failures.
+// XFAIL: linux
+
#include <locale>
#include <cassert>
@@ -35,6 +38,7 @@
assert(f.tolower('.') == '.');
assert(f.tolower('a') == 'a');
assert(f.tolower('1') == '1');
+ //NOTE: fails with GLIBC and on FreeBSD
assert(f.tolower('\xDA') == '\xFA');
assert(f.tolower('\xFA') == '\xFA');
}
Index: test/localization/locale.categories/category.ctype/locale.ctype.byname/tolower_many.pass.cpp
===================================================================
--- test/localization/locale.categories/category.ctype/locale.ctype.byname/tolower_many.pass.cpp
+++ test/localization/locale.categories/category.ctype/locale.ctype.byname/tolower_many.pass.cpp
@@ -15,6 +15,8 @@
// XFAIL: with_system_lib=x86_64-apple-darwin11
// XFAIL: with_system_lib=x86_64-apple-darwin12
+// Investigation needed for linux failures.
+// XFAIL: linux
#include <locale>
#include <string>
@@ -32,6 +34,7 @@
std::string in("\xDA A\x07.a1");
assert(f.tolower(&in[0], in.data() + in.size()) == in.data() + in.size());
+ // NOTE: First case fails on linux and FreeBSD
assert(in[0] == '\xFA');
assert(in[1] == ' ');
assert(in[2] == 'a');
Index: test/localization/locale.categories/category.ctype/locale.ctype.byname/toupper_1.pass.cpp
===================================================================
--- test/localization/locale.categories/category.ctype/locale.ctype.byname/toupper_1.pass.cpp
+++ test/localization/locale.categories/category.ctype/locale.ctype.byname/toupper_1.pass.cpp
@@ -16,6 +16,9 @@
// XFAIL: with_system_lib=x86_64-apple-darwin11
// XFAIL: with_system_lib=x86_64-apple-darwin12
+// Investigation needed for linux failures.
+// XFAIL: linux
+
#include <locale>
#include <cassert>
@@ -36,6 +39,7 @@
assert(f.toupper('a') == 'A');
assert(f.toupper('1') == '1');
assert(f.toupper('\xDA') == '\xDA');
+ // NOTE: This fails on linux
assert(f.toupper('\xFA') == '\xDA');
}
}
Index: test/localization/locale.categories/category.ctype/locale.ctype.byname/toupper_many.pass.cpp
===================================================================
--- test/localization/locale.categories/category.ctype/locale.ctype.byname/toupper_many.pass.cpp
+++ test/localization/locale.categories/category.ctype/locale.ctype.byname/toupper_many.pass.cpp
@@ -16,6 +16,9 @@
// XFAIL: with_system_lib=x86_64-apple-darwin11
// XFAIL: with_system_lib=x86_64-apple-darwin12
+// Investigation needed for linux failures.
+// XFAIL: linux
+
#include <locale>
#include <string>
#include <cassert>
@@ -32,6 +35,7 @@
std::string in("\xFA A\x07.a1");
assert(f.toupper(&in[0], in.data() + in.size()) == in.data() + in.size());
+ // NOTE: first case fails on linux.
assert(in[0] == '\xDA');
assert(in[1] == ' ');
assert(in[2] == 'A');
Index: test/localization/locale.categories/category.ctype/locale.ctype.byname/widen_1.pass.cpp
===================================================================
--- test/localization/locale.categories/category.ctype/locale.ctype.byname/widen_1.pass.cpp
+++ test/localization/locale.categories/category.ctype/locale.ctype.byname/widen_1.pass.cpp
@@ -15,6 +15,9 @@
// I doubt this test is portable
+// Investigation needed for linux failures.
+// XFAIL: linux
+
#include <locale>
#include <cassert>
#include <limits.h>
@@ -50,6 +53,7 @@
assert(f.widen('.') == L'.');
assert(f.widen('a') == L'a');
assert(f.widen('1') == L'1');
+ // NOTE: This fails on linux
assert(f.widen(char(-5)) == wchar_t(251));
}
}
Index: test/localization/locale.categories/category.ctype/locale.ctype.byname/widen_many.pass.cpp
===================================================================
--- test/localization/locale.categories/category.ctype/locale.ctype.byname/widen_many.pass.cpp
+++ test/localization/locale.categories/category.ctype/locale.ctype.byname/widen_many.pass.cpp
@@ -15,6 +15,9 @@
// I doubt this test is portable
+// Investigation needed for linux failures.
+// XFAIL: linux
+
#include <locale>
#include <string>
#include <vector>
@@ -57,6 +60,7 @@
assert(v[3] == L'.');
assert(v[4] == L'a');
assert(v[5] == L'1');
+ // NOTE: this case fails on linux
assert(v[6] == wchar_t(133));
}
}
Index: test/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_ru_RU.pass.cpp
===================================================================
--- test/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_ru_RU.pass.cpp
+++ test/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_ru_RU.pass.cpp
@@ -9,6 +9,12 @@
//
// XFAIL: apple-darwin
+// 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
+
// REQUIRES: locale.ru_RU.UTF-8
// <locale>
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_ru_RU.pass.cpp
===================================================================
--- test/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_ru_RU.pass.cpp
+++ test/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_ru_RU.pass.cpp
@@ -9,6 +9,12 @@
//
// XFAIL: apple-darwin
+// 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
+
// REQUIRES: locale.ru_RU.UTF-8
// <locale>
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/decimal_point.pass.cpp
===================================================================
--- test/localization/locale.categories/category.monetary/locale.moneypunct.byname/decimal_point.pass.cpp
+++ test/localization/locale.categories/category.monetary/locale.moneypunct.byname/decimal_point.pass.cpp
@@ -14,6 +14,10 @@
// REQUIRES: locale.ru_RU.UTF-8
// REQUIRES: locale.zh_CN.UTF-8
+// GLIBC specifies the decimal_point for ru_RU to be '.' even though it
+// should be ','.
+// XFAIL: linux
+
// class moneypunct_byname<charT, International>
// charT decimal_point() const;
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,10 @@
// REQUIRES: locale.ru_RU.UTF-8
// REQUIRES: locale.zh_CN.UTF-8
+// possibly related to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=16006
+// My locale says the separator is \xA0
+// XFAIL: linux
+
// <locale>
// class moneypunct_byname<charT, International>
@@ -108,7 +112,6 @@
Fwt f(LOCALE_fr_FR_UTF_8, 1);
assert(f.thousands_sep() == L' ');
}
-
{
Fnf f(LOCALE_ru_RU_UTF_8, 1);
assert(f.thousands_sep() == ' ');
@@ -125,7 +128,6 @@
Fwt f(LOCALE_ru_RU_UTF_8, 1);
assert(f.thousands_sep() == L' ');
}
-
{
Fnf f(LOCALE_zh_CN_UTF_8, 1);
assert(f.thousands_sep() == ',');
Index: test/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_long_double.pass.cpp
===================================================================
--- test/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_long_double.pass.cpp
+++ test/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_long_double.pass.cpp
@@ -10719,6 +10719,29 @@
std::locale lc = std::locale::classic();
std::locale lg(lc, new my_numpunct);
const my_facet f(1);
+
+#if !defined(__GLIBC__)
+ std::string const lnan1 = "nan";
+ std::string const lnan2 = "nan**********************";
+ std::string const lnan3 = "**********************nan";
+ std::string const lnan4 = "**********************nan";
+
+ std::string const unan1 = "NAN";
+ std::string const unan2 = "NAN**********************";
+ std::string const unan3 = "**********************NAN";
+ std::string const unan4 = "**********************NAN";
+#else
+ std::string const lnan1 = "+nan";
+ std::string const lnan2 = "+nan*********************";
+ std::string const lnan3 = "*********************+nan";
+ std::string const lnan4 = "+*********************nan";
+
+ std::string const unan1 = "+NAN";
+ std::string const unan2 = "+NAN*********************";
+ std::string const unan3 = "*********************+NAN";
+ std::string const unan4 = "+*********************NAN";
+#endif
+
{
long double v = std::nan("");
std::ios ios(0);
@@ -10883,7 +10906,7 @@
{
iter = f.put(output_iterator<char*>(str), ios, '*', v);
std::string ex(str, iter.base());
- assert(ex == "nan");
+ assert(ex == lnan1);
assert(ios.width() == 0);
}
ios.width(25);
@@ -10891,7 +10914,7 @@
{
iter = f.put(output_iterator<char*>(str), ios, '*', v);
std::string ex(str, iter.base());
- assert(ex == "nan**********************");
+ assert(ex == lnan2);
assert(ios.width() == 0);
}
ios.width(25);
@@ -10899,7 +10922,7 @@
{
iter = f.put(output_iterator<char*>(str), ios, '*', v);
std::string ex(str, iter.base());
- assert(ex == "**********************nan");
+ assert(ex == lnan3);
assert(ios.width() == 0);
}
ios.width(25);
@@ -10907,7 +10930,7 @@
{
iter = f.put(output_iterator<char*>(str), ios, '*', v);
std::string ex(str, iter.base());
- assert(ex == "**********************nan");
+ assert(ex == lnan4);
assert(ios.width() == 0);
}
}
@@ -10917,7 +10940,7 @@
{
iter = f.put(output_iterator<char*>(str), ios, '*', v);
std::string ex(str, iter.base());
- assert(ex == "nan");
+ assert(ex == lnan1);
assert(ios.width() == 0);
}
ios.width(25);
@@ -10925,7 +10948,7 @@
{
iter = f.put(output_iterator<char*>(str), ios, '*', v);
std::string ex(str, iter.base());
- assert(ex == "nan**********************");
+ assert(ex == lnan2);
assert(ios.width() == 0);
}
ios.width(25);
@@ -10933,7 +10956,7 @@
{
iter = f.put(output_iterator<char*>(str), ios, '*', v);
std::string ex(str, iter.base());
- assert(ex == "**********************nan");
+ assert(ex == lnan3);
assert(ios.width() == 0);
}
ios.width(25);
@@ -10941,7 +10964,7 @@
{
iter = f.put(output_iterator<char*>(str), ios, '*', v);
std::string ex(str, iter.base());
- assert(ex == "**********************nan");
+ assert(ex == lnan4);
assert(ios.width() == 0);
}
}
@@ -10954,7 +10977,7 @@
{
iter = f.put(output_iterator<char*>(str), ios, '*', v);
std::string ex(str, iter.base());
- assert(ex == "nan");
+ assert(ex == lnan1);
assert(ios.width() == 0);
}
ios.width(25);
@@ -10962,7 +10985,7 @@
{
iter = f.put(output_iterator<char*>(str), ios, '*', v);
std::string ex(str, iter.base());
- assert(ex == "nan**********************");
+ assert(ex == lnan2);
assert(ios.width() == 0);
}
ios.width(25);
@@ -10970,7 +10993,7 @@
{
iter = f.put(output_iterator<char*>(str), ios, '*', v);
std::string ex(str, iter.base());
- assert(ex == "**********************nan");
+ assert(ex == lnan3);
assert(ios.width() == 0);
}
ios.width(25);
@@ -10978,7 +11001,7 @@
{
iter = f.put(output_iterator<char*>(str), ios, '*', v);
std::string ex(str, iter.base());
- assert(ex == "**********************nan");
+ assert(ex == lnan4);
assert(ios.width() == 0);
}
}
@@ -10988,7 +11011,7 @@
{
iter = f.put(output_iterator<char*>(str), ios, '*', v);
std::string ex(str, iter.base());
- assert(ex == "nan");
+ assert(ex == lnan1);
assert(ios.width() == 0);
}
ios.width(25);
@@ -10996,7 +11019,7 @@
{
iter = f.put(output_iterator<char*>(str), ios, '*', v);
std::string ex(str, iter.base());
- assert(ex == "nan**********************");
+ assert(ex == lnan2);
assert(ios.width() == 0);
}
ios.width(25);
@@ -11004,7 +11027,7 @@
{
iter = f.put(output_iterator<char*>(str), ios, '*', v);
std::string ex(str, iter.base());
- assert(ex == "**********************nan");
+ assert(ex == lnan3);
assert(ios.width() == 0);
}
ios.width(25);
@@ -11012,7 +11035,7 @@
{
iter = f.put(output_iterator<char*>(str), ios, '*', v);
std::string ex(str, iter.base());
- assert(ex == "**********************nan");
+ assert(ex == lnan4);
assert(ios.width() == 0);
}
}
@@ -11176,7 +11199,7 @@
{
iter = f.put(output_iterator<char*>(str), ios, '*', v);
std::string ex(str, iter.base());
- assert(ex == "NAN");
+ assert(ex == unan1);
assert(ios.width() == 0);
}
ios.width(25);
@@ -11184,7 +11207,7 @@
{
iter = f.put(output_iterator<char*>(str), ios, '*', v);
std::string ex(str, iter.base());
- assert(ex == "NAN**********************");
+ assert(ex == unan2);
assert(ios.width() == 0);
}
ios.width(25);
@@ -11192,7 +11215,7 @@
{
iter = f.put(output_iterator<char*>(str), ios, '*', v);
std::string ex(str, iter.base());
- assert(ex == "**********************NAN");
+ assert(ex == unan3);
assert(ios.width() == 0);
}
ios.width(25);
@@ -11200,7 +11223,7 @@
{
iter = f.put(output_iterator<char*>(str), ios, '*', v);
std::string ex(str, iter.base());
- assert(ex == "**********************NAN");
+ assert(ex == unan4);
assert(ios.width() == 0);
}
}
@@ -11210,7 +11233,7 @@
{
iter = f.put(output_iterator<char*>(str), ios, '*', v);
std::string ex(str, iter.base());
- assert(ex == "NAN");
+ assert(ex == unan1);
assert(ios.width() == 0);
}
ios.width(25);
@@ -11218,7 +11241,7 @@
{
iter = f.put(output_iterator<char*>(str), ios, '*', v);
std::string ex(str, iter.base());
- assert(ex == "NAN**********************");
+ assert(ex == unan2);
assert(ios.width() == 0);
}
ios.width(25);
@@ -11226,7 +11249,7 @@
{
iter = f.put(output_iterator<char*>(str), ios, '*', v);
std::string ex(str, iter.base());
- assert(ex == "**********************NAN");
+ assert(ex == unan3);
assert(ios.width() == 0);
}
ios.width(25);
@@ -11234,7 +11257,7 @@
{
iter = f.put(output_iterator<char*>(str), ios, '*', v);
std::string ex(str, iter.base());
- assert(ex == "**********************NAN");
+ assert(ex == unan4);
assert(ios.width() == 0);
}
}
@@ -11247,7 +11270,7 @@
{
iter = f.put(output_iterator<char*>(str), ios, '*', v);
std::string ex(str, iter.base());
- assert(ex == "NAN");
+ assert(ex == unan1);
assert(ios.width() == 0);
}
ios.width(25);
@@ -11255,7 +11278,7 @@
{
iter = f.put(output_iterator<char*>(str), ios, '*', v);
std::string ex(str, iter.base());
- assert(ex == "NAN**********************");
+ assert(ex == unan2);
assert(ios.width() == 0);
}
ios.width(25);
@@ -11263,7 +11286,7 @@
{
iter = f.put(output_iterator<char*>(str), ios, '*', v);
std::string ex(str, iter.base());
- assert(ex == "**********************NAN");
+ assert(ex == unan3);
assert(ios.width() == 0);
}
ios.width(25);
@@ -11271,7 +11294,7 @@
{
iter = f.put(output_iterator<char*>(str), ios, '*', v);
std::string ex(str, iter.base());
- assert(ex == "**********************NAN");
+ assert(ex == unan4);
assert(ios.width() == 0);
}
}
@@ -11281,7 +11304,7 @@
{
iter = f.put(output_iterator<char*>(str), ios, '*', v);
std::string ex(str, iter.base());
- assert(ex == "NAN");
+ assert(ex == unan1);
assert(ios.width() == 0);
}
ios.width(25);
@@ -11289,7 +11312,7 @@
{
iter = f.put(output_iterator<char*>(str), ios, '*', v);
std::string ex(str, iter.base());
- assert(ex == "NAN**********************");
+ assert(ex == unan2);
assert(ios.width() == 0);
}
ios.width(25);
@@ -11297,7 +11320,7 @@
{
iter = f.put(output_iterator<char*>(str), ios, '*', v);
std::string ex(str, iter.base());
- assert(ex == "**********************NAN");
+ assert(ex == unan3);
assert(ios.width() == 0);
}
ios.width(25);
@@ -11305,7 +11328,7 @@
{
iter = f.put(output_iterator<char*>(str), ios, '*', v);
std::string ex(str, iter.base());
- assert(ex == "**********************NAN");
+ assert(ex == unan4);
assert(ios.width() == 0);
}
}
Index: test/localization/locale.categories/category.time/locale.time.get.byname/get_date.pass.cpp
===================================================================
--- test/localization/locale.categories/category.time/locale.time.get.byname/get_date.pass.cpp
+++ test/localization/locale.categories/category.time/locale.time.get.byname/get_date.pass.cpp
@@ -12,6 +12,9 @@
// REQUIRES: locale.ru_RU.UTF-8
// REQUIRES: locale.zh_CN.UTF-8
+// Investigation needed for linux failures.
+// XFAIL: linux
+
// <locale>
// class time_get_byname<charT, InputIterator>
@@ -20,6 +23,9 @@
// get_date(iter_type s, iter_type end, ios_base& str,
// ios_base::iostate& err, tm* t) const;
+
+
+
#include <locale>
#include <cassert>
#include "test_iterators.h"
@@ -57,7 +63,11 @@
}
{
const my_facet f(LOCALE_fr_FR_UTF_8, 1);
+# if !defined(__GLIBC__)
const char in[] = "10.06.2009";
+# else
+ const char in[] = "10/06/2009";
+# endif
err = std::ios_base::goodbit;
t = std::tm();
I i = f.get_date(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t);
@@ -69,7 +79,13 @@
}
{
const my_facet f(LOCALE_ru_RU_UTF_8, 1);
+# if !defined(__GLIBC__)
const char in[] = "10.06.2009";
+# else
+ // NOTE: GLIBC uses U002E (FULL STOP) for the period instead of just
+ // '.' in ru_RU
+ const char in[] = "10" "\x2E" "06" "\x2E" "2009";
+# endif
err = std::ios_base::goodbit;
t = std::tm();
I i = f.get_date(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t);
@@ -80,6 +96,8 @@
assert(err == std::ios_base::eofbit);
}
{
+ // NOTE: this test fails on linux. Investigation needed.
+ // It looks like bad GLIBC locale data.
const my_facet f(LOCALE_zh_CN_UTF_8, 1);
const char in[] = "2009/06/10";
err = std::ios_base::goodbit;
Index: test/localization/locale.categories/category.time/locale.time.get.byname/get_date_wide.pass.cpp
===================================================================
--- test/localization/locale.categories/category.time/locale.time.get.byname/get_date_wide.pass.cpp
+++ test/localization/locale.categories/category.time/locale.time.get.byname/get_date_wide.pass.cpp
@@ -12,6 +12,9 @@
// REQUIRES: locale.ru_RU.UTF-8
// REQUIRES: locale.zh_CN.UTF-8
+// Investigation needed for linux failures.
+// XFAIL: linux
+
// <locale>
// class time_get_byname<charT, InputIterator>
@@ -57,7 +60,11 @@
}
{
const my_facet f(LOCALE_fr_FR_UTF_8, 1);
+# if !defined(__GLIBC__)
const wchar_t in[] = L"10.06.2009";
+# else
+ const wchar_t in[] = L"10/06/2009";
+# endif
err = std::ios_base::goodbit;
t = std::tm();
I i = f.get_date(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t);
@@ -80,6 +87,8 @@
assert(err == std::ios_base::eofbit);
}
{
+ // NOTE: this test fails on linux. Investigation needed.
+ // It looks like bad GLIBC locale data.
const my_facet f(LOCALE_zh_CN_UTF_8, 1);
const wchar_t in[] = L"2009/06/10";
err = std::ios_base::goodbit;
Index: test/localization/locale.categories/category.time/locale.time.get.byname/get_one.pass.cpp
===================================================================
--- test/localization/locale.categories/category.time/locale.time.get.byname/get_one.pass.cpp
+++ test/localization/locale.categories/category.time/locale.time.get.byname/get_one.pass.cpp
@@ -12,6 +12,9 @@
// REQUIRES: locale.ru_RU.UTF-8
// REQUIRES: locale.zh_CN.UTF-8
+// investigation needed for linux failures.
+// XFAIL: linux
+
// <locale>
// class time_get_byname<charT, InputIterator>
@@ -42,6 +45,9 @@
std::ios ios(0);
std::ios_base::iostate err;
std::tm t;
+ // %c specifier is locale specific. with GLIBC it includes the timezone.
+ // This test is not portible on linux.
+#if !defined(__GLIBC__)
{
const my_facet f(LOCALE_en_US_UTF_8, 1);
const char in[] = "Sat Dec 31 23:55:59 2061";
@@ -58,9 +64,14 @@
assert(t.tm_wday == 6);
assert(err == std::ios_base::eofbit);
}
+#endif
{
const my_facet f(LOCALE_en_US_UTF_8, 1);
+# if !defined(__GLIBC__)
const char in[] = "23:55:59";
+# else
+ const char in[] = "11:55:59 PM";
+# endif
err = std::ios_base::goodbit;
t = std::tm();
I i = f.get(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t, 'X');
@@ -70,6 +81,8 @@
assert(t.tm_hour == 23);
assert(err == std::ios_base::eofbit);
}
+ // %c specifier is non-portable with GLIBC. (includes time zone)
+#if !defined(__GLIBC__)
{
const my_facet f(LOCALE_fr_FR_UTF_8, 1);
const char in[] = "Sam 31 d""\xC3\xA9""c 23:55:59 2061";
@@ -86,6 +99,7 @@
assert(t.tm_wday == 6);
assert(err == std::ios_base::eofbit);
}
+#endif
{
const my_facet f(LOCALE_fr_FR_UTF_8, 1);
const char in[] = "23:55:59";
@@ -99,6 +113,7 @@
assert(err == std::ios_base::eofbit);
}
{
+ // NOTE: fails on linux needs investigation
const my_facet f(LOCALE_ru_RU_UTF_8, 1);
const char in[] = "\xD1\x81\xD1\x83\xD0\xB1\xD0\xB1"
"\xD0\xBE\xD1\x82\xD0\xB0"
@@ -134,6 +149,7 @@
assert(err == std::ios_base::eofbit);
}
{
+ // NOTE: Fails on linux. needs investigation.
const my_facet f(LOCALE_zh_CN_UTF_8, 1);
const char in[] = "\xE5\x85\xAD"
" 12/31 23:55:59 2061";
Index: test/localization/locale.categories/category.time/locale.time.get.byname/get_one_wide.pass.cpp
===================================================================
--- test/localization/locale.categories/category.time/locale.time.get.byname/get_one_wide.pass.cpp
+++ test/localization/locale.categories/category.time/locale.time.get.byname/get_one_wide.pass.cpp
@@ -12,6 +12,9 @@
// REQUIRES: locale.ru_RU.UTF-8
// REQUIRES: locale.zh_CN.UTF-8
+// investigation needed for linux failures.
+// XFAIL: linux
+
// <locale>
// class time_get_byname<charT, InputIterator>
@@ -42,6 +45,7 @@
std::ios ios(0);
std::ios_base::iostate err;
std::tm t;
+#if !defined(__GLIBC__)
{
const my_facet f(LOCALE_en_US_UTF_8, 1);
const wchar_t in[] = L"Sat Dec 31 23:55:59 2061";
@@ -58,9 +62,14 @@
assert(t.tm_wday == 6);
assert(err == std::ios_base::eofbit);
}
+#endif
{
const my_facet f(LOCALE_en_US_UTF_8, 1);
+# if !defined(__GLIBC__)
const wchar_t in[] = L"23:55:59";
+# else
+ const wchar_t in[] = L"11:55:59 PM";
+# endif
err = std::ios_base::goodbit;
t = std::tm();
I i = f.get(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t, 'X');
@@ -70,6 +79,7 @@
assert(t.tm_hour == 23);
assert(err == std::ios_base::eofbit);
}
+#if !defined(__GLIBC__)
{
const my_facet f(LOCALE_fr_FR_UTF_8, 1);
const wchar_t in[] = L"Sam 31 d""\xE9""c 23:55:59 2061";
@@ -86,6 +96,7 @@
assert(t.tm_wday == 6);
assert(err == std::ios_base::eofbit);
}
+#endif
{
const my_facet f(LOCALE_fr_FR_UTF_8, 1);
const wchar_t in[] = L"23:55:59";
@@ -98,9 +109,9 @@
assert(t.tm_hour == 23);
assert(err == std::ios_base::eofbit);
}
-#ifdef __APPLE__
{
- const my_facet f("ru_RU", 1);
+ // NOTE: fails on linux needs investigation.
+ const my_facet f(LOCALE_ru_RU_UTF_8, 1);
const wchar_t in[] = L"\x441\x443\x431\x431\x43E\x442\x430"
", 31 "
"\x434\x435\x43A\x430\x431\x440\x44F"
@@ -120,7 +131,6 @@
assert(t.tm_wday == 6);
assert(err == std::ios_base::eofbit);
}
-#endif
{
const my_facet f(LOCALE_ru_RU_UTF_8, 1);
const wchar_t in[] = L"23:55:59";
@@ -133,9 +143,9 @@
assert(t.tm_hour == 23);
assert(err == std::ios_base::eofbit);
}
-#ifdef __APPLE__
{
- const my_facet f("zh_CN", 1);
+ // NOTE: fails on linux needs investigation.
+ const my_facet f(LOCALE_zh_CN_UTF_8, 1);
const wchar_t in[] = L"\x516D"
" 12/31 23:55:59 2061";
err = std::ios_base::goodbit;
@@ -151,7 +161,6 @@
assert(t.tm_wday == 6);
assert(err == std::ios_base::eofbit);
}
-#endif
{
const my_facet f(LOCALE_zh_CN_UTF_8, 1);
const wchar_t in[] = L"23""\x65F6""55""\x5206""59""\x79D2";
Index: test/localization/locale.categories/category.time/locale.time.get.byname/get_weekday.pass.cpp
===================================================================
--- test/localization/locale.categories/category.time/locale.time.get.byname/get_weekday.pass.cpp
+++ test/localization/locale.categories/category.time/locale.time.get.byname/get_weekday.pass.cpp
@@ -65,9 +65,18 @@
}
{
const my_facet f(LOCALE_ru_RU_UTF_8, 1);
+# if !defined(__GLIBC__)
const char in[] = "\xD0\xBF\xD0\xBE\xD0\xBD\xD0\xB5"
"\xD0\xB4\xD0\xB5\xD0\xBB\xD1\x8C"
"\xD0\xBD\xD0\xB8\xD0\xBA";
+# else
+ // NOTE: GLIBC uses U041F instead of 043F. It seems to be the difference
+ // between an upper and lower case letter. This changes the second
+ // byte from \xBF to \x9F.
+ const char in[] = "\xD0\x9F\xD0\xBE\xD0\xBD\xD0\xB5"
+ "\xD0\xB4\xD0\xB5\xD0\xBB\xD1\x8C"
+ "\xD0\xBD\xD0\xB8\xD0\xBA";
+# endif
err = std::ios_base::goodbit;
t = std::tm();
I i = f.get_weekday(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t);
Index: test/localization/locale.categories/category.time/locale.time.get.byname/get_weekday_wide.pass.cpp
===================================================================
--- test/localization/locale.categories/category.time/locale.time.get.byname/get_weekday_wide.pass.cpp
+++ test/localization/locale.categories/category.time/locale.time.get.byname/get_weekday_wide.pass.cpp
@@ -65,7 +65,13 @@
}
{
const my_facet f(LOCALE_ru_RU_UTF_8, 1);
+# if !defined(__linux__)
const wchar_t in[] = L"\x43F\x43E\x43D\x435\x434\x435\x43B\x44C\x43D\x438\x43A";
+# else
+ // NOTE: GLIBC uses U041F instead of 043F. It seems to be the difference
+ // between an upper and lower case letter.
+ const wchar_t in[] = L"\x41F\x43E\x43D\x435\x434\x435\x43B\x44C\x43D\x438\x43A";
+# endif
err = std::ios_base::goodbit;
t = std::tm();
I i = f.get_weekday(I(in), I(in+sizeof(in)/sizeof(in[0])-1), ios, err, &t);
Index: test/localization/locale.categories/category.time/locale.time.put.byname/put1.pass.cpp
===================================================================
--- test/localization/locale.categories/category.time/locale.time.put.byname/put1.pass.cpp
+++ test/localization/locale.categories/category.time/locale.time.put.byname/put1.pass.cpp
@@ -69,7 +69,12 @@
iter = f.put(output_iterator<char*>(str), ios, '*', &t,
pat.data(), pat.data() + pat.size());
std::string ex(str, iter.base());
+# if !defined(__GLIBC__)
assert((ex == "Today is Samedi which is abbreviated Sam.")||
(ex == "Today is samedi which is abbreviated sam." ));
+# else
+ // w/ GLIBC fr_FR.UTF-8 day abreviations can end with a '.'
+ assert(ex == "Today is samedi which is abbreviated sam..");
+# endif
}
}
Index: test/localization/locale.categories/category.time/locale.time.put/locale.time.put.members/put2.pass.cpp
===================================================================
--- test/localization/locale.categories/category.time/locale.time.put/locale.time.put.members/put2.pass.cpp
+++ test/localization/locale.categories/category.time/locale.time.put/locale.time.put.members/put2.pass.cpp
@@ -7,6 +7,9 @@
//
//===----------------------------------------------------------------------===//
+// Investigation needed. It seems like it might just be bad tests.
+// XFAIL: linux
+
// <locale>
// class time_put<charT, OutputIterator>
@@ -179,11 +182,14 @@
std::string ex(str, iter.base());
assert(ex == "09");
}
+ // %OB is a BSD libc extension.
+#if !defined(__GLIBC__)
{
iter = f.put(output_iterator<char*>(str), ios, '*', &t, 'B', 'O');
std::string ex(str, iter.base());
assert(ex == "May");
}
+#endif
{
iter = f.put(output_iterator<char*>(str), ios, '*', &t, 'e');
std::string ex(str, iter.base());
@@ -299,11 +305,14 @@
std::string ex(str, iter.base());
assert(ex == "52");
}
+ // %v is a BSD libc extension
+#if !defined(__GLIBC__)
{
iter = f.put(output_iterator<char*>(str), ios, '*', &t, 'v');
std::string ex(str, iter.base());
assert(ex == " 2-May-2009");
}
+#endif
{
iter = f.put(output_iterator<char*>(str), ios, '*', &t, 'W');
std::string ex(str, iter.base());
@@ -355,11 +364,17 @@
assert(ex == "%");
}
{
+ // NOTE: fails on linux. More investigation needed. Seems to
+ // be a difference in the implementation of GLIBC.
+ // I don't think this is a portible test.
iter = f.put(output_iterator<char*>(str), ios, '*', &t, '%', 'J');
std::string ex(str, iter.base());
assert(ex == "J%");
}
{
+ // NOTE: fails on linux. More investigation needed. Seems to
+ // be a difference in the implementation of GLIBC.
+ // I don't think this is a portible test.
iter = f.put(output_iterator<char*>(str), ios, '*', &t, 'J');
std::string ex(str, iter.base());
assert(ex == "J");
Index: test/localization/locale.categories/facet.numpunct/locale.numpunct.byname/grouping.pass.cpp
===================================================================
--- test/localization/locale.categories/facet.numpunct/locale.numpunct.byname/grouping.pass.cpp
+++ test/localization/locale.categories/facet.numpunct/locale.numpunct.byname/grouping.pass.cpp
@@ -54,12 +54,20 @@
{
typedef char C;
const std::numpunct<C>& np = std::use_facet<std::numpunct<C> >(l);
+# if !defined(__GLIBC__)
assert(np.grouping() == "\x7F");
+# else
+ assert(np.grouping() == "\3");
+# endif
}
{
typedef wchar_t C;
const std::numpunct<C>& np = std::use_facet<std::numpunct<C> >(l);
+# if !defined(__GLIBC__)
assert(np.grouping() == "\x7F");
+# else
+ assert(np.grouping() == "\3");
+# endif
}
}
}
Index: test/localization/locale.categories/facet.numpunct/locale.numpunct.byname/thousands_sep.pass.cpp
===================================================================
--- test/localization/locale.categories/facet.numpunct/locale.numpunct.byname/thousands_sep.pass.cpp
+++ test/localization/locale.categories/facet.numpunct/locale.numpunct.byname/thousands_sep.pass.cpp
@@ -16,6 +16,8 @@
// char_type thousands_sep() const;
+// NOTE: GLIBC uses ' ' as fr_FR's thousands_sep instead of ','
+
#include <locale>
#include <cassert>
@@ -54,12 +56,20 @@
{
typedef char C;
const std::numpunct<C>& np = std::use_facet<std::numpunct<C> >(l);
+# if !defined(__GLIBC__)
assert(np.thousands_sep() == ',');
+# else
+ assert(np.thousands_sep() == ' ');
+# endif
}
{
typedef wchar_t C;
const std::numpunct<C>& np = std::use_facet<std::numpunct<C> >(l);
+# if !defined(__GLIBC__)
assert(np.thousands_sep() == L',');
+# else
+ assert(np.thousands_sep() == L' ');
+# endif
}
}
}
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits