Skip to content

Commit 1fa55a6

Browse files
committed
clusterlin tests: verify that chunks are minimal
1 parent da23ece commit 1fa55a6

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/test/fuzz/cluster_linearize.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1016,6 +1016,10 @@ FUZZ_TARGET(clusterlin_simple_linearize)
10161016
auto perm_chunking = ChunkLinearization(depgraph, perm_linearization);
10171017
auto cmp = CompareChunks(simple_chunking, perm_chunking);
10181018
assert(cmp >= 0);
1019+
// If perm_chunking is diagram-optimal, it cannot have more chunks than
1020+
// simple_chunking (as simple_chunking claims to be optimal, which implies minimal
1021+
// chunks.
1022+
if (cmp == 0) assert(simple_chunking.size() >= perm_chunking.size());
10191023
} else {
10201024
// Otherwise, fast forward to the last permutation with the same non-topological
10211025
// prefix.
@@ -1110,6 +1114,9 @@ FUZZ_TARGET(clusterlin_linearize)
11101114
// If SimpleLinearize finds the optimal result too, they must be equal (if not,
11111115
// SimpleLinearize is broken).
11121116
if (simple_optimal) assert(cmp == 0);
1117+
// If simple_chunking is diagram-optimal, it cannot have more chunks than chunking (as
1118+
// chunking is claimed to be optimal, which implies minimal chunks).
1119+
if (cmp == 0) assert(chunking.size() >= simple_chunking.size());
11131120

11141121
// Compare with a linearization read from the fuzz input.
11151122
auto read = ReadLinearization(depgraph, reader);

0 commit comments

Comments
 (0)