Skip to content

Commit 94f3e17

Browse files
committed
clusterlin tests: compare with fuzz-provided linearizations
1 parent 5f92ebe commit 94f3e17

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/test/fuzz/cluster_linearize.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1010,6 +1010,14 @@ FUZZ_TARGET(clusterlin_simple_linearize)
10101010
}
10111011
} while(std::next_permutation(perm_linearization.begin(), perm_linearization.end()));
10121012
}
1013+
1014+
if (optimal) {
1015+
// Compare with a linearization read from the fuzz input.
1016+
auto read = ReadLinearization(depgraph, reader);
1017+
auto read_chunking = ChunkLinearization(depgraph, read);
1018+
auto cmp = CompareChunks(simple_chunking, read_chunking);
1019+
assert(cmp >= 0);
1020+
}
10131021
}
10141022

10151023
FUZZ_TARGET(clusterlin_linearize)
@@ -1087,6 +1095,12 @@ FUZZ_TARGET(clusterlin_linearize)
10871095
// If SimpleLinearize finds the optimal result too, they must be equal (if not,
10881096
// SimpleLinearize is broken).
10891097
if (simple_optimal) assert(cmp == 0);
1098+
1099+
// Compare with a linearization read from the fuzz input.
1100+
auto read = ReadLinearization(depgraph, reader);
1101+
auto read_chunking = ChunkLinearization(depgraph, read);
1102+
auto cmp_read = CompareChunks(chunking, read_chunking);
1103+
assert(cmp_read >= 0);
10901104
}
10911105
}
10921106

0 commit comments

Comments
 (0)