0
0
Fork 0
mirror of https://github.com/bitcoin/bitcoin.git synced 2025-02-07 10:27:47 -05:00

clusterlin tests: compare with fuzz-provided linearizations

This commit is contained in:
Pieter Wuille 2024-09-25 22:30:02 -04:00
parent 01bced42d1
commit a0ba50c065

View file

@ -961,6 +961,14 @@ FUZZ_TARGET(clusterlin_simple_linearize)
}
} while(std::next_permutation(perm_linearization.begin(), perm_linearization.end()));
}
if (optimal) {
// Compare with a linearization read from the fuzz input.
auto read = ReadLinearization(depgraph, reader);
auto read_chunking = ChunkLinearization(depgraph, read);
auto cmp = CompareChunks(simple_chunking, read_chunking);
assert(cmp >= 0);
}
}
FUZZ_TARGET(clusterlin_linearize)
@ -1038,6 +1046,12 @@ 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);
// Compare with a linearization read from the fuzz input.
auto read = ReadLinearization(depgraph, reader);
auto read_chunking = ChunkLinearization(depgraph, read);
auto cmp_read = CompareChunks(chunking, read_chunking);
assert(cmp_read >= 0);
}
}