summaryrefslogtreecommitdiffstats
path: root/libcxx/test/input.output/file.streams/fstreams/ofstream.assign/nonmember_swap.pass.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libcxx/test/input.output/file.streams/fstreams/ofstream.assign/nonmember_swap.pass.cpp')
-rw-r--r--libcxx/test/input.output/file.streams/fstreams/ofstream.assign/nonmember_swap.pass.cpp27
1 files changed, 15 insertions, 12 deletions
diff --git a/libcxx/test/input.output/file.streams/fstreams/ofstream.assign/nonmember_swap.pass.cpp b/libcxx/test/input.output/file.streams/fstreams/ofstream.assign/nonmember_swap.pass.cpp
index 8834cf39c62..24deafdcf5c 100644
--- a/libcxx/test/input.output/file.streams/fstreams/ofstream.assign/nonmember_swap.pass.cpp
+++ b/libcxx/test/input.output/file.streams/fstreams/ofstream.assign/nonmember_swap.pass.cpp
@@ -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 @@ int main()
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 @@ int main()
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);
}
OpenPOWER on IntegriCloud