]>
git.ipfire.org Git - thirdparty/gcc.git/blob - libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/wchar_t/1.cc
1 // Copyright (C) 2005-2018 Free Software Foundation, Inc.
3 // This file is part of the GNU ISO C++ Library. This library is free
4 // software; you can redistribute it and/or modify it under the
5 // terms of the GNU General Public License as published by the
6 // Free Software Foundation; either version 3, or (at your option)
9 // This library is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
14 // You should have received a copy of the GNU General Public License along
15 // with this library; see the file COPYING3. If not see
16 // <http://www.gnu.org/licenses/>.
18 // 27.6.2.5.4 basic_ostream character inserters
19 // @require@ %-*.tst %-*.txt
20 // @diff@ %-*.tst %-*.txt
22 // { dg-require-fileio "" }
27 #include <testsuite_hooks.h>
29 const int size
= 1000;
30 const char name_01
[] = "wostream_inserter_other-1.tst";
31 const char name_02
[] = "wostream_inserter_other-1.txt";
32 const char name_03
[] = "wostream_inserter_other-2.tst";
33 const char name_04
[] = "wostream_inserter_other-2.txt";
39 typedef std::ios_base::iostate iostate
;
41 // basic_ostream<_CharT, _Traits>::operator<<(__streambuf_type* __sb)
43 std::wifstream
f_in1(name_01
);
44 std::wofstream
f_out1(name_02
);
45 std::wstringbuf
* strbuf01
= 0;
46 iostate state01
= f_in1
.rdstate();
48 iostate state02
= f_in1
.rdstate();
49 VERIFY( state01
!= state02
);
50 VERIFY( (state02
& std::ios_base::failbit
) != 0 );
51 state01
= f_out1
.rdstate();
53 state02
= f_out1
.rdstate();
54 VERIFY( state01
!= state02
);
55 VERIFY( (state02
& std::ios_base::badbit
) != 0 );
58 std::wifstream
f_in(name_01
);
59 std::wofstream
f_out(name_02
);
60 f_out
<< f_in
.rdbuf();
64 // filebuf->stringbuf->filebuf
65 std::wifstream
f_in2(name_03
);
66 std::wofstream
f_out2(name_04
); // should be different name
67 std::wstringbuf strbuf02
;