From e047c360dcc5cbdc01ee19a1b755bb70d883e41c Mon Sep 17 00:00:00 2001 From: Paul Cristian Sarbu Date: Thu, 4 Apr 2024 16:34:29 +0200 Subject: test: Add missing includes and fix deps --- test/utils/archive/archive_usage.test.cpp | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) (limited to 'test/utils/archive/archive_usage.test.cpp') diff --git a/test/utils/archive/archive_usage.test.cpp b/test/utils/archive/archive_usage.test.cpp index 1be69139..bd7a3851 100644 --- a/test/utils/archive/archive_usage.test.cpp +++ b/test/utils/archive/archive_usage.test.cpp @@ -12,11 +12,21 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include +#include #include +#include +#include #include #include #include +#ifdef __unix__ +#include // ssize_t +#else +#error "Non-unix is not supported yet" +#endif + #include "catch2/catch_test_macros.hpp" #include "catch2/generators/catch_generators_all.hpp" #include "src/buildtool/file_system/file_system_manager.hpp" @@ -32,7 +42,7 @@ namespace { using file_t = std::pair; using filetree_t = std::unordered_map; -constexpr size_t kBlockSize = 10240; +constexpr std::size_t kBlockSize = 10240; constexpr int kFilePerm = 0644; constexpr int kDirectoryPerm = 0755; @@ -109,7 +119,7 @@ std::vector const kTestScenarios = { archive_entry* entry{}; while (archive_read_next_header(a, &entry) == ARCHIVE_OK) { auto size = archive_entry_size(entry); - auto buf = std::string(static_cast(size), '\0'); + auto buf = std::string(static_cast(size), '\0'); REQUIRE(archive_read_data(a, buf.data(), buf.size()) == static_cast(buf.size())); result.emplace(archive_entry_pathname(entry), @@ -171,7 +181,7 @@ void extract_archive(std::string const& path) { REQUIRE(archive_write_header(out, entry) == ARCHIVE_OK); if (archive_entry_size(entry) > 0) { void const* buf{}; - size_t size{}; + std::size_t size{}; int64_t offset{}; int r2{}; while ((r2 = archive_read_data_block(a, &buf, &size, &offset)) == @@ -322,8 +332,8 @@ TEST_CASE("Archive write disk context", "[archive_context]") { TEST_CASE("Read-write archives", "[archive_read_write]") { // get the scenario - auto test_index = - GENERATE(Catch::Generators::range(0, kTestScenarios.size())); + auto test_index = GENERATE( + Catch::Generators::range(0, kTestScenarios.size())); auto const& scenario = kTestScenarios[test_index]; // perform the test @@ -375,8 +385,8 @@ TEST_CASE("Read-write archives", "[archive_read_write]") { TEST_CASE("ArchiveOps", "[archive_ops]") { // get the scenario - auto test_index = - GENERATE(Catch::Generators::range(0, kTestScenarios.size())); + auto test_index = GENERATE( + Catch::Generators::range(0, kTestScenarios.size())); auto const& scenario = kTestScenarios[test_index]; // perform the test -- cgit v1.2.3