Check ConflictSet preconditions in script_test

This commit is contained in:
2024-03-19 10:31:04 -07:00
parent be8ac879c5
commit edd7bcaa1e
6 changed files with 44 additions and 10 deletions
+11
View File
@@ -35,6 +35,17 @@ operator<=>(const std::span<const uint8_t> &lhs,
return lhs.size() <=> rhs.size();
}
[[nodiscard]] inline auto operator<=>(const std::span<const uint8_t> &lhs,
const ConflictSet::Key &rhs) noexcept {
int cl = std::min<int>(lhs.size(), rhs.len);
if (cl > 0) {
if (auto c = memcmp(lhs.data(), rhs.p, cl) <=> 0; c != 0) {
return c;
}
}
return lhs.size() <=> size_t(rhs.len);
}
// This header contains code that we want to reuse outside of ConflictSet.cpp or
// want to exclude from coverage since it's only testing related.