Skip to content

Commit 9d5b6a2

Browse files
Limit the scale of generated Natural values.
1 parent 65ab56b commit 9d5b6a2

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

components/monoidmap-test/Test/Common.hs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ import Test.QuickCheck
6868
, Function (..)
6969
, Property
7070
, Testable
71+
, arbitrarySizedIntegral
7172
, checkCoverage
7273
, choose
7374
, coarbitraryIntegral
@@ -78,10 +79,9 @@ import Test.QuickCheck
7879
, functionShow
7980
, listOf
8081
, scale
82+
, shrinkIntegral
8183
, shrinkMapBy
8284
)
83-
import Test.QuickCheck.Instances.Natural
84-
()
8585

8686
import qualified Data.MonoidMap as MonoidMap
8787
import qualified Data.Text as Text
@@ -109,6 +109,16 @@ instance (Function k, Function v, Ord k, MonoidNull v) =>
109109
where
110110
function = functionMap MonoidMap.toMap MonoidMap.fromMap
111111

112+
instance Arbitrary Natural where
113+
arbitrary = arbitrarySizedIntegral
114+
shrink = shrinkIntegral
115+
116+
instance CoArbitrary Natural where
117+
coarbitrary = coarbitraryIntegral
118+
119+
instance Function Natural where
120+
function = functionIntegral
121+
112122
instance Arbitrary Text where
113123
arbitrary = Text.pack <$> listOf genChar
114124
where

0 commit comments

Comments
 (0)