This commit is contained in:
2024-08-07 11:03:35 -05:00
parent f73c706b8b
commit f9a8751a57
2 changed files with 11 additions and 12 deletions

View File

@@ -274,7 +274,7 @@ TEST(open_file, write_with_incomplete_download) {
test_state(); test_state();
o.close(); o.close();
nf->close(); nf.close();
test_state(); test_state();

View File

@@ -401,9 +401,8 @@ TEST(ring_buffer_open_file, read_full_file_in_reverse) {
EXPECT_FALSE(stop_requested); EXPECT_FALSE(stop_requested);
std::size_t bytes_read{}; std::size_t bytes_read{};
data.resize(size); data.resize(size);
auto ret = nf.read_bytes(data, offset, &bytes_read) auto ret = nf.read(data, offset, &bytes_read) ? api_error::success
? api_error::success : api_error::os_error;
: api_error::os_error;
EXPECT_EQ(bytes_read, data.size()); EXPECT_EQ(bytes_read, data.size());
return ret; return ret;
}); });
@@ -461,9 +460,8 @@ TEST(ring_buffer_open_file, read_full_file_in_partial_chunks) {
EXPECT_FALSE(stop_requested); EXPECT_FALSE(stop_requested);
std::size_t bytes_read{}; std::size_t bytes_read{};
data.resize(size); data.resize(size);
auto ret = nf.read_bytes(data, offset, &bytes_read) auto ret = nf.read(data, offset, &bytes_read) ? api_error::success
? api_error::success : api_error::os_error;
: api_error::os_error;
EXPECT_EQ(bytes_read, data.size()); EXPECT_EQ(bytes_read, data.size());
return ret; return ret;
}); });
@@ -471,8 +469,8 @@ TEST(ring_buffer_open_file, read_full_file_in_partial_chunks) {
file_manager::ring_buffer_open_file rb(ring_buffer_dir, test_chunk_size, file_manager::ring_buffer_open_file rb(ring_buffer_dir, test_chunk_size,
30U, fsi, mp, 8u); 30U, fsi, mp, 8u);
auto nf2 = auto nf2 = utils::file::file::open_or_create_file(dest_path);
utils::file::file::open_or_create_file(dest_path) : EXPECT_TRUE(nf2); EXPECT_TRUE(nf2);
auto total_read = std::uint64_t(0u); auto total_read = std::uint64_t(0u);
@@ -481,7 +479,7 @@ TEST(ring_buffer_open_file, read_full_file_in_partial_chunks) {
EXPECT_EQ(api_error::success, rb.read(3u, total_read, data)); EXPECT_EQ(api_error::success, rb.read(3u, total_read, data));
std::size_t bytes_written{}; std::size_t bytes_written{};
EXPECT_TRUE(nf2.write_bytes(data, total_read, &bytes_written)); EXPECT_TRUE(nf2.write(data, total_read, &bytes_written));
total_read += data.size(); total_read += data.size();
} }
nf2.close(); nf2.close();
@@ -497,7 +495,8 @@ TEST(ring_buffer_open_file, read_full_file_in_partial_chunks) {
TEST(ring_buffer_open_file, read_full_file_in_partial_chunks_in_reverse) { TEST(ring_buffer_open_file, read_full_file_in_partial_chunks_in_reverse) {
const auto download_source_path = const auto download_source_path =
test::generate_test_file_name("ring_buffer_open_file"); test::generate_test_file_name("ring_buffer_open_file");
auto nf = create_random_file(download_source_path, test_chunk_size * 32u); auto nf =
test::create_random_file(download_source_path, test_chunk_size * 32u);
const auto dest_path = test::generate_test_file_name("ring_buffer_open_file"); const auto dest_path = test::generate_test_file_name("ring_buffer_open_file");
@@ -529,7 +528,7 @@ TEST(ring_buffer_open_file, read_full_file_in_partial_chunks_in_reverse) {
30U, fsi, mp, 8u); 30U, fsi, mp, 8u);
auto nf2 = utils::file::file::open_or_create_file(dest_path); auto nf2 = utils::file::file::open_or_create_file(dest_path);
EXPERT_TRUE(nf2); EXPECT_TRUE(nf2);
auto total_read = std::uint64_t(0u); auto total_read = std::uint64_t(0u);
const auto read_size = 3u; const auto read_size = 3u;