1 // { dg-require-namedlocale "en_HK" }
2 // { dg-require-namedlocale "de_DE" }
4 // 2001-09-21 Benjamin Kosnik <bkoz@redhat.com>
6 // Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2009
7 // Free Software Foundation
9 // This file is part of the GNU ISO C++ Library. This library is free
10 // software; you can redistribute it and/or modify it under the
11 // terms of the GNU General Public License as published by the
12 // Free Software Foundation; either version 3, or (at your option)
15 // This library is distributed in the hope that it will be useful,
16 // but WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 // GNU General Public License for more details.
20 // You should have received a copy of the GNU General Public License along
21 // with this library; see the file COPYING3. If not see
22 // <http://www.gnu.org/licenses/>.
24 // 22.2.5.1.1 time_get members
28 #include <testsuite_hooks.h>
33 bool test
__attribute__((unused
)) = true;
35 typedef istreambuf_iterator
<char> iterator_type
;
37 // basic construction and sanity checks.
38 locale loc_c
= locale::classic();
39 locale loc_hk
= locale("en_HK");
40 locale loc_de
= locale("de_DE");
41 VERIFY( loc_hk
!= loc_c
);
42 VERIFY( loc_hk
!= loc_de
);
46 // create an ostream-derived object, cache the time_get facet
50 const time_get
<char>& tim_get
= use_facet
<time_get
<char> >(iss
.getloc());
52 const ios_base::iostate good
= ios_base::goodbit
;
53 ios_base::iostate errorstate
= good
;
55 // create "C" time objects
56 const tm time_bday
= __gnu_test::test_tm(0, 0, 12, 4, 3, 71, 0, 93, 0);
58 // inspection of named locales, de_DE
61 iterator_type
is_it10(iss
);
64 tim_get
.get_weekday(is_it10
, end
, iss
, errorstate
, &time10
);
65 VERIFY( time10
.tm_wday
== time_bday
.tm_wday
);
66 VERIFY( errorstate
== ios_base::eofbit
);
68 // inspection of named locales, en_HK
71 iterator_type
is_it20(iss
);
74 tim_get
.get_weekday(is_it20
, end
, iss
, errorstate
, &time20
);
75 VERIFY( time20
.tm_wday
== time_bday
.tm_wday
);
76 VERIFY( errorstate
== ios_base::eofbit
);