Debian Codegraph @

libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/wchar_t/2.cc

raw
1 // Copyright (C) 2004-2025 Free Software Foundation, Inc.
2 //
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)
7 // any later version.
8
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.
13
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/>.
17
18 // C++98 27.6.1.2.3 basic_istream::operator>>
19
20 // { dg-require-fileio "" }
21 // { dg-additional-files "wistream_extractor_other-1.tst" }
22 // { dg-additional-files "wistream_extractor_other-1.txt" }
23 // { dg-additional-files "wistream_extractor_other-2.tst" }
24 // { dg-final { file-io-diff "wistream_extractor_other-1" } }
25 // { dg-final { file-io-diff "wistream_extractor_other-2" } }
26
27 #include <istream>
28 #include <fstream>
29 #include <testsuite_hooks.h>
30
31 // filebufs.
32 void test02()
33 {
34 const char name_01[] = "wistream_extractor_other-1.txt"; //read
35 const char name_02[] = "wistream_extractor_other-2.txt"; //write
36
37 std::wfilebuf fbin, fbout;
38 fbin.open(name_01, std::ios_base::in);
39 fbout.open(name_02, std::ios_base::out | std::ios_base::trunc);
40 VERIFY( fbin.is_open() );
41 VERIFY( fbout.is_open() );
42
43 {
44 std::wistream is(&fbin);
45 is.unsetf(std::ios_base::skipws);
46 is >> &fbout;
47 }
48
49 fbout.close();
50 fbin.close();
51 VERIFY( !fbin.is_open() );
52 VERIFY( !fbout.is_open() );
53 }
54
55 int main()
56 {
57 test02();
58 return 0;
59 }