@@ -55,14 +55,22 @@ tests = testGroup "Test.Database.LSMTree.Internal.Serialise" [
5555 Eq and Ord laws
5656-------------------------------------------------------------------------------}
5757
58+ withFirstKeyLengthInfo :: SerialisedKey -> Property -> Property
59+ withFirstKeyLengthInfo firstKey
60+ = collect (" Length of first key is " ++ show (sizeofKey firstKey))
61+
5862propEqReflexivity :: SerialisedKey -> Property
5963propEqReflexivity k = k === k
6064
6165propEqSymmetry :: SerialisedKey -> SerialisedKey -> Property
6266propEqSymmetry k1 k2 = (k1 == k2) === (k2 == k1)
6367
64- propEqTransitivity :: SerialisedKey -> SerialisedKey -> SerialisedKey -> Property
65- propEqTransitivity k1 k2 k3 = mapSize (const 5 ) $ k1 == k2 && k2 == k3 ==> k1 === k3
68+ propEqTransitivity :: Property
69+ propEqTransitivity = mapSize (const 3 ) $ withDiscardRatio 1000 $ untunedProp
70+ where
71+ untunedProp :: SerialisedKey -> SerialisedKey -> SerialisedKey -> Property
72+ untunedProp k1 k2 k3 = withFirstKeyLengthInfo k1 $
73+ k1 == k2 && k2 == k3 ==> k1 === k3
6674
6775propEqNegation :: SerialisedKey -> SerialisedKey -> Property
6876propEqNegation k1 k2 = (k1 /= k2) === not (k1 == k2)
@@ -76,5 +84,9 @@ propOrdTransitivity k1 k2 k3 = k1 <= k2 && k2 <= k3 ==> k1 <= k3
7684propOrdReflexivity :: SerialisedKey -> Property
7785propOrdReflexivity k = property $ k <= k
7886
79- propOrdAntiSymmetry :: SerialisedKey -> SerialisedKey -> Property
80- propOrdAntiSymmetry k1 k2 = mapSize (const 5 ) $ k1 <= k2 && k2 <= k1 ==> k1 === k2
87+ propOrdAntiSymmetry :: Property
88+ propOrdAntiSymmetry = mapSize (const 4 ) $ withDiscardRatio 100 $ untunedProp
89+ where
90+ untunedProp :: SerialisedKey -> SerialisedKey -> Property
91+ untunedProp k1 k2 = withFirstKeyLengthInfo k1 $
92+ k1 <= k2 && k2 <= k1 ==> k1 === k2
0 commit comments