Hi
After having installed all necessary locales on my system I end up
with 4 failures. Here is a patch to fix them all.
For numpunct test I consider that checking value of numpunct::grouping()
result was not correct. libstdc++ doesn't control this value. I prefer
to just check that values returned by numpunct are consistent with how
numeric values are formatted.
For the others, regarding time_get, I found nothing really smart to do.
For 4.cc I simply had to remove some characters not present anymore. And
for 38081-1 and 38081-2, despite having glibc 2.19 it is still showing
previous values on my system. I even wonder if it has anything to do
with glibc version, it rather depends on the installed locale info, no ?
2014-12-08 François Dumont <fdum...@gcc.gnu.org>
* testsuite/22_locale/numpunct/members/char/3.cc: Check numpunct
returned
values are consistent with how numbers are formatted.
* testsuite/22_locale/time_get/get_date/wchar_t/4.cc: Update expected
values.
* testsuite/22_locale/time_get/get_weekday/char/38081-1.cc: Don't
use new
values before glibc 2.20.
* testsuite/22_locale/time_get/get_weekday/char/38081-2.cc: Likewise.
Tested under Linux x86_64.
François
Index: testsuite/22_locale/numpunct/members/char/3.cc
===================================================================
--- testsuite/22_locale/numpunct/members/char/3.cc (revision 218492)
+++ testsuite/22_locale/numpunct/members/char/3.cc (working copy)
@@ -21,6 +21,7 @@
// 22.2.3.2 Template class numpunct_byname
+#include <sstream>
#include <locale>
#include <testsuite_hooks.h>
@@ -30,13 +31,52 @@
bool test __attribute__((unused)) = true;
- locale loc_it = locale("it_IT");
+ // Use numpunct to generate representation for an arbitrary number.
+ const int number = 1000000000;
- const numpunct<char>& nump_it = use_facet<numpunct<char> >(loc_it);
+ ostringstream ostr;
+ ostr.imbue(locale::classic());
+
+ ostr << number;
+ string c_number = ostr.str();
+ locale loc_it = locale("it_IT");
+ const numpunct<char>& nump_it = use_facet<numpunct<char> >(loc_it);
string g = nump_it.grouping();
- VERIFY( g == "" );
+ size_t group_index = 0;
+ string it_number;
+ size_t it_pos = 0;
+ size_t offset = 0;
+ for (size_t pos = 0; pos != c_number.size(); ++pos)
+ {
+ int group_size =
+ group_index < g.size() ? (int)g[group_index]
+ : (g.empty()
+ // No grouping, just make group size big enough so that
+ // there will be no insertion of thousands separator.
+ ? c_number.size()
+ : g[g.size() - 1]);
+ if (pos + offset < it_pos + group_size)
+ it_number.insert(it_number.begin(), c_number[c_number.size() - pos - 1]);
+ else
+ {
+ // Time to add the group separator.
+ it_number.insert(it_number.begin(), nump_it.thousands_sep());
+ it_number.insert(it_number.begin(), c_number[c_number.size() - pos - 1]);
+ ++offset;
+ ++group_index;
+ it_pos = it_number.size() - 1;
+ }
+ }
+
+ // Check that the result is identical to the one obtained with an
+ // ostringstream imbued with the it_IT locale.
+ ostr.str("");
+ ostr.imbue(loc_it);
+ ostr << number;
+
+ VERIFY( ostr.str() == it_number );
}
int main()
Index: testsuite/22_locale/time_get/get_date/wchar_t/4.cc
===================================================================
--- testsuite/22_locale/time_get/get_date/wchar_t/4.cc (revision 218492)
+++ testsuite/22_locale/time_get/get_date/wchar_t/4.cc (working copy)
@@ -43,7 +43,7 @@
const ios_base::iostate good = ios_base::goodbit;
ios_base::iostate errorstate = good;
- const wchar_t wstr[] = { 0x897f, 0x5143, L'2', L'0', L'0', L'3',
+ const wchar_t wstr[] = { /* 0x897f, 0x5143,*/ L'2', L'0', L'0', L'3',
0x5e74, L'1', L'2', 0x6708, L'1', L'7',
0x65e5 , 0x0 };
Index: testsuite/22_locale/time_get/get_weekday/char/38081-1.cc
===================================================================
--- testsuite/22_locale/time_get/get_weekday/char/38081-1.cc (revision 218492)
+++ testsuite/22_locale/time_get/get_weekday/char/38081-1.cc (working copy)
@@ -50,7 +50,7 @@
// ios_base::iostate&, tm*) const
#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 14)
-# if __GLIBC__ > 2 || __GLIBC_MINOR__ >= 17
+# if __GLIBC__ > 2 || __GLIBC_MINOR__ >= 20
iss.str("\xbf\xdd");
# else
iss.str("\xbf\xdd\x2e");
@@ -76,7 +76,7 @@
VERIFY( errorstate == ios_base::eofbit );
#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 14)
-# if __GLIBC__ > 2 || __GLIBC_MINOR__ >= 17
+# if __GLIBC__ > 2 || __GLIBC_MINOR__ >= 20
iss.str("\xbf\xdd\xd5\xd4\xd5\xdb\xec\xdd\xd8\xda");
# else
iss.str("\xbf\xdd\x2e\xd5\xd4\xd5\xdb\xec\xdd\xd8\xda");
Index: testsuite/22_locale/time_get/get_weekday/char/38081-2.cc
===================================================================
--- testsuite/22_locale/time_get/get_weekday/char/38081-2.cc (revision 218492)
+++ testsuite/22_locale/time_get/get_weekday/char/38081-2.cc (working copy)
@@ -51,7 +51,7 @@
// ios_base::iostate&, tm*) const
#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 14)
-# if __GLIBC__ > 2 || __GLIBC_MINOR__ >= 17
+# if __GLIBC__ > 2 || __GLIBC_MINOR__ >= 20
const char* awdays[7] = { "\u0412\u0441",
"\u041F\u043D",
"\u0412\u0442",