Skip to content

Commit

Permalink
Fix unit test as well
Browse files Browse the repository at this point in the history
  • Loading branch information
LinZhihao-723 committed Sep 8, 2024
1 parent a869a16 commit a65f26f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions components/core/tests/test-NetworkReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include <Catch2/single_include/catch2/catch.hpp>
#include <curl/curl.h>

#include "../src/clp/Array.hpp"
#include "../src/clp/CurlDownloadHandler.hpp"
#include "../src/clp/CurlGlobalInstance.hpp"
#include "../src/clp/ErrorCode.hpp"
Expand Down Expand Up @@ -65,12 +66,11 @@ auto get_test_input_path_relative_to_tests_dir() -> std::filesystem::path {

auto get_content(clp::ReaderInterface& reader, size_t read_buf_size) -> std::vector<char> {
std::vector<char> buf;
// NOLINTNEXTLINE(cppcoreguidelines-avoid-c-arrays)
auto const read_buf{std::make_unique<char[]>(read_buf_size)};
clp::Array<char> read_buf{read_buf_size};
for (bool has_more_content{true}; has_more_content;) {
size_t num_bytes_read{};
has_more_content = reader.read(read_buf.get(), read_buf_size, num_bytes_read);
std::string_view const view{read_buf.get(), num_bytes_read};
has_more_content = reader.read(read_buf.data(), read_buf_size, num_bytes_read);
std::string_view const view{read_buf.data(), num_bytes_read};
buf.insert(buf.cend(), view.cbegin(), view.cend());
}
return buf;
Expand Down

0 comments on commit a65f26f

Please sign in to comment.