Hi mclow.lists, danalbert,

This gets all of the test under 
test/localization/locale.categories/category.time passing (or XFAIL) under 
linux.

http://reviews.llvm.org/D4999

Files:
  
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
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
@@ -42,6 +42,9 @@
     std::ios ios(0);
     std::ios_base::iostate err;
     std::tm t;
+    // NOTE: %c is locale specific. with GLIBC it includes the timezone making
+    // this test non-portable
+#ifdef __APPLE__
     {
         const my_facet f(LOCALE_en_US_UTF_8, 1);
         const char in[] = "Sat Dec 31 23:55:59 2061";
@@ -58,9 +61,15 @@
         assert(t.tm_wday == 6);
         assert(err == std::ios_base::eofbit);
     }
+#endif
     {
         const my_facet f(LOCALE_en_US_UTF_8, 1);
+    // NOTE: GLIBC uses 12 hour time for en_US.
+#   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 +79,7 @@
         assert(t.tm_hour == 23);
         assert(err == std::ios_base::eofbit);
     }
+#ifdef __APPLE__
     {
         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 +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 char in[] = "23:55:59";
@@ -98,6 +109,7 @@
         assert(t.tm_hour == 23);
         assert(err == std::ios_base::eofbit);
     }
+#ifdef __APPLE__
     {
         const my_facet f(LOCALE_ru_RU_UTF_8, 1);
         const char in[] = "\xD1\x81\xD1\x83\xD0\xB1\xD0\xB1"
@@ -121,6 +133,7 @@
         assert(t.tm_wday == 6);
         assert(err == std::ios_base::eofbit);
     }
+#endif
     {
         const my_facet f(LOCALE_ru_RU_UTF_8, 1);
         const char in[] = "23:55:59";
@@ -133,6 +146,7 @@
         assert(t.tm_hour == 23);
         assert(err == std::ios_base::eofbit);
     }
+#ifdef __APPLE__
     {
         const my_facet f(LOCALE_zh_CN_UTF_8, 1);
         const char in[] = "\xE5\x85\xAD"
@@ -150,6 +164,7 @@
         assert(t.tm_wday == 6);
         assert(err == std::ios_base::eofbit);
     }
+#endif
     {
         const my_facet f(LOCALE_zh_CN_UTF_8, 1);
         const char in[] = "23""\xE6\x97\xB6""55""\xE5\x88\x86""59""\xE7\xA7\x92";
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,8 @@
 // REQUIRES: locale.ru_RU.UTF-8
 // REQUIRES: locale.zh_CN.UTF-8
 
+
+
 // <locale>
 
 // class time_get_byname<charT, InputIterator>
@@ -42,6 +44,9 @@
     std::ios ios(0);
     std::ios_base::iostate err;
     std::tm t;
+    // %c is locale dependant. With GLIBC it includes the timezone making this
+    // test non-portible
+#ifdef __APPLE__
     {
         const my_facet f(LOCALE_en_US_UTF_8, 1);
         const wchar_t in[] = L"Sat Dec 31 23:55:59 2061";
@@ -58,9 +63,15 @@
         assert(t.tm_wday == 6);
         assert(err == std::ios_base::eofbit);
     }
+#endif
     {
         const my_facet f(LOCALE_en_US_UTF_8, 1);
+    // NOTE: GLIBC uses 12 hour time for en_US
+#   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 +81,7 @@
         assert(t.tm_hour == 23);
         assert(err == std::ios_base::eofbit);
     }
+#ifdef __APPLE__
     {
         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 +98,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";
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
@@ -10,6 +10,10 @@
 // REQUIRES: locale.en_US.UTF-8
 // REQUIRES: locale.fr_FR.UTF-8
 
+// GLIBC uses lower case names and their short forms end with a dot.
+// The last test returns "Today is samedi which is abbreviated sam.."
+// XFAIL: linux
+
 // <locale>
 
 // template <class CharT, class OutputIterator = ostreambuf_iterator<CharT> >
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");
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to