move_assign.pass.cpp revision f5256e16dfc425c1d466f6308d4026d529ce9e0b
1//===----------------------------------------------------------------------===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// 9 10// <fstream> 11 12// template <class charT, class traits = char_traits<charT> > 13// class basic_ofstream 14 15// basic_ofstream& operator=(basic_ofstream&& rhs); 16 17#include <fstream> 18#include <cassert> 19 20int main() 21{ 22#ifdef _LIBCPP_MOVE 23 { 24 std::ofstream fso("test.dat"); 25 std::ofstream fs; 26 fs = move(fso); 27 fs << 3.25; 28 } 29 { 30 std::ifstream fs("test.dat"); 31 double x = 0; 32 fs >> x; 33 assert(x == 3.25); 34 } 35 remove("test.dat"); 36 { 37 std::wofstream fso("test.dat"); 38 std::wofstream fs; 39 fs = move(fso); 40 fs << 3.25; 41 } 42 { 43 std::wifstream fs("test.dat"); 44 double x = 0; 45 fs >> x; 46 assert(x == 3.25); 47 } 48 remove("test.dat"); 49#endif 50} 51