mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-10 06:39:15 +02:00
streams: cache file position within AutoFile
This commit is contained in:
@@ -261,7 +261,7 @@ BOOST_AUTO_TEST_CASE(streams_buffered_file)
|
||||
for (uint8_t j = 0; j < 40; ++j) {
|
||||
file << j;
|
||||
}
|
||||
std::rewind(file.Get());
|
||||
file.seek(0, SEEK_SET);
|
||||
|
||||
// The buffer size (second arg) must be greater than the rewind
|
||||
// amount (third arg).
|
||||
@@ -391,7 +391,7 @@ BOOST_AUTO_TEST_CASE(streams_buffered_file_skip)
|
||||
for (uint8_t j = 0; j < 40; ++j) {
|
||||
file << j;
|
||||
}
|
||||
std::rewind(file.Get());
|
||||
file.seek(0, SEEK_SET);
|
||||
|
||||
// The buffer is 25 bytes, allow rewinding 10 bytes.
|
||||
BufferedFile bf{file, 25, 10};
|
||||
@@ -444,7 +444,7 @@ BOOST_AUTO_TEST_CASE(streams_buffered_file_rand)
|
||||
for (uint8_t i = 0; i < fileSize; ++i) {
|
||||
file << i;
|
||||
}
|
||||
std::rewind(file.Get());
|
||||
file.seek(0, SEEK_SET);
|
||||
|
||||
size_t bufSize = m_rng.randrange(300) + 1;
|
||||
size_t rewindSize = m_rng.randrange(bufSize);
|
||||
|
||||
Reference in New Issue
Block a user