aboutsummaryrefslogtreecommitdiff
path: root/spec/src/Thermoprint/Printout.hs
diff options
context:
space:
mode:
authorGregor Kleen <gkleen@yggdrasil.li>2016-01-10 21:38:08 +0000
committerGregor Kleen <gkleen@yggdrasil.li>2016-01-10 21:38:08 +0000
commitf6dc3d1d5e5109c4196ad17ee69ccc7fc8b57b3b (patch)
tree9aeb04e2bf034fb83cbd5efd7ae472f9411996cd /spec/src/Thermoprint/Printout.hs
parent6ec3c805ea2cd629a75641530de30ab39a191409 (diff)
downloadthermoprint-f6dc3d1.tar
thermoprint-f6dc3d1.tar.gz
thermoprint-f6dc3d1.tar.bz2
thermoprint-f6dc3d1.tar.xz
thermoprint-f6dc3d1.zip
Fixed issue: Ram usage explodes during tests
Diffstat (limited to 'spec/src/Thermoprint/Printout.hs')
-rw-r--r--spec/src/Thermoprint/Printout.hs8
1 files changed, 5 insertions, 3 deletions
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)
29 29
30import Test.QuickCheck.Arbitrary (Arbitrary(..), CoArbitrary, genericShrink) 30import Test.QuickCheck.Arbitrary (Arbitrary(..), CoArbitrary, genericShrink)
31import Test.QuickCheck.Modifiers (NonNegative(..)) 31import Test.QuickCheck.Modifiers (NonNegative(..))
32import Test.QuickCheck.Gen (oneof, suchThat) 32import Test.QuickCheck.Gen (oneof, suchThat, scale)
33import Test.QuickCheck.Instances 33import Test.QuickCheck.Instances
34import Test.QuickCheck (forAll, Property) 34import Test.QuickCheck (forAll, Property)
35 35
@@ -194,12 +194,14 @@ instance Arbitrary Block where
194 shrink = genericShrink 194 shrink = genericShrink
195 arbitrary = oneof [ Line <$> arbitrary 195 arbitrary = oneof [ Line <$> arbitrary
196 , VSpace . getNonNegative <$> arbitrary 196 , VSpace . getNonNegative <$> arbitrary
197 , NewlSep <$> arbitrary 197 , NewlSep <$> scale' arbitrary
198 ] 198 ]
199 199
200instance Arbitrary Line where 200instance Arbitrary Line where
201 shrink = genericShrink 201 shrink = genericShrink
202 arbitrary = oneof [ Word . TL.filter (not . isSpace) <$> arbitrary -- 'isSpace '\n' == True' 202 arbitrary = oneof [ Word . TL.filter (not . isSpace) <$> arbitrary -- 'isSpace '\n' == True'
203 , HSpace . getNonNegative <$> arbitrary 203 , HSpace . getNonNegative <$> arbitrary
204 , SpaceSep <$> arbitrary 204 , SpaceSep <$> scale' arbitrary
205 ] 205 ]
206
207scale' = scale (round . sqrt . fromInteger . toInteger)