[libcxx] r233262 - Don't let time_put test use implementation dependent constructs.

Ed Schouten ed at nuxi.nl
Thu Mar 26 01:38:00 PDT 2015


Author: ed
Date: Thu Mar 26 03:38:00 2015
New Revision: 233262

URL: http://llvm.org/viewvc/llvm-project?rev=233262&view=rev
Log:
Don't let time_put test use implementation dependent constructs.

The time_put test doesn't seem to work on Linux and CloudABI. For Linux
we already have an XFAIL. Closer inspection seems to reveal that this
test does not pass for a couple of reasons.

First of all, the tm_yday field is set to an invalid value. The
strftime() function doesn't behave consistently across platforms in case
the values in the tm structure are incoherent. Fix up this field to have
the value 121, which corresponds with tm_mday, tm_mon and tm_year. This
of course affects the output of time_put for some modifiers, so update
the tests accordingly.

Second, some of the tests actually use modifiers that are only present
on BSD derived systems. They are not part of the C standard/POSIX.
Simply remove them.

Finally, some of the tests actually use invalid modifiers, causing a
malformed format string to be passed to strftime(). Remove these tests
as well.

Differential Revision:	http://reviews.llvm.org/D8349

Modified:
    libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.put/locale.time.put.members/put2.pass.cpp

Modified: libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.put/locale.time.put.members/put2.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.put/locale.time.put.members/put2.pass.cpp?rev=233262&r1=233261&r2=233262&view=diff
==============================================================================
--- libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.put/locale.time.put.members/put2.pass.cpp (original)
+++ libcxx/trunk/test/std/localization/locale.categories/category.time/locale.time.put/locale.time.put.members/put2.pass.cpp Thu Mar 26 03:38:00 2015
@@ -14,9 +14,6 @@
 // iter_type put(iter_type s, ios_base& str, char_type fill, const tm* t,
 //               char format, char modifier = 0) const;
 
-// TODO: investigation needed
-// XFAIL: linux-gnu
-
 #include <locale>
 #include <cassert>
 #include "test_iterators.h"
@@ -36,7 +33,7 @@ int main()
     const my_facet f(1);
     char str[200];
     output_iterator<char*> iter;
-    tm t = {0};
+    tm t = {};
     t.tm_sec = 6;
     t.tm_min = 3;
     t.tm_hour = 13;
@@ -44,7 +41,7 @@ int main()
     t.tm_mon = 4;
     t.tm_year = 109;
     t.tm_wday = 6;
-    t.tm_yday = -1;
+    t.tm_yday = 121;
     t.tm_isdst = 1;
     std::ios ios(0);
     {
@@ -160,12 +157,12 @@ int main()
     {
         iter = f.put(output_iterator<char*>(str), ios, '*', &t, 'U', 'O');
         std::string ex(str, iter.base());
-        assert(ex == "00");
+        assert(ex == "17");
     }
     {
         iter = f.put(output_iterator<char*>(str), ios, '*', &t, 'V', 'O');
         std::string ex(str, iter.base());
-        assert(ex == "52");
+        assert(ex == "18");
     }
     {
         iter = f.put(output_iterator<char*>(str), ios, '*', &t, 'w', 'O');
@@ -175,7 +172,7 @@ int main()
     {
         iter = f.put(output_iterator<char*>(str), ios, '*', &t, 'W', 'O');
         std::string ex(str, iter.base());
-        assert(ex == "00");
+        assert(ex == "17");
     }
     {
         iter = f.put(output_iterator<char*>(str), ios, '*', &t, 'y', 'O');
@@ -183,11 +180,6 @@ int main()
         assert(ex == "09");
     }
     {
-        iter = f.put(output_iterator<char*>(str), ios, '*', &t, 'B', 'O');
-        std::string ex(str, iter.base());
-        assert(ex == "May");
-    }
-    {
         iter = f.put(output_iterator<char*>(str), ios, '*', &t, 'e');
         std::string ex(str, iter.base());
         assert(ex == " 2");
@@ -200,12 +192,12 @@ int main()
     {
         iter = f.put(output_iterator<char*>(str), ios, '*', &t, 'G');
         std::string ex(str, iter.base());
-        assert(ex == "2008");
+        assert(ex == "2009");
     }
     {
         iter = f.put(output_iterator<char*>(str), ios, '*', &t, 'g');
         std::string ex(str, iter.base());
-        assert(ex == "08");
+        assert(ex == "09");
     }
     {
         iter = f.put(output_iterator<char*>(str), ios, '*', &t, 'H');
@@ -225,17 +217,7 @@ int main()
     {
         iter = f.put(output_iterator<char*>(str), ios, '*', &t, 'j');
         std::string ex(str, iter.base());
-        assert(ex == "000");
-    }
-    {
-        iter = f.put(output_iterator<char*>(str), ios, '*', &t, 'k');
-        std::string ex(str, iter.base());
-        assert(ex == "13");
-    }
-    {
-        iter = f.put(output_iterator<char*>(str), ios, '*', &t, 'l');
-        std::string ex(str, iter.base());
-        assert(ex == " 1");
+        assert(ex == "122");
     }
     {
         iter = f.put(output_iterator<char*>(str), ios, '*', &t, 'M');
@@ -273,11 +255,6 @@ int main()
         assert(ex == "06");
     }
     {
-        iter = f.put(output_iterator<char*>(str), ios, '*', &t, 's');
-        std::string ex(str, iter.base());
-//        assert(ex == "1241283786");  depends on time zone
-    }
-    {
         iter = f.put(output_iterator<char*>(str), ios, '*', &t, 'T');
         std::string ex(str, iter.base());
         assert(ex == "13:03:06");
@@ -290,7 +267,7 @@ int main()
     {
         iter = f.put(output_iterator<char*>(str), ios, '*', &t, 'U');
         std::string ex(str, iter.base());
-        assert(ex == "00");
+        assert(ex == "17");
     }
     {
         iter = f.put(output_iterator<char*>(str), ios, '*', &t, 'u');
@@ -300,17 +277,12 @@ int main()
     {
         iter = f.put(output_iterator<char*>(str), ios, '*', &t, 'V');
         std::string ex(str, iter.base());
-        assert(ex == "52");
-    }
-    {
-        iter = f.put(output_iterator<char*>(str), ios, '*', &t, 'v');
-        std::string ex(str, iter.base());
-        assert(ex == " 2-May-2009");
+        assert(ex == "18");
     }
     {
         iter = f.put(output_iterator<char*>(str), ios, '*', &t, 'W');
         std::string ex(str, iter.base());
-        assert(ex == "00");
+        assert(ex == "17");
     }
     {
         iter = f.put(output_iterator<char*>(str), ios, '*', &t, 'w');
@@ -357,14 +329,4 @@ int main()
         std::string ex(str, iter.base());
         assert(ex == "%");
     }
-    {
-        iter = f.put(output_iterator<char*>(str), ios, '*', &t, '%', 'J');
-        std::string ex(str, iter.base());
-        assert(ex == "J%");
-    }
-    {
-        iter = f.put(output_iterator<char*>(str), ios, '*', &t, 'J');
-        std::string ex(str, iter.base());
-        assert(ex == "J");
-    }
 }





More information about the cfe-commits mailing list