diff options
Diffstat (limited to 'test/test_directory.cpp')
-rw-r--r-- | test/test_directory.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/test/test_directory.cpp b/test/test_directory.cpp index 0f7dc8d..7a420ca 100644 --- a/test/test_directory.cpp +++ b/test/test_directory.cpp @@ -20,13 +20,14 @@ #include "fud_directory.hpp" #include "fud_string.hpp" #include "test_common.hpp" +#include "fud_print.hpp" #include "gtest/gtest.h" #include <algorithm> #include <cerrno> #include <fcntl.h> #include <ftw.h> -#include <ranges> +#include <ranges> // IWYU pragma: keep - this warning is WRONG namespace fud { @@ -59,6 +60,7 @@ TEST(FudDirectory, Basic) ASSERT_TRUE(fileResult.isOkay()); CBinaryFile file{std::move(fileResult).takeOkay()}; ASSERT_EQ(file.open(), FudStatus::Success); + // NOLINTNEXTLINE(readability-magic-numbers) Array<utf8, 5> data{u8"test"}; DrainResult expected{data.size(), FudStatus::Success}; auto writeResult = file.write(data); @@ -71,6 +73,8 @@ TEST(FudDirectory, Basic) Directory directory{directoryResult.takeOkay()}; ASSERT_EQ(directory.errorCode(), 0); + debugPrint(u8"What? Filename = '{}', expected '{}' \n'", String::from(files[0]).takeOkay().asView(), files[0].asView()); + debugPrint(u8"What? Filename = '{}', expected '{}' \n'", String::from(files[1]).takeOkay().asView(), files[1].asView()); const Array<DirectoryEntry, 4> expectedFiles{ DirectoryEntry{String::makeFromCString(".").takeOkay(), 0, 0, 2, 0, DirectoryEntryType::Directory}, DirectoryEntry{String::makeFromCString("..").takeOkay(), 0, 0, 1, 0, DirectoryEntryType::Directory}, @@ -80,6 +84,7 @@ TEST(FudDirectory, Basic) ASSERT_TRUE(expectedFiles[0].name.compare(expectedFiles[0].name)); for (auto idx = 0; idx < expectedFiles.size(); ++idx) { + debugPrint(u8"On iteration {} - '{}' \n", idx, expectedFiles[idx].name.asView()); auto dirEntryResult = directory.getNextEntry(); EXPECT_TRUE(dirEntryResult.isOkay()); auto dirEntryOpt = dirEntryResult.takeOkay(); @@ -87,9 +92,8 @@ TEST(FudDirectory, Basic) break; } auto dirEntry{std::move(dirEntryOpt.value())}; - const auto* expected = std::find_if( - expectedFiles.begin(), - expectedFiles.end(), + const auto* expected = std::ranges::find_if( + expectedFiles, [&dirEntry](const DirectoryEntry& entry) { return entry.name.compare(dirEntry.name) && entry.entryType == dirEntry.entryType; }); |