]>
git.ipfire.org Git - thirdparty/gcc.git/blob - libstdc++-v3/testsuite/27_io/basic_fstream/assign/1.cc
595a1906cc1940616aba50195d3a83020032e274
1 // Copyright (C) 2014-2023 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 // { dg-do run { target c++11 } }
19 // { dg-require-fileio "" }
21 // 27.9.1.16 Assign and swap [fstream.assign]
25 #include <testsuite_hooks.h>
29 string
const name
= "fstream-assign.txt";
34 string orig
= "Let the whole outside world consist of a long paper tape.";
36 fstream
f(name
, ios::in
|ios::out
|ios::trunc
);
37 VERIFY( f
.is_open() );
41 VERIFY( f1
.is_open() );
42 VERIFY( !f
.is_open() );
46 VERIFY( result
== orig
);
49 fstream
f(name
, ios::in
);
50 VERIFY( f
.is_open() );
53 VERIFY( f1
.is_open() );
54 VERIFY( !f
.is_open() );
57 VERIFY( result
== orig
);
60 fstream
f(name
, ios::in
);
61 VERIFY( f
.is_open() );
64 VERIFY( f1
.is_open() );
65 VERIFY( !f
.is_open() );
68 VERIFY( result
== orig
);
75 #ifdef _GLIBCXX_USE_WCHAR_T