]>
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 "ru_RU.UTF8" }
3 // 2010-01-05 Paolo Carlini <paolo.carlini@oracle.com>
5 // Copyright (C) 2010-2013 Free Software Foundation, Inc.
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 #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 14)
54 # if __GLIBC__ > 2 || __GLIBC_MINOR__ >= 17
55 const char* awdays
[7] = { "\u0412\u0441",
63 const char* awdays
[7] = { "\u0412\u0441\u002E",
69 "\u0421\u0431\u002E" };
72 const char* awdays
[7] = { "\u0412\u0441\u043A",
78 "\u0421\u0431\u0442" };
81 for (int i
= 0; i
< 7; ++i
)
84 iterator_type
is_it01(iss
);
86 memset(&time01
, -1, sizeof(tm
));
88 tim_get
.get_weekday(is_it01
, end
, iss
, errorstate
, &time01
);
89 VERIFY( time01
.tm_wday
== i
);
90 VERIFY( errorstate
== ios_base::eofbit
);
93 const char* wdays
[7] = { "\u0412\u043E\u0441\u043A\u0440\u0435"
94 "\u0441\u0435\u043D\u044C\u0435",
95 "\u041F\u043E\u043D\u0435\u0434\u0435"
96 "\u043B\u044C\u043D\u0438\u043A",
97 "\u0412\u0442\u043E\u0440\u043D\u0438\u043A",
98 "\u0421\u0440\u0435\u0434\u0430",
99 "\u0427\u0435\u0442\u0432\u0435\u0440\u0433",
100 "\u041F\u044F\u0442\u043D\u0438\u0446\u0430",
101 "\u0421\u0443\u0431\u0431\u043E\u0442\u0430" };
103 for (int i
= 0; i
< 7; ++i
)
106 iterator_type
is_it01(iss
);
108 memset(&time01
, -1, sizeof(tm
));
110 tim_get
.get_weekday(is_it01
, end
, iss
, errorstate
, &time01
);
111 VERIFY( time01
.tm_wday
== i
);
112 VERIFY( errorstate
== ios_base::eofbit
);