]> git.ipfire.org Git - thirdparty/gcc.git/blob - 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
1 // 2006-10-01 Paolo Carlini <pcarlini@suse.de>
2
3 // Copyright (C) 2006-2017 Free Software Foundation, Inc.
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
8 // Free Software Foundation; either version 3, or (at your option)
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
17 // with this library; see the file COPYING3. If not see
18 // <http://www.gnu.org/licenses/>.
19
20 // { dg-require-fileio "" }
21
22 #include <fstream>
23 #include <testsuite_hooks.h>
24
25 // DR 596.
26 void test01()
27 {
28 const char* name = "tmp_file4";
29
30 std::fstream scratch_file;
31
32 scratch_file.open(name, std::ios_base::app);
33 VERIFY( scratch_file );
34 VERIFY( scratch_file.is_open() );
35 scratch_file.close();
36
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
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
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();
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();
64 }
65
66 int
67 main()
68 {
69 test01();
70 return 0;
71 }