summaryrefslogtreecommitdiff
path: root/libstdc++-v3/testsuite/22_locale/time_get/get_weekday/char
diff options
context:
space:
mode:
authorupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
committerupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
commit554fd8c5195424bdbcabf5de30fdc183aba391bd (patch)
tree976dc5ab7fddf506dadce60ae936f43f58787092 /libstdc++-v3/testsuite/22_locale/time_get/get_weekday/char
downloadcbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.bz2
cbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.xz
obtained gcc-4.6.4.tar.bz2 from upstream website;upstream
verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository.
Diffstat (limited to 'libstdc++-v3/testsuite/22_locale/time_get/get_weekday/char')
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_get/get_weekday/char/1.cc120
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_get/get_weekday/char/2.cc83
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_get/get_weekday/char/3.cc69
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_get/get_weekday/char/38081-1.cc94
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_get/get_weekday/char/38081-2.cc110
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_get/get_weekday/char/5.cc67
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_get/get_weekday/char/6.cc87
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_get/get_weekday/char/wrapped_env.cc48
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_get/get_weekday/char/wrapped_locale.cc49
9 files changed, 727 insertions, 0 deletions
diff --git a/libstdc++-v3/testsuite/22_locale/time_get/get_weekday/char/1.cc b/libstdc++-v3/testsuite/22_locale/time_get/get_weekday/char/1.cc
new file mode 100644
index 000000000..a7cef0ac5
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_get/get_weekday/char/1.cc
@@ -0,0 +1,120 @@
+// 2001-09-21 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2009
+// Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 22.2.5.1.1 time_get members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void test01()
+{
+ using namespace std;
+ bool test __attribute__((unused)) = true;
+
+ typedef istreambuf_iterator<char> iterator_type;
+
+ // basic construction
+ locale loc_c = locale::classic();
+
+ const string empty;
+
+ // create an ostream-derived object, cache the time_get facet
+ iterator_type end;
+
+ istringstream iss;
+ iss.imbue(loc_c);
+ const time_get<char>& tim_get = use_facet<time_get<char> >(iss.getloc());
+
+ const ios_base::iostate good = ios_base::goodbit;
+ ios_base::iostate errorstate = good;
+
+ // create "C" time objects
+ const tm time_bday = __gnu_test::test_tm(0, 0, 12, 4, 3, 71, 0, 93, 0);
+
+ // iter_type
+ // get_weekday(iter_type, iter_type, ios_base&,
+ // ios_base::iostate&, tm*) const
+
+ // sanity checks for "C" locale
+ iss.str("Sunday");
+ iterator_type is_it01(iss);
+ tm time01;
+ errorstate = good;
+ tim_get.get_weekday(is_it01, end, iss, errorstate, &time01);
+ VERIFY( time01.tm_wday == time_bday.tm_wday );
+ VERIFY( errorstate == ios_base::eofbit );
+
+ iss.str("Sun");
+ iterator_type is_it02(iss);
+ tm time02;
+ errorstate = good;
+ tim_get.get_weekday(is_it02, end, iss, errorstate, &time02);
+ VERIFY( time02.tm_wday == time_bday.tm_wday );
+ VERIFY( errorstate == ios_base::eofbit );
+
+ iss.str("Sun ");
+ iterator_type is_it03(iss);
+ tm time03;
+ errorstate = good;
+ iterator_type ret03 = tim_get.get_weekday(is_it03, end, iss, errorstate,
+ &time03);
+ VERIFY( time03.tm_wday == time_bday.tm_wday );
+ VERIFY( errorstate == good );
+ VERIFY( *ret03 == ' ' );
+
+ iss.str("San");
+ iterator_type is_it04(iss);
+ tm time04;
+ time04.tm_wday = 4;
+ errorstate = good;
+ iterator_type ret04 = tim_get.get_weekday(is_it04, end, iss, errorstate,
+ &time04);
+ VERIFY( time04.tm_wday == 4 );
+ VERIFY( *ret04 == 'n' );
+ VERIFY( errorstate == ios_base::failbit );
+
+ iss.str("Tuesday ");
+ iterator_type is_it05(iss);
+ tm time05;
+ errorstate = good;
+ iterator_type ret05 = tim_get.get_weekday(is_it05, end, iss, errorstate,
+ &time05);
+ VERIFY( time05.tm_wday == 2 );
+ VERIFY( errorstate == good );
+ VERIFY( *ret05 == ' ' );
+
+ iss.str("Tuesducky "); // Kind of like Fryday, without the swirls.
+ iterator_type is_it06(iss);
+ tm time06;
+ time06.tm_wday = 4;
+ errorstate = good;
+ iterator_type ret06 = tim_get.get_weekday(is_it06, end, iss, errorstate,
+ &time06);
+ VERIFY( time06.tm_wday == 4 );
+ VERIFY( errorstate == ios_base::failbit );
+ VERIFY( *ret06 == 'u' );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/time_get/get_weekday/char/2.cc b/libstdc++-v3/testsuite/22_locale/time_get/get_weekday/char/2.cc
new file mode 100644
index 000000000..1b1136987
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_get/get_weekday/char/2.cc
@@ -0,0 +1,83 @@
+// { dg-require-namedlocale "en_HK" }
+// { dg-require-namedlocale "de_DE" }
+
+// 2001-09-21 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2009
+// Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 22.2.5.1.1 time_get members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void test02()
+{
+ using namespace std;
+ bool test __attribute__((unused)) = true;
+
+ typedef istreambuf_iterator<char> iterator_type;
+
+ // basic construction and sanity checks.
+ locale loc_c = locale::classic();
+ locale loc_hk = locale("en_HK");
+ locale loc_de = locale("de_DE");
+ VERIFY( loc_hk != loc_c );
+ VERIFY( loc_hk != loc_de );
+
+ const string empty;
+
+ // create an ostream-derived object, cache the time_get facet
+ iterator_type end;
+
+ istringstream iss;
+ const time_get<char>& tim_get = use_facet<time_get<char> >(iss.getloc());
+
+ const ios_base::iostate good = ios_base::goodbit;
+ ios_base::iostate errorstate = good;
+
+ // create "C" time objects
+ const tm time_bday = __gnu_test::test_tm(0, 0, 12, 4, 3, 71, 0, 93, 0);
+
+ // inspection of named locales, de_DE
+ iss.imbue(loc_de);
+ iss.str("Sonntag");
+ iterator_type is_it10(iss);
+ tm time10;
+ errorstate = good;
+ tim_get.get_weekday(is_it10, end, iss, errorstate, &time10);
+ VERIFY( time10.tm_wday == time_bday.tm_wday );
+ VERIFY( errorstate == ios_base::eofbit );
+
+ // inspection of named locales, en_HK
+ iss.imbue(loc_hk);
+ iss.str("Sunday");
+ iterator_type is_it20(iss);
+ tm time20;
+ errorstate = good;
+ tim_get.get_weekday(is_it20, end, iss, errorstate, &time20);
+ VERIFY( time20.tm_wday == time_bday.tm_wday );
+ VERIFY( errorstate == ios_base::eofbit );
+}
+
+int main()
+{
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/time_get/get_weekday/char/3.cc b/libstdc++-v3/testsuite/22_locale/time_get/get_weekday/char/3.cc
new file mode 100644
index 000000000..6e4d188d5
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_get/get_weekday/char/3.cc
@@ -0,0 +1,69 @@
+// 2001-09-21 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2009
+// Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 22.2.5.1.1 time_get members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void test03()
+{
+ using namespace std;
+ bool test __attribute__((unused)) = true;
+
+ // Check time_get works with other iterators besides streambuf
+ // input iterators.
+ typedef string::const_iterator iter_type;
+ typedef time_get<char, iter_type> time_get_type;
+ const ios_base::iostate goodbit = ios_base::goodbit;
+ ios_base::iostate err = goodbit;
+ const locale loc_c = locale::classic();
+
+ // Create "C" time objects
+ const tm time_sanity = __gnu_test::test_tm(0, 0, 12, 26, 5, 97, 2, 0, 0);
+ tm tm1;
+
+ istringstream iss;
+ iss.imbue(locale(loc_c, new time_get_type));
+
+ // Iterator advanced, state, output.
+ const time_get_type& tg = use_facet<time_get_type>(iss.getloc());
+
+ // Cindy Sherman's Untitled Film Stills
+ // June 26-September 2, 1997
+ const string str = "Tuesday September 1997 Cindy Sherman";
+
+ // 03 get_weekday
+ string res3;
+ err = goodbit;
+ // White space is not eaten, so manually increment past it.
+ iter_type end3 = tg.get_weekday(str.begin(), str.end(), iss, err, &tm1);
+ string rem3(end3, str.end());
+ VERIFY( err == goodbit );
+ VERIFY( tm1.tm_wday == time_sanity.tm_wday );
+ VERIFY( rem3 == " September 1997 Cindy Sherman" );
+}
+
+int main()
+{
+ test03();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/time_get/get_weekday/char/38081-1.cc b/libstdc++-v3/testsuite/22_locale/time_get/get_weekday/char/38081-1.cc
new file mode 100644
index 000000000..4e039775a
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_get/get_weekday/char/38081-1.cc
@@ -0,0 +1,94 @@
+// { dg-require-namedlocale "ru_RU.ISO-8859-5" }
+
+// Copyright (C) 2010, 2011 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 22.2.5.1.1 time_get members
+
+#include <locale>
+#include <sstream>
+#include <cstring>
+#include <testsuite_hooks.h>
+
+// libstdc++/38081
+void test01()
+{
+ using namespace std;
+ bool test __attribute__((unused)) = true;
+
+ typedef istreambuf_iterator<char> iterator_type;
+
+ // basic construction
+ locale loc("ru_RU.ISO-8859-5");
+
+ // create an ostream-derived object, cache the time_get facet
+ iterator_type end;
+
+ istringstream iss;
+ iss.imbue(loc);
+ const time_get<char>& tim_get = use_facet<time_get<char> >(iss.getloc());
+
+ const ios_base::iostate good = ios_base::goodbit;
+ ios_base::iostate errorstate = good;
+
+ // iter_type
+ // get_weekday(iter_type, iter_type, ios_base&,
+ // ios_base::iostate&, tm*) const
+
+#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 14)
+ iss.str("\xbf\xdd\x2e");
+#else
+ iss.str("\xbf\xdd\xd4");
+#endif
+ iterator_type is_it01(iss);
+ tm time01;
+ memset(&time01, -1, sizeof(tm));
+ errorstate = good;
+ tim_get.get_weekday(is_it01, end, iss, errorstate, &time01);
+ VERIFY( time01.tm_wday == 1 );
+ VERIFY( errorstate == ios_base::eofbit );
+
+ iss.str("\xbf\xde\xdd\xd5\xd4\xd5\xdb\xec\xdd\xd8\xda");
+ iterator_type is_it02(iss);
+ tm time02;
+ memset(&time02, -1, sizeof(tm));
+ errorstate = good;
+ tim_get.get_weekday(is_it02, end, iss, errorstate, &time02);
+ VERIFY( time02.tm_wday == 1 );
+ VERIFY( errorstate == ios_base::eofbit );
+
+#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 14)
+ iss.str("\xbf\xdd\x2e\xd5\xd4\xd5\xdb\xec\xdd\xd8\xda");
+#else
+ iss.str("\xbf\xdd\xd4\xd5\xd4\xd5\xdb\xec\xdd\xd8\xda");
+#endif
+ iterator_type is_it03(iss);
+ tm time03;
+ memset(&time03, -1, sizeof(tm));
+ errorstate = good;
+ iterator_type ret = tim_get.get_weekday(is_it03, end, iss,
+ errorstate, &time03);
+ VERIFY( time03.tm_wday == 1 );
+ VERIFY( errorstate == ios_base::goodbit );
+ VERIFY( *ret == '\xd5' );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/time_get/get_weekday/char/38081-2.cc b/libstdc++-v3/testsuite/22_locale/time_get/get_weekday/char/38081-2.cc
new file mode 100644
index 000000000..ee8d6769d
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_get/get_weekday/char/38081-2.cc
@@ -0,0 +1,110 @@
+// { dg-require-namedlocale "ru_RU.UTF8" }
+
+// 2010-01-05 Paolo Carlini <paolo.carlini@oracle.com>
+
+// Copyright (C) 2010, 2011 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 22.2.5.1.1 time_get members
+
+#include <locale>
+#include <sstream>
+#include <cstring>
+#include <testsuite_hooks.h>
+
+void test01()
+{
+ using namespace std;
+ bool test __attribute__((unused)) = true;
+
+ typedef istreambuf_iterator<char> iterator_type;
+
+ // basic construction
+ locale loc("ru_RU.UTF8");
+
+ // create an ostream-derived object, cache the time_get facet
+ iterator_type end;
+
+ istringstream iss;
+ iss.imbue(loc);
+ const time_get<char>& tim_get = use_facet<time_get<char> >(iss.getloc());
+
+ const ios_base::iostate good = ios_base::goodbit;
+ ios_base::iostate errorstate = good;
+
+ // iter_type
+ // get_weekday(iter_type, iter_type, ios_base&,
+ // ios_base::iostate&, tm*) const
+
+#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 14)
+ const char* awdays[7] = { "\u0412\u0441\u002E",
+ "\u041F\u043D\u002E",
+ "\u0412\u0442\u002E",
+ "\u0421\u0440\u002E",
+ "\u0427\u0442\u002E",
+ "\u041F\u0442\u002E",
+ "\u0421\u0431\u002E" };
+#else
+ const char* awdays[7] = { "\u0412\u0441\u043A",
+ "\u041F\u043D\u0434",
+ "\u0412\u0442\u0440",
+ "\u0421\u0440\u0434",
+ "\u0427\u0442\u0432",
+ "\u041F\u0442\u043D",
+ "\u0421\u0431\u0442" };
+#endif
+
+ for (int i = 0; i < 7; ++i)
+ {
+ iss.str(awdays[i]);
+ iterator_type is_it01(iss);
+ tm time01;
+ memset(&time01, -1, sizeof(tm));
+ errorstate = good;
+ tim_get.get_weekday(is_it01, end, iss, errorstate, &time01);
+ VERIFY( time01.tm_wday == i );
+ VERIFY( errorstate == ios_base::eofbit );
+ }
+
+ const char* wdays[7] = { "\u0412\u043E\u0441\u043A\u0440\u0435"
+ "\u0441\u0435\u043D\u044C\u0435",
+ "\u041F\u043E\u043D\u0435\u0434\u0435"
+ "\u043B\u044C\u043D\u0438\u043A",
+ "\u0412\u0442\u043E\u0440\u043D\u0438\u043A",
+ "\u0421\u0440\u0435\u0434\u0430",
+ "\u0427\u0435\u0442\u0432\u0435\u0440\u0433",
+ "\u041F\u044F\u0442\u043D\u0438\u0446\u0430",
+ "\u0421\u0443\u0431\u0431\u043E\u0442\u0430" };
+
+ for (int i = 0; i < 7; ++i)
+ {
+ iss.str(wdays[i]);
+ iterator_type is_it01(iss);
+ tm time01;
+ memset(&time01, -1, sizeof(tm));
+ errorstate = good;
+ tim_get.get_weekday(is_it01, end, iss, errorstate, &time01);
+ VERIFY( time01.tm_wday == i );
+ VERIFY( errorstate == ios_base::eofbit );
+ }
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/time_get/get_weekday/char/5.cc b/libstdc++-v3/testsuite/22_locale/time_get/get_weekday/char/5.cc
new file mode 100644
index 000000000..4157a08b5
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_get/get_weekday/char/5.cc
@@ -0,0 +1,67 @@
+// 2006-06-16 Paolo Carlini <pcarlini@suse.de>
+
+// Copyright (C) 2006, 2009, 2010 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 22.2.5.1.1 time_get members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+// Check that the err argument is ignored by get_weekday.
+void test01()
+{
+ using namespace std;
+ bool test __attribute__((unused)) = true;
+
+ typedef string::const_iterator iter_type;
+ typedef time_get<char, iter_type> time_get_type;
+ const ios_base::iostate goodbit = ios_base::goodbit;
+ const ios_base::iostate eofbit = ios_base::eofbit;
+ const ios_base::iostate failbit = ios_base::failbit;
+ ios_base::iostate err = goodbit;
+ const locale loc_c = locale::classic();
+
+ // Create "C" time objects
+ const tm time_sanity = __gnu_test::test_tm(0, 0, 12, 26, 5, 97, 2, 0, 0);
+ tm tm0 = __gnu_test::test_tm(0, 0, 0, 0, 0, 0, 0, 0, 0);
+ tm tm1 = __gnu_test::test_tm(0, 0, 0, 0, 0, 0, 0, 0, 0);
+
+ istringstream iss;
+ iss.imbue(locale(loc_c, new time_get_type));
+
+ // Iterator advanced, state, output.
+ const time_get_type& tg = use_facet<time_get_type>(iss.getloc());
+
+ const string str0 = "T";
+ tg.get_weekday(str0.begin(), str0.end(), iss, err, &tm0);
+ VERIFY( err == (failbit | eofbit) );
+ VERIFY( tm1.tm_wday == 0 );
+
+ const string str1 = "Tuesday ";
+ iter_type end1 = tg.get_weekday(str1.begin(), str1.end(), iss, err, &tm1);
+ VERIFY( err == (failbit | eofbit) );
+ VERIFY( tm1.tm_wday == time_sanity.tm_wday );
+ VERIFY( *end1 == ' ' );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/time_get/get_weekday/char/6.cc b/libstdc++-v3/testsuite/22_locale/time_get/get_weekday/char/6.cc
new file mode 100644
index 000000000..1d28dbf3c
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_get/get_weekday/char/6.cc
@@ -0,0 +1,87 @@
+// 2010-01-05 Paolo Carlini <paolo.carlini@oracle.com>
+
+// Copyright (C) 2010 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 22.2.5.1.1 time_get members
+
+#include <locale>
+#include <sstream>
+#include <cstring>
+#include <testsuite_hooks.h>
+
+void test01()
+{
+ using namespace std;
+ bool test __attribute__((unused)) = true;
+
+ typedef istreambuf_iterator<char> iterator_type;
+
+ // basic construction
+ locale loc_c = locale::classic();
+
+ // create an ostream-derived object, cache the time_get facet
+ iterator_type end;
+
+ istringstream iss;
+ iss.imbue(loc_c);
+ const time_get<char>& tim_get = use_facet<time_get<char> >(iss.getloc());
+
+ const ios_base::iostate good = ios_base::goodbit;
+ ios_base::iostate errorstate = good;
+
+ // iter_type
+ // get_weekday(iter_type, iter_type, ios_base&,
+ // ios_base::iostate&, tm*) const
+
+ // sanity checks for "C" locale
+
+ const char* awdays[7] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" };
+
+ for (int i = 0; i < 7; ++i)
+ {
+ iss.str(awdays[i]);
+ iterator_type is_it01(iss);
+ tm time01;
+ memset(&time01, -1, sizeof(tm));
+ errorstate = good;
+ tim_get.get_weekday(is_it01, end, iss, errorstate, &time01);
+ VERIFY( time01.tm_wday == i );
+ VERIFY( errorstate == ios_base::eofbit );
+ }
+
+ const char* wdays[7] = { "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday",
+ "Friday", "Saturday" };
+
+ for (int i = 0; i < 7; ++i)
+ {
+ iss.str(wdays[i]);
+ iterator_type is_it01(iss);
+ tm time01;
+ memset(&time01, -1, sizeof(tm));
+ errorstate = good;
+ tim_get.get_weekday(is_it01, end, iss, errorstate, &time01);
+ VERIFY( time01.tm_wday == i );
+ VERIFY( errorstate == ios_base::eofbit );
+ }
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/time_get/get_weekday/char/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/time_get/get_weekday/char/wrapped_env.cc
new file mode 100644
index 000000000..8f116717b
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_get/get_weekday/char/wrapped_env.cc
@@ -0,0 +1,48 @@
+// { dg-require-namedlocale "de_DE" }
+// { dg-require-namedlocale "en_HK" }
+
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003, 2005, 2009 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 22.2.4.1.1 collate members
+
+#include <testsuite_hooks.h>
+
+#define main discard_main_1
+#include "1.cc"
+#undef main
+
+#define main discard_main_2
+#include "2.cc"
+#undef main
+
+#define main discard_main_3
+#include "3.cc"
+#undef main
+
+int main()
+{
+ using namespace __gnu_test;
+ func_callback two;
+ two.push_back(&test01);
+ two.push_back(&test02);
+ two.push_back(&test03);
+ run_tests_wrapped_env("de_DE", "LANG", two);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/time_get/get_weekday/char/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/time_get/get_weekday/char/wrapped_locale.cc
new file mode 100644
index 000000000..a4edc45a8
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_get/get_weekday/char/wrapped_locale.cc
@@ -0,0 +1,49 @@
+// { dg-require-namedlocale "ja_JP.eucjp" }
+// { dg-require-namedlocale "de_DE" }
+// { dg-require-namedlocale "en_HK" }
+
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003, 2005, 2009 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 22.2.4.1.1 collate members
+
+#include <testsuite_hooks.h>
+
+#define main discard_main_1
+#include "1.cc"
+#undef main
+
+#define main discard_main_2
+#include "2.cc"
+#undef main
+
+#define main discard_main_3
+#include "3.cc"
+#undef main
+
+int main()
+{
+ using namespace __gnu_test;
+ func_callback two;
+ two.push_back(&test01);
+ two.push_back(&test02);
+ two.push_back(&test03);
+ run_tests_wrapped_locale("ja_JP.eucjp", two);
+ return 0;
+}