diff options
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) | ||