summaryrefslogtreecommitdiffstats
path: root/libcxx/test/std/localization
diff options
context:
space:
mode:
authorEd Schouten <ed@nuxi.nl>2015-03-26 08:38:00 +0000
committerEd Schouten <ed@nuxi.nl>2015-03-26 08:38:00 +0000
commit407bd03e6dfe284e578b10547591c30a2a22e85d (patch)
tree60fc204edcd5ce39caecd68728dbcd02993d869d /libcxx/test/std/localization
parentf85d98285e8eb6bcf42c2821e3b03abfc22ffac9 (diff)
downloadbcm5719-llvm-407bd03e6dfe284e578b10547591c30a2a22e85d.tar.gz
bcm5719-llvm-407bd03e6dfe284e578b10547591c30a2a22e85d.zip
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 llvm-svn: 233262
Diffstat (limited to 'libcxx/test/std/localization')
-rw-r--r--libcxx/test/std/localization/locale.categories/category.time/locale.time.put/locale.time.put.members/put2.pass.cpp60
1 files changed, 11 insertions, 49 deletions
diff --git a/libcxx/test/std/localization/locale.categories/category.time/locale.time.put/locale.time.put.members/put2.pass.cpp b/libcxx/test/std/localization/locale.categories/category.time/locale.time.put/locale.time.put.members/put2.pass.cpp
index 427d7c5515f..d9e7f3cd514 100644
--- a/libcxx/test/std/localization/locale.categories/category.time/locale.time.put/locale.time.put.members/put2.pass.cpp
+++ b/libcxx/test/std/localization/locale.categories/category.time/locale.time.put/locale.time.put.members/put2.pass.cpp
@@ -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");
- }
}
OpenPOWER on IntegriCloud