Update
CI / GCC 16 / C++26 / default (push) Has been cancelled
CI / GCC 16 / C++26 / sanitizers (push) Has been cancelled
CI / GCC 16 / C++26 / werror (push) Has been cancelled

Signed-off-by: faumaray <faumaray@gmail.com>
This commit is contained in:
faumaray committed 2026-07-15 19:49:06 +03:00
1 parent fa30098129
commit 8583a479dd
11 files changed
+1763 -129

No files matched your search

+22 -3
View File
@@ -19,6 +19,25 @@ namespace
std::ifstream f(p);
return {std::istreambuf_iterator<char>(f), {}};
}
std::size_t archive_count(const std::filesystem::path& path)
{
const auto directory = path.parent_path() / "history";
if (!std::filesystem::exists(directory)) {
return 0;
}
const auto prefix = path.stem().string() + "-";
std::size_t count = 0;
for (const auto& entry :
std::filesystem::directory_iterator(directory)) {
const auto filename = entry.path().filename().string();
if (entry.is_regular_file() && filename.starts_with(prefix) &&
entry.path().extension() == path.extension()) {
++count;
}
}
return count;
}
} // namespace
class SplitFileLoggerTests : public Void::Testing::Fixture
@@ -135,8 +154,8 @@ class HistoryLoggerTests : public Void::Testing::Fixture
std::to_string(i));
}
}
auto rotated = path;
rotated += ".1";
Void::Testing::expect(std::filesystem::exists(rotated));
const auto archives = archive_count(path);
Void::Testing::expect(archives >= 1);
Void::Testing::expect(archives <= 3);
}
};