]> git.ipfire.org Git - thirdparty/gcc.git/blame - libstdc++-v3/testsuite/27_io/basic_ifstream/open/wchar_t/1.cc
Update copyright years.
[thirdparty/gcc.git] / libstdc++-v3 / testsuite / 27_io / basic_ifstream / open / wchar_t / 1.cc
CommitLineData
a945c346 1// Copyright (C) 2018-2024 Free Software Foundation, Inc.
b0292359
JW
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// 30.9.3.1 basic_ifstream constructors [ifstream.cons]
19
20// { dg-do run { target *-*-mingw* } }
6cec3c81 21// { dg-require-fileio "" }
b0292359
JW
22
23#include <fstream>
24#include <testsuite_hooks.h>
25
26const wchar_t name_01[] = L"ifstream_members-1.tst";
27
28void test01()
29{
30 std::ifstream ifs1;
31 ifs1.close();
32
33 VERIFY( !ifs1.is_open() );
34 VERIFY( !(ifs1) );
35
36 ifs1.open(name_01);
37 VERIFY( ifs1.is_open() );
38
39 VERIFY( (ifs1) );
40 VERIFY( ifs1.rdstate() == std::ios_base::goodbit );
41
42 ifs1.close();
43}
44
45void test02()
46{
47 std::wifstream wifs1;
48 wifs1.open(name_01, std::wios::in);
49 VERIFY( wifs1.is_open() );
50
51 VERIFY( (wifs1) );
52 VERIFY( wifs1.rdstate() == std::ios_base::goodbit );
53}
54
55int main()
56{
57 test01();
58 test02();
59}