]>
git.ipfire.org Git - thirdparty/gcc.git/blob - libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/char/1.cc
4 // Copyright (C) 1999, 2000, 2001, 2002, 2003, 2009, 2010
5 // 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 // 27.6.2.5.4 basic_ostream character inserters
23 // @require@ %-*.tst %-*.txt
24 // @diff@ %-*.tst %-*.txt
26 // { dg-require-fileio "" }
31 #include <testsuite_hooks.h>
33 const int size
= 1000;
34 const char name_01
[] = "ostream_inserter_other-1.tst";
35 const char name_02
[] = "ostream_inserter_other-1.txt";
36 const char name_03
[] = "ostream_inserter_other-2.tst";
37 const char name_04
[] = "ostream_inserter_other-2.txt";
43 typedef std::ios_base::iostate iostate
;
44 bool test
__attribute__((unused
)) = true;
46 // basic_ostream<_CharT, _Traits>::operator<<(__streambuf_type* __sb)
48 std::ifstream
f_in1(name_01
);
49 std::ofstream
f_out1(name_02
);
50 std::stringbuf
* strbuf01
= 0;
51 iostate state01
= f_in1
.rdstate();
53 iostate state02
= f_in1
.rdstate();
54 VERIFY( state01
!= state02
);
55 VERIFY( (state02
& std::ios_base::failbit
) != 0 );
56 state01
= f_out1
.rdstate();
58 state02
= f_out1
.rdstate();
59 VERIFY( state01
!= state02
);
60 VERIFY( (state02
& std::ios_base::badbit
) != 0 );
63 std::ifstream
f_in(name_01
);
64 std::ofstream
f_out(name_02
);
65 f_out
<< f_in
.rdbuf();
69 // filebuf->stringbuf->filebuf
70 std::ifstream
f_in2(name_03
);
71 std::ofstream
f_out2(name_04
); // should be different name
72 std::stringbuf strbuf02
;