1 //===----------------------------------------------------------------------===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 9 // FILE_DEPENDENCIES: test.dat 10 11 // <fstream> 12 13 // template <class charT, class traits = char_traits<charT> > 14 // class basic_ifstream 15 16 // void close(); 17 18 #include <fstream> 19 #include <cassert> 20 21 #include "test_macros.h" 22 main(int,char **)23int main(int, char**) 24 { 25 { 26 std::ifstream fs; 27 assert(!fs.is_open()); 28 fs.open("test.dat"); 29 assert(fs.is_open()); 30 fs.close(); 31 assert(!fs.is_open()); 32 } 33 { 34 std::wifstream fs; 35 assert(!fs.is_open()); 36 fs.open("test.dat"); 37 assert(fs.is_open()); 38 fs.close(); 39 assert(!fs.is_open()); 40 } 41 42 return 0; 43 } 44