Skip to content

Commit 4c7bf46

Browse files
committed
Check coverage of clashes in compact index tests
This should prevent #580 from occurring in the future.
1 parent 8cc76bb commit 4c7bf46

File tree

1 file changed

+8
-4
lines changed
  • test/Test/Database/LSMTree/Internal/Index

1 file changed

+8
-4
lines changed

test/Test/Database/LSMTree/Internal/Index/Compact.hs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -376,11 +376,15 @@ fromListSingles maxcsize apps = runST $ do
376376

377377
labelIndex :: IndexCompact -> (Property -> Property)
378378
labelIndex ic =
379-
QC.tabulate "# Clashes" [showPowersOf10 nclashes]
380-
. QC.tabulate "# Contiguous clash runs" [showPowersOf10 (length nscontig)]
381-
. QC.tabulate "Length of contiguous clash runs" (fmap (showPowersOf10 . snd) nscontig)
379+
checkCoverage
380+
. QC.tabulate "# Clashes" [showPowersOf 2 nclashes]
381+
. QC.cover 0.7 (nclashes > 0) "Has clashes"
382+
. QC.tabulate "# Contiguous clash runs" [showPowersOf 2 (length nscontig)]
383+
. QC.cover 0.3 (not (null nscontig)) "Has contiguous clash runs"
384+
. QC.tabulate "Length of contiguous clash runs" (fmap (showPowersOf 2 . snd) nscontig)
382385
. QC.tabulate "Contiguous clashes contain multi-page values" (fmap (show . fst) nscontig)
383-
. QC.classify (multiPageValuesClash ic) "Has clashing multi-page values"
386+
. QC.cover 0.05 (any fst nscontig) "Has contiguous clashes that contain multi-page values"
387+
. QC.cover 0.01 (multiPageValuesClash ic) "Has clashing multi-page values"
384388
where nclashes = countClashes ic
385389
nscontig = countContiguousClashes ic
386390

0 commit comments

Comments
 (0)