aboutsummaryrefslogtreecommitdiff
path: root/src/test/streams_tests.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/streams_tests.cpp')
-rw-r--r--src/test/streams_tests.cpp17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/test/streams_tests.cpp b/src/test/streams_tests.cpp
index acd0151e1a..b8d76c9608 100644
--- a/src/test/streams_tests.cpp
+++ b/src/test/streams_tests.cpp
@@ -172,7 +172,7 @@ BOOST_AUTO_TEST_CASE(streams_serializedata_xor)
ds.Xor(key);
BOOST_CHECK_EQUAL(
std::string(expected_xor.begin(), expected_xor.end()),
- std::string(ds.begin(), ds.end()));
+ ds.str());
in.push_back('\x0f');
in.push_back('\xf0');
@@ -189,7 +189,7 @@ BOOST_AUTO_TEST_CASE(streams_serializedata_xor)
ds.Xor(key);
BOOST_CHECK_EQUAL(
std::string(expected_xor.begin(), expected_xor.end()),
- std::string(ds.begin(), ds.end()));
+ ds.str());
// Multi character key
@@ -210,12 +210,14 @@ BOOST_AUTO_TEST_CASE(streams_serializedata_xor)
ds.Xor(key);
BOOST_CHECK_EQUAL(
std::string(expected_xor.begin(), expected_xor.end()),
- std::string(ds.begin(), ds.end()));
+ ds.str());
}
BOOST_AUTO_TEST_CASE(streams_buffered_file)
{
- FILE* file = fsbridge::fopen("streams_test_tmp", "w+b");
+ fs::path streams_test_filename = m_args.GetDataDirBase() / "streams_test_tmp";
+ FILE* file = fsbridge::fopen(streams_test_filename, "w+b");
+
// The value at each offset is the offset.
for (uint8_t j = 0; j < 40; ++j) {
fwrite(&j, 1, 1, file);
@@ -343,7 +345,7 @@ BOOST_AUTO_TEST_CASE(streams_buffered_file)
// We can explicitly close the file, or the destructor will do it.
bf.fclose();
- fs::remove("streams_test_tmp");
+ fs::remove(streams_test_filename);
}
BOOST_AUTO_TEST_CASE(streams_buffered_file_rand)
@@ -351,8 +353,9 @@ BOOST_AUTO_TEST_CASE(streams_buffered_file_rand)
// Make this test deterministic.
SeedInsecureRand(SeedRand::ZEROS);
+ fs::path streams_test_filename = m_args.GetDataDirBase() / "streams_test_tmp";
for (int rep = 0; rep < 50; ++rep) {
- FILE* file = fsbridge::fopen("streams_test_tmp", "w+b");
+ FILE* file = fsbridge::fopen(streams_test_filename, "w+b");
size_t fileSize = InsecureRandRange(256);
for (uint8_t i = 0; i < fileSize; ++i) {
fwrite(&i, 1, 1, file);
@@ -453,7 +456,7 @@ BOOST_AUTO_TEST_CASE(streams_buffered_file_rand)
maxPos = currentPos;
}
}
- fs::remove("streams_test_tmp");
+ fs::remove(streams_test_filename);
}
BOOST_AUTO_TEST_SUITE_END()