From f6dc3d1d5e5109c4196ad17ee69ccc7fc8b57b3b Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Sun, 10 Jan 2016 21:38:08 +0000 Subject: Fixed issue: Ram usage explodes during tests --- spec/src/Thermoprint/Printout.hs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'spec/src/Thermoprint/Printout.hs') diff --git a/spec/src/Thermoprint/Printout.hs b/spec/src/Thermoprint/Printout.hs index d9d9902..23a5ec1 100644 --- a/spec/src/Thermoprint/Printout.hs +++ b/spec/src/Thermoprint/Printout.hs @@ -29,7 +29,7 @@ import Data.Aeson.Types (typeMismatch) import Test.QuickCheck.Arbitrary (Arbitrary(..), CoArbitrary, genericShrink) import Test.QuickCheck.Modifiers (NonNegative(..)) -import Test.QuickCheck.Gen (oneof, suchThat) +import Test.QuickCheck.Gen (oneof, suchThat, scale) import Test.QuickCheck.Instances import Test.QuickCheck (forAll, Property) @@ -194,12 +194,14 @@ instance Arbitrary Block where shrink = genericShrink arbitrary = oneof [ Line <$> arbitrary , VSpace . getNonNegative <$> arbitrary - , NewlSep <$> arbitrary + , NewlSep <$> scale' arbitrary ] instance Arbitrary Line where shrink = genericShrink arbitrary = oneof [ Word . TL.filter (not . isSpace) <$> arbitrary -- 'isSpace '\n' == True' , HSpace . getNonNegative <$> arbitrary - , SpaceSep <$> arbitrary + , SpaceSep <$> scale' arbitrary ] + +scale' = scale (round . sqrt . fromInteger . toInteger) -- cgit v1.2.3