Skip to content

Commit df265f1

Browse files
committed
Run StateMachine tests with both the ordinary and compact index
1 parent 006d71e commit df265f1

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

test/Test/Database/LSMTree/StateMachine.hs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,22 +239,25 @@ instance Arbitrary R.TableConfig where
239239
, (4, pure R.Incremental)
240240
]
241241
confWriteBufferAlloc <- QC.arbitrary
242+
confFencePointerIndex <- QC.arbitrary
242243
pure $ R.TableConfig {
243244
R.confMergePolicy = R.MergePolicyLazyLevelling
244245
, R.confSizeRatio = R.Four
245246
, confWriteBufferAlloc
246247
, R.confBloomFilterAlloc = R.AllocFixed 10
247-
, R.confFencePointerIndex = R.CompactIndex
248+
, confFencePointerIndex
248249
, R.confDiskCachePolicy = R.DiskCacheNone
249250
, confMergeSchedule
250251
}
251252

252253
shrink R.TableConfig{..} =
253254
[ R.TableConfig {
254255
confWriteBufferAlloc = confWriteBufferAlloc'
256+
, confFencePointerIndex = confFencePointerIndex'
255257
, ..
256258
}
257-
| confWriteBufferAlloc' <- QC.shrink confWriteBufferAlloc
259+
| ( confWriteBufferAlloc', confFencePointerIndex')
260+
<- QC.shrink (confWriteBufferAlloc, confFencePointerIndex)
258261
]
259262

260263
-- TODO: the current generator is suboptimal, and should be improved. There are
@@ -289,6 +292,13 @@ instance Arbitrary R.WriteBufferAlloc where
289292
| QC.Positive x' <- QC.shrink (QC.Positive x)
290293
]
291294

295+
deriving stock instance Enum R.FencePointerIndex
296+
deriving stock instance Bounded R.FencePointerIndex
297+
instance Arbitrary R.FencePointerIndex where
298+
arbitrary = QC.arbitraryBoundedEnum
299+
shrink R.OrdinaryIndex = []
300+
shrink R.CompactIndex = [R.OrdinaryIndex]
301+
292302
propLockstep_RealImpl_RealFS_IO ::
293303
Tracer IO R.LSMTreeTrace
294304
-> Actions (Lockstep (ModelState R.Table))

0 commit comments

Comments
 (0)