From 5a83710e371fe68a06e6e3876c6a2c8b820a8976 Mon Sep 17 00:00:00 2001 From: Eric Fiselier Date: Sat, 20 Dec 2014 01:40:03 +0000 Subject: Move test into test/std subdirectory. llvm-svn: 224658 --- .../fstreams/fstream.members/open_string.pass.cpp | 50 ++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 libcxx/test/std/input.output/file.streams/fstreams/fstream.members/open_string.pass.cpp (limited to 'libcxx/test/std/input.output/file.streams/fstreams/fstream.members/open_string.pass.cpp') diff --git a/libcxx/test/std/input.output/file.streams/fstreams/fstream.members/open_string.pass.cpp b/libcxx/test/std/input.output/file.streams/fstreams/fstream.members/open_string.pass.cpp new file mode 100644 index 00000000000..182f12c47d1 --- /dev/null +++ b/libcxx/test/std/input.output/file.streams/fstreams/fstream.members/open_string.pass.cpp @@ -0,0 +1,50 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// template > +// class basic_fstream + +// void open(const string& s, ios_base::openmode mode = ios_base::in|ios_base::out); + +#include +#include +#include "platform_support.h" + +int main() +{ + std::string temp = get_temp_file_name(); + { + std::fstream fs; + assert(!fs.is_open()); + fs.open(temp, std::ios_base::in | std::ios_base::out + | std::ios_base::trunc); + assert(fs.is_open()); + double x = 0; + fs << 3.25; + fs.seekg(0); + fs >> x; + assert(x == 3.25); + } + std::remove(temp.c_str()); + { + std::wfstream fs; + assert(!fs.is_open()); + fs.open(temp, std::ios_base::in | std::ios_base::out + | std::ios_base::trunc); + assert(fs.is_open()); + double x = 0; + fs << 3.25; + fs.seekg(0); + fs >> x; + assert(x == 3.25); + } + std::remove(temp.c_str()); +} -- cgit v1.2.3