]> git.ipfire.org Git - thirdparty/gcc.git/blame - libstdc++-v3/testsuite/27_io/basic_filebuf/open/char/4.cc
Update copyright years.
[thirdparty/gcc.git] / libstdc++-v3 / testsuite / 27_io / basic_filebuf / open / char / 4.cc
CommitLineData
bc8b35b5
PC
1// 2006-10-01 Paolo Carlini <pcarlini@suse.de>
2
83ffe9cd 3// Copyright (C) 2006-2023 Free Software Foundation, Inc.
bc8b35b5
PC
4//
5// This file is part of the GNU ISO C++ Library. This library is free
6// software; you can redistribute it and/or modify it under the
7// terms of the GNU General Public License as published by the
748086b7 8// Free Software Foundation; either version 3, or (at your option)
bc8b35b5
PC
9// any later version.
10
11// This library is distributed in the hope that it will be useful,
12// but WITHOUT ANY WARRANTY; without even the implied warranty of
13// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14// GNU General Public License for more details.
15
16// You should have received a copy of the GNU General Public License along
748086b7
JJ
17// with this library; see the file COPYING3. If not see
18// <http://www.gnu.org/licenses/>.
bc8b35b5 19
eb0619fe
DJ
20// { dg-require-fileio "" }
21
bc8b35b5
PC
22#include <fstream>
23#include <testsuite_hooks.h>
24
ec01f292 25// DR 596.
bc8b35b5
PC
26void test01()
27{
bc8b35b5
PC
28 const char* name = "tmp_file4";
29
30 std::fstream scratch_file;
31
ec01f292
PC
32 scratch_file.open(name, std::ios_base::app);
33 VERIFY( scratch_file );
34 VERIFY( scratch_file.is_open() );
35 scratch_file.close();
36
bc8b35b5
PC
37 scratch_file.open(name, std::ios_base::in | std::ios_base::out
38 | std::ios_base::app);
39 VERIFY( scratch_file );
40 VERIFY( scratch_file.is_open() );
41 scratch_file.close();
42
ec01f292
PC
43 scratch_file.open(name, std::ios_base::in | std::ios_base::app);
44 VERIFY( scratch_file );
45 VERIFY( scratch_file.is_open() );
46 scratch_file.close();
47
48 scratch_file.open(name, std::ios_base::app | std::ios_base::binary);
49 VERIFY( scratch_file );
50 VERIFY( scratch_file.is_open() );
51 scratch_file.close();
52
bc8b35b5
PC
53 scratch_file.open(name, std::ios_base::in | std::ios_base::out
54 | std::ios_base::app | std::ios_base::binary);
55 VERIFY( scratch_file );
56 VERIFY( scratch_file.is_open() );
57 scratch_file.close();
ec01f292
PC
58
59 scratch_file.open(name, std::ios_base::in | std::ios_base::app
60 | std::ios_base::binary);
61 VERIFY( scratch_file );
62 VERIFY( scratch_file.is_open() );
63 scratch_file.close();
bc8b35b5
PC
64}
65
66int
67main()
68{
69 test01();
70 return 0;
71}