[cfe-commits] [libcxx] r135444 - in /libcxx/trunk/test/input.output/file.streams/fstreams: filebuf.assign/ filebuf.cons/ filebuf.members/ fstream.assign/ fstream.cons/ fstream.members/ ofstream.assign/ ofstream.cons/ ofstream.members/
Sean Hunt
scshunt at csclub.uwaterloo.ca
Mon Jul 18 16:51:21 PDT 2011
Author: coppro
Date: Mon Jul 18 18:51:21 2011
New Revision: 135444
URL: http://llvm.org/viewvc/llvm-project?rev=135444&view=rev
Log:
Make all fstream tests use tmpnam if creating files, rather than
hard-coded names.
Modified:
libcxx/trunk/test/input.output/file.streams/fstreams/filebuf.assign/member_swap.pass.cpp
libcxx/trunk/test/input.output/file.streams/fstreams/filebuf.assign/move_assign.pass.cpp
libcxx/trunk/test/input.output/file.streams/fstreams/filebuf.assign/nonmember_swap.pass.cpp
libcxx/trunk/test/input.output/file.streams/fstreams/filebuf.cons/move.pass.cpp
libcxx/trunk/test/input.output/file.streams/fstreams/filebuf.members/open_pointer.pass.cpp
libcxx/trunk/test/input.output/file.streams/fstreams/fstream.assign/member_swap.pass.cpp
libcxx/trunk/test/input.output/file.streams/fstreams/fstream.assign/move_assign.pass.cpp
libcxx/trunk/test/input.output/file.streams/fstreams/fstream.assign/nonmember_swap.pass.cpp
libcxx/trunk/test/input.output/file.streams/fstreams/fstream.cons/move.pass.cpp
libcxx/trunk/test/input.output/file.streams/fstreams/fstream.cons/pointer.pass.cpp
libcxx/trunk/test/input.output/file.streams/fstreams/fstream.cons/string.pass.cpp
libcxx/trunk/test/input.output/file.streams/fstreams/fstream.members/close.pass.cpp
libcxx/trunk/test/input.output/file.streams/fstreams/fstream.members/open_pointer.pass.cpp
libcxx/trunk/test/input.output/file.streams/fstreams/fstream.members/open_string.pass.cpp
libcxx/trunk/test/input.output/file.streams/fstreams/ofstream.assign/member_swap.pass.cpp
libcxx/trunk/test/input.output/file.streams/fstreams/ofstream.assign/move_assign.pass.cpp
libcxx/trunk/test/input.output/file.streams/fstreams/ofstream.assign/nonmember_swap.pass.cpp
libcxx/trunk/test/input.output/file.streams/fstreams/ofstream.cons/move.pass.cpp
libcxx/trunk/test/input.output/file.streams/fstreams/ofstream.cons/pointer.pass.cpp
libcxx/trunk/test/input.output/file.streams/fstreams/ofstream.cons/string.pass.cpp
libcxx/trunk/test/input.output/file.streams/fstreams/ofstream.members/close.pass.cpp
libcxx/trunk/test/input.output/file.streams/fstreams/ofstream.members/open_pointer.pass.cpp
libcxx/trunk/test/input.output/file.streams/fstreams/ofstream.members/open_string.pass.cpp
libcxx/trunk/test/input.output/file.streams/fstreams/ofstream.members/rdbuf.pass.cpp
Modified: libcxx/trunk/test/input.output/file.streams/fstreams/filebuf.assign/member_swap.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/input.output/file.streams/fstreams/filebuf.assign/member_swap.pass.cpp?rev=135444&r1=135443&r2=135444&view=diff
==============================================================================
--- libcxx/trunk/test/input.output/file.streams/fstreams/filebuf.assign/member_swap.pass.cpp (original)
+++ libcxx/trunk/test/input.output/file.streams/fstreams/filebuf.assign/member_swap.pass.cpp Mon Jul 18 18:51:21 2011
@@ -19,10 +19,12 @@
int main()
{
+ char temp[L_tmpnam];
+ tmpnam(temp);
{
std::filebuf f;
- assert(f.open("test.dat", std::ios_base::out | std::ios_base::in
- | std::ios_base::trunc) != 0);
+ assert(f.open(temp, std::ios_base::out | std::ios_base::in
+ | std::ios_base::trunc) != 0);
assert(f.is_open());
assert(f.sputn("123", 3) == 3);
f.pubseekoff(1, std::ios_base::beg);
@@ -33,11 +35,11 @@
assert(f2.is_open());
assert(f2.sgetc() == '2');
}
- remove("test.dat");
+ remove(temp);
{
std::wfilebuf f;
- assert(f.open("test.dat", std::ios_base::out | std::ios_base::in
- | std::ios_base::trunc) != 0);
+ assert(f.open(temp, std::ios_base::out | std::ios_base::in
+ | std::ios_base::trunc) != 0);
assert(f.is_open());
assert(f.sputn(L"123", 3) == 3);
f.pubseekoff(1, std::ios_base::beg);
@@ -48,5 +50,5 @@
assert(f2.is_open());
assert(f2.sgetc() == L'2');
}
- remove("test.dat");
+ remove(temp);
}
Modified: libcxx/trunk/test/input.output/file.streams/fstreams/filebuf.assign/move_assign.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/input.output/file.streams/fstreams/filebuf.assign/move_assign.pass.cpp?rev=135444&r1=135443&r2=135444&view=diff
==============================================================================
--- libcxx/trunk/test/input.output/file.streams/fstreams/filebuf.assign/move_assign.pass.cpp (original)
+++ libcxx/trunk/test/input.output/file.streams/fstreams/filebuf.assign/move_assign.pass.cpp Mon Jul 18 18:51:21 2011
@@ -20,10 +20,12 @@
int main()
{
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ char temp[L_tmpnam];
+ tmpnam(temp);
{
std::filebuf f;
- assert(f.open("test.dat", std::ios_base::out | std::ios_base::in
- | std::ios_base::trunc) != 0);
+ assert(f.open(temp, std::ios_base::out | std::ios_base::in
+ | std::ios_base::trunc) != 0);
assert(f.is_open());
assert(f.sputn("123", 3) == 3);
f.pubseekoff(1, std::ios_base::beg);
@@ -34,11 +36,11 @@
assert(f2.is_open());
assert(f2.sgetc() == '2');
}
- remove("test.dat");
+ remove(temp);
{
std::wfilebuf f;
- assert(f.open("test.dat", std::ios_base::out | std::ios_base::in
- | std::ios_base::trunc) != 0);
+ assert(f.open(temp, std::ios_base::out | std::ios_base::in
+ | std::ios_base::trunc) != 0);
assert(f.is_open());
assert(f.sputn(L"123", 3) == 3);
f.pubseekoff(1, std::ios_base::beg);
@@ -49,6 +51,6 @@
assert(f2.is_open());
assert(f2.sgetc() == L'2');
}
- remove("test.dat");
+ remove(temp);
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
Modified: libcxx/trunk/test/input.output/file.streams/fstreams/filebuf.assign/nonmember_swap.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/input.output/file.streams/fstreams/filebuf.assign/nonmember_swap.pass.cpp?rev=135444&r1=135443&r2=135444&view=diff
==============================================================================
--- libcxx/trunk/test/input.output/file.streams/fstreams/filebuf.assign/nonmember_swap.pass.cpp (original)
+++ libcxx/trunk/test/input.output/file.streams/fstreams/filebuf.assign/nonmember_swap.pass.cpp Mon Jul 18 18:51:21 2011
@@ -21,10 +21,12 @@
int main()
{
+ char temp[L_tmpnam];
+ tmpnam(temp);
{
std::filebuf f;
- assert(f.open("test.dat", std::ios_base::out | std::ios_base::in
- | std::ios_base::trunc) != 0);
+ assert(f.open(temp, std::ios_base::out | std::ios_base::in
+ | std::ios_base::trunc) != 0);
assert(f.is_open());
assert(f.sputn("123", 3) == 3);
f.pubseekoff(1, std::ios_base::beg);
@@ -35,11 +37,11 @@
assert(f2.is_open());
assert(f2.sgetc() == '2');
}
- remove("test.dat");
+ remove(temp);
{
std::wfilebuf f;
- assert(f.open("test.dat", std::ios_base::out | std::ios_base::in
- | std::ios_base::trunc) != 0);
+ assert(f.open(temp, std::ios_base::out | std::ios_base::in
+ | std::ios_base::trunc) != 0);
assert(f.is_open());
assert(f.sputn(L"123", 3) == 3);
f.pubseekoff(1, std::ios_base::beg);
@@ -50,5 +52,5 @@
assert(f2.is_open());
assert(f2.sgetc() == L'2');
}
- remove("test.dat");
+ remove(temp);
}
Modified: libcxx/trunk/test/input.output/file.streams/fstreams/filebuf.cons/move.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/input.output/file.streams/fstreams/filebuf.cons/move.pass.cpp?rev=135444&r1=135443&r2=135444&view=diff
==============================================================================
--- libcxx/trunk/test/input.output/file.streams/fstreams/filebuf.cons/move.pass.cpp (original)
+++ libcxx/trunk/test/input.output/file.streams/fstreams/filebuf.cons/move.pass.cpp Mon Jul 18 18:51:21 2011
@@ -20,10 +20,12 @@
int main()
{
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ char temp[L_tmpnam];
+ tmpnam(temp);
{
std::filebuf f;
- assert(f.open("test.dat", std::ios_base::out | std::ios_base::in
- | std::ios_base::trunc) != 0);
+ assert(f.open(temp, std::ios_base::out | std::ios_base::in
+ | std::ios_base::trunc) != 0);
assert(f.is_open());
assert(f.sputn("123", 3) == 3);
f.pubseekoff(1, std::ios_base::beg);
@@ -33,11 +35,11 @@
assert(f2.is_open());
assert(f2.sgetc() == '2');
}
- remove("test.dat");
+ remove(temp);
{
std::wfilebuf f;
- assert(f.open("test.dat", std::ios_base::out | std::ios_base::in
- | std::ios_base::trunc) != 0);
+ assert(f.open(temp, std::ios_base::out | std::ios_base::in
+ | std::ios_base::trunc) != 0);
assert(f.is_open());
assert(f.sputn(L"123", 3) == 3);
f.pubseekoff(1, std::ios_base::beg);
@@ -47,6 +49,6 @@
assert(f2.is_open());
assert(f2.sgetc() == L'2');
}
- remove("test.dat");
+ remove(temp);
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
Modified: libcxx/trunk/test/input.output/file.streams/fstreams/filebuf.members/open_pointer.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/input.output/file.streams/fstreams/filebuf.members/open_pointer.pass.cpp?rev=135444&r1=135443&r2=135444&view=diff
==============================================================================
--- libcxx/trunk/test/input.output/file.streams/fstreams/filebuf.members/open_pointer.pass.cpp (original)
+++ libcxx/trunk/test/input.output/file.streams/fstreams/filebuf.members/open_pointer.pass.cpp Mon Jul 18 18:51:21 2011
@@ -16,34 +16,36 @@
int main()
{
+ char temp[L_tmpnam];
+ tmpnam(temp);
{
std::filebuf f;
- assert(f.open("test.dat", std::ios_base::out) != 0);
+ assert(f.open(temp, std::ios_base::out) != 0);
assert(f.is_open());
assert(f.sputn("123", 3) == 3);
}
{
std::filebuf f;
- assert(f.open("test.dat", std::ios_base::in) != 0);
+ assert(f.open(temp, std::ios_base::in) != 0);
assert(f.is_open());
assert(f.sbumpc() == '1');
assert(f.sbumpc() == '2');
assert(f.sbumpc() == '3');
}
- remove("test.dat");
+ remove(temp);
{
std::wfilebuf f;
- assert(f.open("test.dat", std::ios_base::out) != 0);
+ assert(f.open(temp, std::ios_base::out) != 0);
assert(f.is_open());
assert(f.sputn(L"123", 3) == 3);
}
{
std::wfilebuf f;
- assert(f.open("test.dat", std::ios_base::in) != 0);
+ assert(f.open(temp, std::ios_base::in) != 0);
assert(f.is_open());
assert(f.sbumpc() == L'1');
assert(f.sbumpc() == L'2');
assert(f.sbumpc() == L'3');
}
- remove("test.dat");
+ remove(temp);
}
Modified: libcxx/trunk/test/input.output/file.streams/fstreams/fstream.assign/member_swap.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/input.output/file.streams/fstreams/fstream.assign/member_swap.pass.cpp?rev=135444&r1=135443&r2=135444&view=diff
==============================================================================
--- libcxx/trunk/test/input.output/file.streams/fstreams/fstream.assign/member_swap.pass.cpp (original)
+++ libcxx/trunk/test/input.output/file.streams/fstreams/fstream.assign/member_swap.pass.cpp Mon Jul 18 18:51:21 2011
@@ -19,11 +19,14 @@
int main()
{
+ char temp1[L_tmpnam], temp2[L_tmpnam];
+ tmpnam(temp1);
+ tmpnam(temp2);
{
- std::fstream fs1("test1.dat", std::ios_base::in | std::ios_base::out
- | std::ios_base::trunc);
- std::fstream fs2("test2.dat", std::ios_base::in | std::ios_base::out
- | std::ios_base::trunc);
+ std::fstream fs1(temp1, std::ios_base::in | std::ios_base::out
+ | std::ios_base::trunc);
+ std::fstream fs2(temp2, std::ios_base::in | std::ios_base::out
+ | std::ios_base::trunc);
fs1 << 1 << ' ' << 2;
fs2 << 2 << ' ' << 1;
fs1.seekg(0);
@@ -40,13 +43,13 @@
fs2 >> i;
assert(i == 2);
}
- std::remove("test1.dat");
- std::remove("test2.dat");
+ std::remove(temp1);
+ std::remove(temp2);
{
- std::wfstream fs1("test1.dat", std::ios_base::in | std::ios_base::out
- | std::ios_base::trunc);
- std::wfstream fs2("test2.dat", std::ios_base::in | std::ios_base::out
- | std::ios_base::trunc);
+ std::wfstream fs1(temp1, std::ios_base::in | std::ios_base::out
+ | std::ios_base::trunc);
+ std::wfstream fs2(temp2, std::ios_base::in | std::ios_base::out
+ | std::ios_base::trunc);
fs1 << 1 << ' ' << 2;
fs2 << 2 << ' ' << 1;
fs1.seekg(0);
@@ -63,6 +66,6 @@
fs2 >> i;
assert(i == 2);
}
- std::remove("test1.dat");
- std::remove("test2.dat");
+ std::remove(temp1);
+ std::remove(temp2);
}
Modified: libcxx/trunk/test/input.output/file.streams/fstreams/fstream.assign/move_assign.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/input.output/file.streams/fstreams/fstream.assign/move_assign.pass.cpp?rev=135444&r1=135443&r2=135444&view=diff
==============================================================================
--- libcxx/trunk/test/input.output/file.streams/fstreams/fstream.assign/move_assign.pass.cpp (original)
+++ libcxx/trunk/test/input.output/file.streams/fstreams/fstream.assign/move_assign.pass.cpp Mon Jul 18 18:51:21 2011
@@ -20,9 +20,10 @@
int main()
{
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ char temp[L_tmpnam];
{
- std::fstream fso("test.dat", std::ios_base::in | std::ios_base::out
- | std::ios_base::trunc);
+ std::fstream fso(temp, std::ios_base::in | std::ios_base::out
+ | std::ios_base::trunc);
std::fstream fs;
fs = move(fso);
double x = 0;
@@ -31,10 +32,10 @@
fs >> x;
assert(x == 3.25);
}
- std::remove("test.dat");
+ std::remove(temp);
{
- std::wfstream fso("test.dat", std::ios_base::in | std::ios_base::out
- | std::ios_base::trunc);
+ std::wfstream fso(temp, std::ios_base::in | std::ios_base::out
+ | std::ios_base::trunc);
std::wfstream fs;
fs = move(fso);
double x = 0;
@@ -43,6 +44,6 @@
fs >> x;
assert(x == 3.25);
}
- std::remove("test.dat");
+ std::remove(temp);
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
Modified: libcxx/trunk/test/input.output/file.streams/fstreams/fstream.assign/nonmember_swap.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/input.output/file.streams/fstreams/fstream.assign/nonmember_swap.pass.cpp?rev=135444&r1=135443&r2=135444&view=diff
==============================================================================
--- libcxx/trunk/test/input.output/file.streams/fstreams/fstream.assign/nonmember_swap.pass.cpp (original)
+++ libcxx/trunk/test/input.output/file.streams/fstreams/fstream.assign/nonmember_swap.pass.cpp Mon Jul 18 18:51:21 2011
@@ -20,11 +20,14 @@
int main()
{
+ char temp1[L_tmpnam], temp2[L_tmpnam];
+ tmpnam(temp1);
+ tmpnam(temp2);
{
- std::fstream fs1("test1.dat", std::ios_base::in | std::ios_base::out
- | std::ios_base::trunc);
- std::fstream fs2("test2.dat", std::ios_base::in | std::ios_base::out
- | std::ios_base::trunc);
+ std::fstream fs1(temp1, std::ios_base::in | std::ios_base::out
+ | std::ios_base::trunc);
+ std::fstream fs2(temp2, std::ios_base::in | std::ios_base::out
+ | std::ios_base::trunc);
fs1 << 1 << ' ' << 2;
fs2 << 2 << ' ' << 1;
fs1.seekg(0);
@@ -41,13 +44,13 @@
fs2 >> i;
assert(i == 2);
}
- std::remove("test1.dat");
- std::remove("test2.dat");
+ std::remove(temp1);
+ std::remove(temp2);
{
- std::wfstream fs1("test1.dat", std::ios_base::in | std::ios_base::out
- | std::ios_base::trunc);
- std::wfstream fs2("test2.dat", std::ios_base::in | std::ios_base::out
- | std::ios_base::trunc);
+ std::wfstream fs1(temp1, std::ios_base::in | std::ios_base::out
+ | std::ios_base::trunc);
+ std::wfstream fs2(temp2, std::ios_base::in | std::ios_base::out
+ | std::ios_base::trunc);
fs1 << 1 << ' ' << 2;
fs2 << 2 << ' ' << 1;
fs1.seekg(0);
@@ -64,6 +67,6 @@
fs2 >> i;
assert(i == 2);
}
- std::remove("test1.dat");
- std::remove("test2.dat");
+ std::remove(temp1);
+ std::remove(temp2);
}
Modified: libcxx/trunk/test/input.output/file.streams/fstreams/fstream.cons/move.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/input.output/file.streams/fstreams/fstream.cons/move.pass.cpp?rev=135444&r1=135443&r2=135444&view=diff
==============================================================================
--- libcxx/trunk/test/input.output/file.streams/fstreams/fstream.cons/move.pass.cpp (original)
+++ libcxx/trunk/test/input.output/file.streams/fstreams/fstream.cons/move.pass.cpp Mon Jul 18 18:51:21 2011
@@ -20,9 +20,11 @@
int main()
{
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ char temp[L_tmpnam];
+ tmpnam(temp);
{
- std::fstream fso("test.dat", std::ios_base::in | std::ios_base::out
- | std::ios_base::trunc);
+ std::fstream fso(temp, std::ios_base::in | std::ios_base::out
+ | std::ios_base::trunc);
std::fstream fs = move(fso);
double x = 0;
fs << 3.25;
@@ -32,8 +34,8 @@
}
std::remove("test.dat");
{
- std::wfstream fso("test.dat", std::ios_base::in | std::ios_base::out
- | std::ios_base::trunc);
+ std::wfstream fso(temp, std::ios_base::in | std::ios_base::out
+ | std::ios_base::trunc);
std::wfstream fs = move(fso);
double x = 0;
fs << 3.25;
@@ -41,6 +43,6 @@
fs >> x;
assert(x == 3.25);
}
- std::remove("test.dat");
+ std::remove(temp);
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
Modified: libcxx/trunk/test/input.output/file.streams/fstreams/fstream.cons/pointer.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/input.output/file.streams/fstreams/fstream.cons/pointer.pass.cpp?rev=135444&r1=135443&r2=135444&view=diff
==============================================================================
--- libcxx/trunk/test/input.output/file.streams/fstreams/fstream.cons/pointer.pass.cpp (original)
+++ libcxx/trunk/test/input.output/file.streams/fstreams/fstream.cons/pointer.pass.cpp Mon Jul 18 18:51:21 2011
@@ -19,24 +19,26 @@
int main()
{
+ char temp[L_tmpnam];
+ tmpnam(temp);
{
- std::fstream fs("test.dat", std::ios_base::in | std::ios_base::out
- | std::ios_base::trunc);
+ std::fstream fs(temp, std::ios_base::in | std::ios_base::out
+ | std::ios_base::trunc);
double x = 0;
fs << 3.25;
fs.seekg(0);
fs >> x;
assert(x == 3.25);
}
- std::remove("test.dat");
+ std::remove(temp);
{
- std::wfstream fs("test.dat", std::ios_base::in | std::ios_base::out
- | std::ios_base::trunc);
+ std::wfstream fs(temp, std::ios_base::in | std::ios_base::out
+ | std::ios_base::trunc);
double x = 0;
fs << 3.25;
fs.seekg(0);
fs >> x;
assert(x == 3.25);
}
- std::remove("test.dat");
+ std::remove(temp);
}
Modified: libcxx/trunk/test/input.output/file.streams/fstreams/fstream.cons/string.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/input.output/file.streams/fstreams/fstream.cons/string.pass.cpp?rev=135444&r1=135443&r2=135444&view=diff
==============================================================================
--- libcxx/trunk/test/input.output/file.streams/fstreams/fstream.cons/string.pass.cpp (original)
+++ libcxx/trunk/test/input.output/file.streams/fstreams/fstream.cons/string.pass.cpp Mon Jul 18 18:51:21 2011
@@ -19,7 +19,7 @@
int main()
{
- char temp [L_tmpnam];
+ char temp[L_tmpnam];
tmpnam(temp);
{
std::fstream fs(std::string(temp),
Modified: libcxx/trunk/test/input.output/file.streams/fstreams/fstream.members/close.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/input.output/file.streams/fstreams/fstream.members/close.pass.cpp?rev=135444&r1=135443&r2=135444&view=diff
==============================================================================
--- libcxx/trunk/test/input.output/file.streams/fstreams/fstream.members/close.pass.cpp (original)
+++ libcxx/trunk/test/input.output/file.streams/fstreams/fstream.members/close.pass.cpp Mon Jul 18 18:51:21 2011
@@ -19,22 +19,24 @@
int main()
{
+ char temp[L_tmpnam];
+ tmpnam(temp);
{
std::fstream fs;
assert(!fs.is_open());
- fs.open("test.dat", std::ios_base::out);
+ fs.open(temp, std::ios_base::out);
assert(fs.is_open());
fs.close();
assert(!fs.is_open());
}
- remove("test.dat");
+ remove(temp);
{
std::wfstream fs;
assert(!fs.is_open());
- fs.open("test.dat", std::ios_base::out);
+ fs.open(temp, std::ios_base::out);
assert(fs.is_open());
fs.close();
assert(!fs.is_open());
}
- remove("test.dat");
+ remove(temp);
}
Modified: libcxx/trunk/test/input.output/file.streams/fstreams/fstream.members/open_pointer.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/input.output/file.streams/fstreams/fstream.members/open_pointer.pass.cpp?rev=135444&r1=135443&r2=135444&view=diff
==============================================================================
--- libcxx/trunk/test/input.output/file.streams/fstreams/fstream.members/open_pointer.pass.cpp (original)
+++ libcxx/trunk/test/input.output/file.streams/fstreams/fstream.members/open_pointer.pass.cpp Mon Jul 18 18:51:21 2011
@@ -19,11 +19,13 @@
int main()
{
+ char temp[L_tmpnam];
+ tmpnam(temp);
{
std::fstream fs;
assert(!fs.is_open());
- fs.open("test.dat", std::ios_base::in | std::ios_base::out
- | std::ios_base::trunc);
+ 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;
@@ -31,12 +33,12 @@
fs >> x;
assert(x == 3.25);
}
- std::remove("test.dat");
+ std::remove(temp);
{
std::wfstream fs;
assert(!fs.is_open());
- fs.open("test.dat", std::ios_base::in | std::ios_base::out
- | std::ios_base::trunc);
+ 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;
@@ -44,5 +46,5 @@
fs >> x;
assert(x == 3.25);
}
- std::remove("test.dat");
+ std::remove(temp);
}
Modified: libcxx/trunk/test/input.output/file.streams/fstreams/fstream.members/open_string.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/input.output/file.streams/fstreams/fstream.members/open_string.pass.cpp?rev=135444&r1=135443&r2=135444&view=diff
==============================================================================
--- libcxx/trunk/test/input.output/file.streams/fstreams/fstream.members/open_string.pass.cpp (original)
+++ libcxx/trunk/test/input.output/file.streams/fstreams/fstream.members/open_string.pass.cpp Mon Jul 18 18:51:21 2011
@@ -19,11 +19,13 @@
int main()
{
+ char temp[L_tmpnam];
+ tmpnam(temp);
{
std::fstream fs;
assert(!fs.is_open());
- fs.open(std::string("test.dat"), std::ios_base::in | std::ios_base::out
- | std::ios_base::trunc);
+ fs.open(std::string(temp), std::ios_base::in | std::ios_base::out
+ | std::ios_base::trunc);
assert(fs.is_open());
double x = 0;
fs << 3.25;
@@ -31,12 +33,12 @@
fs >> x;
assert(x == 3.25);
}
- std::remove("test.dat");
+ std::remove(temp);
{
std::wfstream fs;
assert(!fs.is_open());
- fs.open(std::string("test.dat"), std::ios_base::in | std::ios_base::out
- | std::ios_base::trunc);
+ fs.open(std::string(temp), std::ios_base::in | std::ios_base::out
+ | std::ios_base::trunc);
assert(fs.is_open());
double x = 0;
fs << 3.25;
@@ -44,5 +46,5 @@
fs >> x;
assert(x == 3.25);
}
- std::remove("test.dat");
+ std::remove(temp);
}
Modified: libcxx/trunk/test/input.output/file.streams/fstreams/ofstream.assign/member_swap.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/input.output/file.streams/fstreams/ofstream.assign/member_swap.pass.cpp?rev=135444&r1=135443&r2=135444&view=diff
==============================================================================
--- libcxx/trunk/test/input.output/file.streams/fstreams/ofstream.assign/member_swap.pass.cpp (original)
+++ libcxx/trunk/test/input.output/file.streams/fstreams/ofstream.assign/member_swap.pass.cpp Mon Jul 18 18:51:21 2011
@@ -19,9 +19,12 @@
int main()
{
+ char temp1[L_tmpnam], temp2[L_tmpnam];
+ tmpnam(temp1);
+ tmpnam(temp2);
{
- std::ofstream fs1("test1.dat");
- std::ofstream fs2("test2.dat");
+ std::ofstream fs1(temp1);
+ std::ofstream fs2(temp2);
fs1 << 3.25;
fs2 << 4.5;
fs1.swap(fs2);
@@ -29,26 +32,26 @@
fs2 << ' ' << 4.5;
}
{
- std::ifstream fs("test1.dat");
+ std::ifstream fs(temp1);
double x = 0;
fs >> x;
assert(x == 3.25);
fs >> x;
assert(x == 4.5);
}
- remove("test1.dat");
+ remove(temp1);
{
- std::ifstream fs("test2.dat");
+ std::ifstream fs(temp2);
double x = 0;
fs >> x;
assert(x == 4.5);
fs >> x;
assert(x == 3.25);
}
- remove("test2.dat");
+ remove(temp2);
{
- std::wofstream fs1("test1.dat");
- std::wofstream fs2("test2.dat");
+ std::wofstream fs1(temp1);
+ std::wofstream fs2(temp2);
fs1 << 3.25;
fs2 << 4.5;
fs1.swap(fs2);
@@ -56,21 +59,21 @@
fs2 << ' ' << 4.5;
}
{
- std::wifstream fs("test1.dat");
+ std::wifstream fs(temp1);
double x = 0;
fs >> x;
assert(x == 3.25);
fs >> x;
assert(x == 4.5);
}
- remove("test1.dat");
+ remove(temp1);
{
- std::wifstream fs("test2.dat");
+ std::wifstream fs(temp2);
double x = 0;
fs >> x;
assert(x == 4.5);
fs >> x;
assert(x == 3.25);
}
- remove("test2.dat");
+ remove(temp2);
}
Modified: libcxx/trunk/test/input.output/file.streams/fstreams/ofstream.assign/move_assign.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/input.output/file.streams/fstreams/ofstream.assign/move_assign.pass.cpp?rev=135444&r1=135443&r2=135444&view=diff
==============================================================================
--- libcxx/trunk/test/input.output/file.streams/fstreams/ofstream.assign/move_assign.pass.cpp (original)
+++ libcxx/trunk/test/input.output/file.streams/fstreams/ofstream.assign/move_assign.pass.cpp Mon Jul 18 18:51:21 2011
@@ -20,31 +20,33 @@
int main()
{
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ char temp[L_tmpnam];
+ tmpnam(temp);
{
- std::ofstream fso("test.dat");
+ std::ofstream fso(temp);
std::ofstream fs;
fs = move(fso);
fs << 3.25;
}
{
- std::ifstream fs("test.dat");
+ std::ifstream fs(temp);
double x = 0;
fs >> x;
assert(x == 3.25);
}
- remove("test.dat");
+ remove(temp);
{
- std::wofstream fso("test.dat");
+ std::wofstream fso(temp);
std::wofstream fs;
fs = move(fso);
fs << 3.25;
}
{
- std::wifstream fs("test.dat");
+ std::wifstream fs(temp);
double x = 0;
fs >> x;
assert(x == 3.25);
}
- remove("test.dat");
+ remove(temp);
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
Modified: libcxx/trunk/test/input.output/file.streams/fstreams/ofstream.assign/nonmember_swap.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/input.output/file.streams/fstreams/ofstream.assign/nonmember_swap.pass.cpp?rev=135444&r1=135443&r2=135444&view=diff
==============================================================================
--- libcxx/trunk/test/input.output/file.streams/fstreams/ofstream.assign/nonmember_swap.pass.cpp (original)
+++ libcxx/trunk/test/input.output/file.streams/fstreams/ofstream.assign/nonmember_swap.pass.cpp Mon Jul 18 18:51:21 2011
@@ -20,9 +20,12 @@
int main()
{
+ char temp1[L_tmpnam], temp2[L_tmpnam];
+ tmpnam(temp1);
+ tmpnam(temp2);
{
- std::ofstream fs1("test1.dat");
- std::ofstream fs2("test2.dat");
+ std::ofstream fs1(temp1);
+ std::ofstream fs2(temp2);
fs1 << 3.25;
fs2 << 4.5;
swap(fs1, fs2);
@@ -30,26 +33,26 @@
fs2 << ' ' << 4.5;
}
{
- std::ifstream fs("test1.dat");
+ std::ifstream fs(temp1);
double x = 0;
fs >> x;
assert(x == 3.25);
fs >> x;
assert(x == 4.5);
}
- remove("test1.dat");
+ remove(temp1);
{
- std::ifstream fs("test2.dat");
+ std::ifstream fs(temp2);
double x = 0;
fs >> x;
assert(x == 4.5);
fs >> x;
assert(x == 3.25);
}
- remove("test2.dat");
+ remove(temp2);
{
- std::wofstream fs1("test1.dat");
- std::wofstream fs2("test2.dat");
+ std::wofstream fs1(temp1);
+ std::wofstream fs2(temp2);
fs1 << 3.25;
fs2 << 4.5;
swap(fs1, fs2);
@@ -57,21 +60,21 @@
fs2 << ' ' << 4.5;
}
{
- std::wifstream fs("test1.dat");
+ std::wifstream fs(temp1);
double x = 0;
fs >> x;
assert(x == 3.25);
fs >> x;
assert(x == 4.5);
}
- remove("test1.dat");
+ remove(temp1);
{
- std::wifstream fs("test2.dat");
+ std::wifstream fs(temp2);
double x = 0;
fs >> x;
assert(x == 4.5);
fs >> x;
assert(x == 3.25);
}
- remove("test2.dat");
+ remove(temp2);
}
Modified: libcxx/trunk/test/input.output/file.streams/fstreams/ofstream.cons/move.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/input.output/file.streams/fstreams/ofstream.cons/move.pass.cpp?rev=135444&r1=135443&r2=135444&view=diff
==============================================================================
--- libcxx/trunk/test/input.output/file.streams/fstreams/ofstream.cons/move.pass.cpp (original)
+++ libcxx/trunk/test/input.output/file.streams/fstreams/ofstream.cons/move.pass.cpp Mon Jul 18 18:51:21 2011
@@ -20,29 +20,31 @@
int main()
{
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ char temp[L_tmpnam];
+ tmpnam(temp);
{
- std::ofstream fso("test.dat");
+ std::ofstream fso(temp);
std::ofstream fs = move(fso);
fs << 3.25;
}
{
- std::ifstream fs("test.dat");
+ std::ifstream fs(temp);
double x = 0;
fs >> x;
assert(x == 3.25);
}
- remove("test.dat");
+ remove(temp);
{
- std::wofstream fso("test.dat");
+ std::wofstream fso(temp);
std::wofstream fs = move(fso);
fs << 3.25;
}
{
- std::wifstream fs("test.dat");
+ std::wifstream fs(temp);
double x = 0;
fs >> x;
assert(x == 3.25);
}
- remove("test.dat");
+ remove(temp);
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
Modified: libcxx/trunk/test/input.output/file.streams/fstreams/ofstream.cons/pointer.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/input.output/file.streams/fstreams/ofstream.cons/pointer.pass.cpp?rev=135444&r1=135443&r2=135444&view=diff
==============================================================================
--- libcxx/trunk/test/input.output/file.streams/fstreams/ofstream.cons/pointer.pass.cpp (original)
+++ libcxx/trunk/test/input.output/file.streams/fstreams/ofstream.cons/pointer.pass.cpp Mon Jul 18 18:51:21 2011
@@ -19,26 +19,28 @@
int main()
{
+ char temp[L_tmpnam];
+ tmpnam(temp);
{
- std::ofstream fs("test.dat");
+ std::ofstream fs(temp);
fs << 3.25;
}
{
- std::ifstream fs("test.dat");
+ std::ifstream fs(temp);
double x = 0;
fs >> x;
assert(x == 3.25);
}
- remove("test.dat");
+ remove(temp);
{
- std::wofstream fs("test.dat");
+ std::wofstream fs(temp);
fs << 3.25;
}
{
- std::wifstream fs("test.dat");
+ std::wifstream fs(temp);
double x = 0;
fs >> x;
assert(x == 3.25);
}
- remove("test.dat");
+ remove(temp);
}
Modified: libcxx/trunk/test/input.output/file.streams/fstreams/ofstream.cons/string.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/input.output/file.streams/fstreams/ofstream.cons/string.pass.cpp?rev=135444&r1=135443&r2=135444&view=diff
==============================================================================
--- libcxx/trunk/test/input.output/file.streams/fstreams/ofstream.cons/string.pass.cpp (original)
+++ libcxx/trunk/test/input.output/file.streams/fstreams/ofstream.cons/string.pass.cpp Mon Jul 18 18:51:21 2011
@@ -19,26 +19,28 @@
int main()
{
+ char temp[L_tmpnam];
+ tmpnam(temp);
{
- std::ofstream fs(std::string("test.dat"));
+ std::ofstream fs((std::string(temp)));
fs << 3.25;
}
{
- std::ifstream fs(std::string("test.dat"));
+ std::ifstream fs((std::string(temp)));
double x = 0;
fs >> x;
assert(x == 3.25);
}
- remove("test.dat");
+ remove(temp);
{
- std::wofstream fs(std::string("test.dat"));
+ std::wofstream fs((std::string(temp)));
fs << 3.25;
}
{
- std::wifstream fs(std::string("test.dat"));
+ std::wifstream fs((std::string(temp)));
double x = 0;
fs >> x;
assert(x == 3.25);
}
- remove("test.dat");
+ remove(temp);
}
Modified: libcxx/trunk/test/input.output/file.streams/fstreams/ofstream.members/close.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/input.output/file.streams/fstreams/ofstream.members/close.pass.cpp?rev=135444&r1=135443&r2=135444&view=diff
==============================================================================
--- libcxx/trunk/test/input.output/file.streams/fstreams/ofstream.members/close.pass.cpp (original)
+++ libcxx/trunk/test/input.output/file.streams/fstreams/ofstream.members/close.pass.cpp Mon Jul 18 18:51:21 2011
@@ -19,22 +19,24 @@
int main()
{
+ char temp[L_tmpnam];
+ tmpnam(temp);
{
std::ofstream fs;
assert(!fs.is_open());
- fs.open("test.dat");
+ fs.open(temp);
assert(fs.is_open());
fs.close();
assert(!fs.is_open());
}
- remove("test.dat");
+ remove(temp);
{
std::wofstream fs;
assert(!fs.is_open());
- fs.open("test.dat");
+ fs.open(temp);
assert(fs.is_open());
fs.close();
assert(!fs.is_open());
}
- remove("test.dat");
+ remove(temp);
}
Modified: libcxx/trunk/test/input.output/file.streams/fstreams/ofstream.members/open_pointer.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/input.output/file.streams/fstreams/ofstream.members/open_pointer.pass.cpp?rev=135444&r1=135443&r2=135444&view=diff
==============================================================================
--- libcxx/trunk/test/input.output/file.streams/fstreams/ofstream.members/open_pointer.pass.cpp (original)
+++ libcxx/trunk/test/input.output/file.streams/fstreams/ofstream.members/open_pointer.pass.cpp Mon Jul 18 18:51:21 2011
@@ -19,38 +19,40 @@
int main()
{
+ char temp[L_tmpnam];
+ tmpnam(temp);
{
std::ofstream fs;
assert(!fs.is_open());
char c = 'a';
fs << c;
assert(fs.fail());
- fs.open("test.dat");
+ fs.open(temp);
assert(fs.is_open());
fs << c;
}
{
- std::ifstream fs("test.dat");
+ std::ifstream fs(temp);
char c = 0;
fs >> c;
assert(c == 'a');
}
- remove("test.dat");
+ remove(temp);
{
std::wofstream fs;
assert(!fs.is_open());
wchar_t c = L'a';
fs << c;
assert(fs.fail());
- fs.open("test.dat");
+ fs.open(temp);
assert(fs.is_open());
fs << c;
}
{
- std::wifstream fs("test.dat");
+ std::wifstream fs(temp);
wchar_t c = 0;
fs >> c;
assert(c == L'a');
}
- remove("test.dat");
+ remove(temp);
}
Modified: libcxx/trunk/test/input.output/file.streams/fstreams/ofstream.members/open_string.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/input.output/file.streams/fstreams/ofstream.members/open_string.pass.cpp?rev=135444&r1=135443&r2=135444&view=diff
==============================================================================
--- libcxx/trunk/test/input.output/file.streams/fstreams/ofstream.members/open_string.pass.cpp (original)
+++ libcxx/trunk/test/input.output/file.streams/fstreams/ofstream.members/open_string.pass.cpp Mon Jul 18 18:51:21 2011
@@ -19,38 +19,40 @@
int main()
{
+ char temp[L_tmpnam];
+ tmpnam(temp);
{
std::ofstream fs;
assert(!fs.is_open());
char c = 'a';
fs << c;
assert(fs.fail());
- fs.open(std::string("test.dat"));
+ fs.open(std::string(temp));
assert(fs.is_open());
fs << c;
}
{
- std::ifstream fs("test.dat");
+ std::ifstream fs(temp);
char c = 0;
fs >> c;
assert(c == 'a');
}
- remove("test.dat");
+ remove(temp);
{
std::wofstream fs;
assert(!fs.is_open());
wchar_t c = L'a';
fs << c;
assert(fs.fail());
- fs.open(std::string("test.dat"));
+ fs.open(std::string(temp));
assert(fs.is_open());
fs << c;
}
{
- std::wifstream fs("test.dat");
+ std::wifstream fs(temp);
wchar_t c = 0;
fs >> c;
assert(c == L'a');
}
- remove("test.dat");
+ remove(temp);
}
Modified: libcxx/trunk/test/input.output/file.streams/fstreams/ofstream.members/rdbuf.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/input.output/file.streams/fstreams/ofstream.members/rdbuf.pass.cpp?rev=135444&r1=135443&r2=135444&view=diff
==============================================================================
--- libcxx/trunk/test/input.output/file.streams/fstreams/ofstream.members/rdbuf.pass.cpp (original)
+++ libcxx/trunk/test/input.output/file.streams/fstreams/ofstream.members/rdbuf.pass.cpp Mon Jul 18 18:51:21 2011
@@ -19,16 +19,18 @@
int main()
{
+ char temp[L_tmpnam];
+ tmpnam(temp);
{
- std::ofstream fs("test.dat");
+ std::ofstream fs(temp);
std::filebuf* fb = fs.rdbuf();
assert(fb->sputc('r') == 'r');
}
- remove("test.dat");
+ remove(temp);
{
- std::wofstream fs("test.dat");
+ std::wofstream fs(temp);
std::wfilebuf* fb = fs.rdbuf();
assert(fb->sputc(L'r') == L'r');
}
- remove("test.dat");
+ remove(temp);
}
More information about the cfe-commits
mailing list