@@ -30,29 +30,33 @@ import Test.Util.Arbitrary
3030tests :: TestTree
3131tests = testGroup " Test.Database.LSMTree.Generators" [
3232 testGroup " PageContentFits" $
33- prop_arbitraryAndShrinkPreserveInvariant pageContentFitsInvariant
33+ prop_arbitraryAndShrinkPreserveInvariant noTags
34+ pageContentFitsInvariant
3435 , testGroup " PageContentOrdered" $
35- prop_arbitraryAndShrinkPreserveInvariant pageContentOrderedInvariant
36+ prop_arbitraryAndShrinkPreserveInvariant noTags
37+ pageContentOrderedInvariant
3638 , localOption (QuickCheckMaxSize 20 ) $ -- takes too long!
3739 testGroup " LogicalPageSummaries" $
38- prop_arbitraryAndShrinkPreserveInvariant (pagesInvariant @ Word64 )
40+ prop_arbitraryAndShrinkPreserveInvariant noTags $
41+ pagesInvariant @ Word64
3942 , testGroup " Chunk size" $
40- prop_arbitraryAndShrinkPreserveInvariant chunkSizeInvariant
43+ prop_arbitraryAndShrinkPreserveInvariant noTags
44+ chunkSizeInvariant
4145 , testGroup " Raw bytes" $
42- [testProperty " packRawBytesPinnedOrUnpinned"
43- prop_packRawBytesPinnedOrUnpinned
46+ [ testProperty " packRawBytesPinnedOrUnpinned"
47+ prop_packRawBytesPinnedOrUnpinned
4448 ]
45- ++ prop_arbitraryAndShrinkPreserveInvariant (deepseqInvariant @ RawBytes )
49+ ++ prop_arbitraryAndShrinkPreserveInvariant noTags
50+ (deepseqInvariant @ RawBytes )
4651 , testGroup " KeyForIndexCompact" $
47- prop_arbitraryAndShrinkPreserveInvariant $
52+ prop_arbitraryAndShrinkPreserveInvariant noTags $
4853 isKeyForIndexCompact . getKeyForIndexCompact
4954 , testGroup " BiasedKeyForIndexCompact" $
50- prop_arbitraryAndShrinkPreserveInvariant $
55+ prop_arbitraryAndShrinkPreserveInvariant noTags $
5156 isKeyForIndexCompact . getBiasedKeyForIndexCompact
5257 , testGroup " lists of key/op pairs" $
53- [ testProperty " prop_distributionKOps" $
54- prop_distributionKOps
55- ]
58+ prop_arbitraryAndShrinkPreserveInvariant labelTestKOps $
59+ deepseqInvariant
5660 ]
5761
5862prop_packRawBytesPinnedOrUnpinned :: Bool -> [Word8 ] -> Bool
@@ -62,18 +66,17 @@ prop_packRawBytesPinnedOrUnpinned pinned ws =
6266type TestEntry = Entry SerialisedValue BlobSpan
6367type TestKOp = (BiasedKeyForIndexCompact , TestEntry )
6468
65- prop_distributionKOps :: [TestKOp ] -> Property
66- prop_distributionKOps kops' =
67- QC. tabulate " key occurrences (>1 is collision)" (map (show . snd ) (Map. assocs keyCounts)) $
68- QC. tabulate " key sizes" (map (showPowersOf 4 . sizeofKey) keys) $
69- QC. tabulate " value sizes" (map (showPowersOf 4 . sizeofValue) values) $
70- QC. tabulate " k/op sizes" (map (showPowersOf 4 . uncurry sizeofEntry) kops) $
71- QC. tabulate " k/op is large" (map (show . isLarge) kops) $
72- QC. checkCoverage $
73- QC. cover 50 (any isLarge kops) " any k/op is large" $
74- QC. cover 1 (ratioUniqueKeys < (0.9 :: Double )) " >10% of keys collide" $
75- QC. cover 5 (any (> 2 ) keyCounts) " has key with >2 collisions" $
76- True
69+ labelTestKOps :: [TestKOp ] -> Property -> Property
70+ labelTestKOps kops' =
71+ QC. tabulate " key occurrences (>1 is collision)" (map (show . snd ) (Map. assocs keyCounts))
72+ . QC. tabulate " key sizes" (map (showPowersOf 4 . sizeofKey) keys)
73+ . QC. tabulate " value sizes" (map (showPowersOf 4 . sizeofValue) values)
74+ . QC. tabulate " k/op sizes" (map (showPowersOf 4 . uncurry sizeofEntry) kops)
75+ . QC. tabulate " k/op is large" (map (show . isLarge) kops)
76+ . QC. checkCoverage
77+ . QC. cover 50 (any isLarge kops) " any k/op is large"
78+ . QC. cover 1 (ratioUniqueKeys < (0.9 :: Double )) " >10% of keys collide"
79+ . QC. cover 5 (any (> 2 ) keyCounts) " has key with >2 collisions"
7780 where
7881 kops = coerce kops' :: [(SerialisedKey , Entry SerialisedValue BlobSpan )]
7982 keys = map fst kops
0 commit comments