Skip to content

Commit 2080353

Browse files
committed
Reduce the number of shrinks involving RunParams
The shrink tests were timing out.
1 parent 0204324 commit 2080353

File tree

1 file changed

+8
-5
lines changed
  • test/Test/Database/LSMTree/Internal/Snapshot

1 file changed

+8
-5
lines changed

test/Test/Database/LSMTree/Internal/Snapshot/Codec.hs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,12 @@ arbitraryShortVector = do
294294
n <- chooseInt (0, 5)
295295
V.fromList <$> vector n
296296

297-
deriving newtype instance Arbitrary RunNumber
297+
instance Arbitrary RunNumber where
298+
arbitrary = RunNumber <$> arbitrarySizedNatural
299+
shrink (RunNumber n) =
300+
-- fewer shrinks
301+
[RunNumber 0 | n > 0]
302+
++ [RunNumber (n `div` 2) | n >= 2]
298303

299304
instance Arbitrary r => Arbitrary (SnapIncomingRun r) where
300305
arbitrary = oneof [
@@ -343,13 +348,11 @@ instance Arbitrary RunParams where
343348

344349
instance Arbitrary RunDataCaching where
345350
arbitrary = elements [CacheRunData, NoCacheRunData]
346-
shrink NoCacheRunData = [CacheRunData]
347-
shrink _ = []
351+
shrink _ = []
348352

349353
instance Arbitrary IndexType where
350354
arbitrary = elements [Ordinary, Compact]
351-
shrink Compact = [Ordinary]
352-
shrink _ = []
355+
shrink _ = []
353356

354357
instance Arbitrary RunBloomFilterAlloc where
355358
arbitrary = oneof [

0 commit comments

Comments
 (0)