55
66module Test.ScheduledMergesQLS (tests ) where
77
8+ import Control.Monad (void )
89import Control.Monad.ST
910import Control.Tracer (Tracer , nullTracer )
1011import Data.Constraint (Dict (.. ))
@@ -18,18 +19,44 @@ import Prelude hiding (lookup)
1819import ScheduledMerges as LSM
1920
2021import Test.QuickCheck
22+ import qualified Test.QuickCheck.DynamicLogic as DL
2123import Test.QuickCheck.StateModel hiding (lookUpVar )
2224import Test.QuickCheck.StateModel.Lockstep hiding (ModelOp )
2325import qualified Test.QuickCheck.StateModel.Lockstep.Defaults as Lockstep
26+ import Test.QuickCheck.StateModel.Lockstep.Op.Identity (Op (OpId ))
2427import qualified Test.QuickCheck.StateModel.Lockstep.Run as Lockstep
2528import Test.Tasty
2629import Test.Tasty.QuickCheck (testProperty )
2730
2831tests :: TestTree
2932tests = testGroup " Test.ScheduledMergesQLS" [
3033 testProperty " ScheduledMerges vs model" $ mapSize (* 10 ) prop_LSM -- still <10s
34+ , testProperty " propRegression_issue755" $
35+ let scenario = do
36+ var1 <- DL. action $ ANew (LSMConfig {configMaxWriteBufferSize = 1 , configSizeRatio = 2 })
37+ void $ DL. action $ AInsert (unsafeMkGVar var1 OpId ) (Right (K 0 )) (V 0 ) Nothing
38+ var16 <- DL. action $ AUnions [unsafeMkGVar var1 OpId ]
39+ void $ DL. action $ AInsert (unsafeMkGVar var16 OpId ) (Right (K 0 )) (V 0 ) Nothing
40+ void $ DL. action $ AInsert (unsafeMkGVar var16 OpId ) (Right (K 1 )) (V 0 ) Nothing
41+ void $ DL. action $ AInsert (unsafeMkGVar var16 OpId ) (Right (K 0 )) (V 0 ) Nothing
42+ void $ DL. action $ AInsert (unsafeMkGVar var16 OpId ) (Right (K 0 )) (V 0 ) Nothing
43+ void $ DL. action $ AInsert (unsafeMkGVar var16 OpId ) (Right (K 1 )) (V 0 ) Nothing
44+ void $ DL. action $ AInsert (unsafeMkGVar var16 OpId ) (Right (K 2 )) (V 0 ) Nothing
45+ void $ DL. action $ AInsert (unsafeMkGVar var16 OpId ) (Right (K 0 )) (V 0 ) Nothing
46+ void $ DL. action $ AInsert (unsafeMkGVar var16 OpId ) (Right (K 0 )) (V 0 ) Nothing
47+ void $ DL. action $ AInsert (unsafeMkGVar var16 OpId ) (Right (K 0 )) (V 0 ) Nothing
48+ in DL. forAllDL scenario prop_LSM
49+ {-
50+ The scenario above is a manually modified version of output produced by:
51+
52+ cabal run prototypes-test -- \
53+ --quickcheck-replay="(SMGen 3702524042292853426 14344574976030159473,92)" \
54+ -p '/ScheduledMerges vs model/'
55+ -}
3156 ]
3257
58+ instance DL. DynLogicModel (Lockstep Model ) where
59+
3360-- TODO: add tagging, e.g. how often ASupplyUnion makes progress or completes a
3461-- union merge.
3562prop_LSM :: Actions (Lockstep Model ) -> Property
0 commit comments