]> git.ipfire.org Git - thirdparty/gcc.git/blame - libstdc++-v3/testsuite/27_io/basic_ios/copyfmt/char/2.cc
Update copyright years in libstdc++-v3/
[thirdparty/gcc.git] / libstdc++-v3 / testsuite / 27_io / basic_ios / copyfmt / char / 2.cc
CommitLineData
9c69a458 1// { dg-require-namedlocale "de_DE" }
f63a8495 2
b2dad0e3
BK
3// 1999-09-20 bkoz
4
aa118a03 5// Copyright (C) 1999-2014 Free Software Foundation, Inc.
b2dad0e3
BK
6//
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
748086b7 10// Free Software Foundation; either version 3, or (at your option)
b2dad0e3
BK
11// any later version.
12
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.
17
18// You should have received a copy of the GNU General Public License along
748086b7
JJ
19// with this library; see the file COPYING3. If not see
20// <http://www.gnu.org/licenses/>.
b2dad0e3 21
b2dad0e3 22
23cac885 23// 27.4.4.2 basic_ios member functions
b2dad0e3 24
23cac885
BK
25// NB: Don't include any other headers in this file.
26#include <ios>
f13a69ec 27#include <testsuite_hooks.h>
b2dad0e3 28
23cac885
BK
29// copyfmt and locales.
30void test03()
bcc6a03a 31{
11f10e6b 32 bool test __attribute__((unused)) = true;
bcc6a03a 33
b2dad0e3 34 using namespace std;
23cac885
BK
35
36 typedef std::ios_base::fmtflags fmtflags;
37 typedef std::ios_base::iostate iostate;
38 locale loc_c = locale::classic();
f63a8495 39 locale loc_de = locale("de_DE");
8fc81078
PC
40 std::ios ios_01(0);
41 std::ios ios_02(0);
23cac885
BK
42 ios_01.imbue(loc_c);
43 ios_02.imbue(loc_de);
44 ios_02.setstate(ios_base::badbit);
45 VERIFY( loc_c == ios_01.getloc() );
46 VERIFY( loc_de == ios_02.getloc() );
47
48 iostate ios1 = ios_01.rdstate();
49 iostate ios2 = ios_02.rdstate();
50 streambuf* sb1 = ios_01.rdbuf();
51 streambuf* sb2 = ios_02.rdbuf();
52 ios_01.copyfmt(ios_02);
53
54 VERIFY( loc_de == ios_01.getloc() );
55 VERIFY( ios_01.getloc() == ios_02.getloc() );
56 VERIFY( ios1 == ios_01.rdstate() );
57 VERIFY( ios2 == ios_02.rdstate() );
58 VERIFY( sb1 == ios_01.rdbuf() );
59 VERIFY( sb2 == ios_02.rdbuf() );
60}
b2dad0e3 61
e6705174
BK
62int main()
63{
3d838e28 64 test03();
b2dad0e3
BK
65 return 0;
66}