]>
git.ipfire.org Git - thirdparty/gcc.git/blob - libstdc++-v3/testsuite/22_locale/time_get/get_weekday/char/38081-2.cc
1 // { dg-require-namedlocale "" }
3 // 2010-01-05 Paolo Carlini <paolo.carlini@oracle.com>
5 // Copyright (C) 2010 Free Software Foundation
7 // This file is part of the GNU ISO C++ Library. This library is free
8 // software; you can redistribute it and/or modify it under the
9 // terms of the GNU General Public License as published by the
10 // Free Software Foundation; either version 3, or (at your option)
13 // This library is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 // GNU General Public License for more details.
18 // You should have received a copy of the GNU General Public License along
19 // with this library; see the file COPYING3. If not see
20 // <http://www.gnu.org/licenses/>.
22 // 22.2.5.1.1 time_get members
27 #include <testsuite_hooks.h>
32 bool test
__attribute__((unused
)) = true;
34 typedef istreambuf_iterator
<char> iterator_type
;
37 locale
loc("ru_RU.UTF8");
39 // create an ostream-derived object, cache the time_get facet
44 const time_get
<char>& tim_get
= use_facet
<time_get
<char> >(iss
.getloc());
46 const ios_base::iostate good
= ios_base::goodbit
;
47 ios_base::iostate errorstate
= good
;
50 // get_weekday(iter_type, iter_type, ios_base&,
51 // ios_base::iostate&, tm*) const
53 const char* awdays
[7] = { "\u0412\u0441\u043A",
59 "\u0421\u0431\u0442" };
61 for (int i
= 0; i
< 7; ++i
)
64 iterator_type
is_it01(iss
);
66 memset(&time01
, -1, sizeof(tm
));
68 tim_get
.get_weekday(is_it01
, end
, iss
, errorstate
, &time01
);
69 VERIFY( time01
.tm_wday
== i
);
70 VERIFY( errorstate
== ios_base::eofbit
);
73 const char* wdays
[7] = { "\u0412\u043E\u0441\u043A\u0440\u0435"
74 "\u0441\u0435\u043D\u044C\u0435",
75 "\u041F\u043E\u043D\u0435\u0434\u0435"
76 "\u043B\u044C\u043D\u0438\u043A",
77 "\u0412\u0442\u043E\u0440\u043D\u0438\u043A",
78 "\u0421\u0440\u0435\u0434\u0430",
79 "\u0427\u0435\u0442\u0432\u0435\u0440\u0433",
80 "\u041F\u044F\u0442\u043D\u0438\u0446\u0430",
81 "\u0421\u0443\u0431\u0431\u043E\u0442\u0430" };
83 for (int i
= 0; i
< 7; ++i
)
86 iterator_type
is_it01(iss
);
88 memset(&time01
, -1, sizeof(tm
));
90 tim_get
.get_weekday(is_it01
, end
, iss
, errorstate
, &time01
);
91 VERIFY( time01
.tm_wday
== i
);
92 VERIFY( errorstate
== ios_base::eofbit
);