diff options
| author | Gregor Kleen <gkleen@yggdrasil.li> | 2016-01-10 21:38:08 +0000 |
|---|---|---|
| committer | Gregor Kleen <gkleen@yggdrasil.li> | 2016-01-10 21:38:08 +0000 |
| commit | f6dc3d1d5e5109c4196ad17ee69ccc7fc8b57b3b (patch) | |
| tree | 9aeb04e2bf034fb83cbd5efd7ae472f9411996cd /spec/src | |
| parent | 6ec3c805ea2cd629a75641530de30ab39a191409 (diff) | |
| download | thermoprint-f6dc3d1d5e5109c4196ad17ee69ccc7fc8b57b3b.tar thermoprint-f6dc3d1d5e5109c4196ad17ee69ccc7fc8b57b3b.tar.gz thermoprint-f6dc3d1d5e5109c4196ad17ee69ccc7fc8b57b3b.tar.bz2 thermoprint-f6dc3d1d5e5109c4196ad17ee69ccc7fc8b57b3b.tar.xz thermoprint-f6dc3d1d5e5109c4196ad17ee69ccc7fc8b57b3b.zip | |
Fixed issue: Ram usage explodes during tests
Diffstat (limited to 'spec/src')
| -rw-r--r-- | spec/src/Thermoprint/Printout.hs | 8 |
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 | ||
| 30 | import Test.QuickCheck.Arbitrary (Arbitrary(..), CoArbitrary, genericShrink) | 30 | import Test.QuickCheck.Arbitrary (Arbitrary(..), CoArbitrary, genericShrink) |
| 31 | import Test.QuickCheck.Modifiers (NonNegative(..)) | 31 | import Test.QuickCheck.Modifiers (NonNegative(..)) |
| 32 | import Test.QuickCheck.Gen (oneof, suchThat) | 32 | import Test.QuickCheck.Gen (oneof, suchThat, scale) |
| 33 | import Test.QuickCheck.Instances | 33 | import Test.QuickCheck.Instances |
| 34 | import Test.QuickCheck (forAll, Property) | 34 | import 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 | ||
| 200 | instance Arbitrary Line where | 200 | instance 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 | |||
| 207 | scale' = scale (round . sqrt . fromInteger . toInteger) | ||
