mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-03-13 11:35:20 +01:00
clusterlin tests: verify that chunks are minimal
This commit is contained in:
parent
379a6506d0
commit
c8d2a330b6
1 changed files with 7 additions and 0 deletions
|
@ -967,6 +967,10 @@ FUZZ_TARGET(clusterlin_simple_linearize)
|
|||
auto perm_chunking = ChunkLinearization(depgraph, perm_linearization);
|
||||
auto cmp = CompareChunks(simple_chunking, perm_chunking);
|
||||
assert(cmp >= 0);
|
||||
// If perm_chunking is diagram-optimal, it cannot have more chunks than
|
||||
// simple_chunking (as simple_chunking claims to be optimal, which implies minimal
|
||||
// chunks.
|
||||
if (cmp == 0) assert(simple_chunking.size() >= perm_chunking.size());
|
||||
} else {
|
||||
// Otherwise, fast forward to the last permutation with the same non-topological
|
||||
// prefix.
|
||||
|
@ -1061,6 +1065,9 @@ FUZZ_TARGET(clusterlin_linearize)
|
|||
// If SimpleLinearize finds the optimal result too, they must be equal (if not,
|
||||
// SimpleLinearize is broken).
|
||||
if (simple_optimal) assert(cmp == 0);
|
||||
// If simple_chunking is diagram-optimal, it cannot have more chunks than chunking (as
|
||||
// chunking is claimed to be optimal, which implies minimal chunks.
|
||||
if (cmp == 0) assert(chunking.size() >= simple_chunking.size());
|
||||
|
||||
// Compare with a linearization read from the fuzz input.
|
||||
auto read = ReadLinearization(depgraph, reader);
|
||||
|
|
Loading…
Add table
Reference in a new issue