avoid Arbitrary generating excessivly long lists
Turns what it was doing often generated too long lists, or spun with suchThat rejecting too large numbers. Limit lists to 10.
This commit is contained in:
parent
e15d18058b
commit
f76c4a0973
2 changed files with 5 additions and 6 deletions
|
@ -337,9 +337,8 @@ fromRemoteMetaData (RemoteMetaData u (MetaData m)) = MetaData $
|
||||||
- the seriaization test slow due to the sheer amount of data.
|
- the seriaization test slow due to the sheer amount of data.
|
||||||
- It's unlikely that more than 100 fields of metadata will be used. -}
|
- It's unlikely that more than 100 fields of metadata will be used. -}
|
||||||
instance Arbitrary MetaData where
|
instance Arbitrary MetaData where
|
||||||
arbitrary = do
|
arbitrary = MetaData . M.filterWithKey legal . M.fromList
|
||||||
size <- arbitrarySizedBoundedIntegral `suchThat` (< 500)
|
<$> resize 10 (listOf arbitrary)
|
||||||
MetaData . M.filterWithKey legal . M.fromList <$> vector size
|
|
||||||
where
|
where
|
||||||
legal k _v = legalField $ fromMetaField k
|
legal k _v = legalField $ fromMetaField k
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,8 @@ data View = View
|
||||||
deriving (Eq, Read, Show)
|
deriving (Eq, Read, Show)
|
||||||
|
|
||||||
instance Arbitrary View where
|
instance Arbitrary View where
|
||||||
arbitrary = View <$> pure (Git.Ref "master") <*> arbitrary
|
arbitrary = View (Git.Ref "master")
|
||||||
|
<$> resize 10 (listOf arbitrary)
|
||||||
|
|
||||||
data ViewComponent = ViewComponent
|
data ViewComponent = ViewComponent
|
||||||
{ viewField :: MetaField
|
{ viewField :: MetaField
|
||||||
|
@ -43,8 +44,7 @@ data ViewFilter
|
||||||
|
|
||||||
instance Arbitrary ViewFilter where
|
instance Arbitrary ViewFilter where
|
||||||
arbitrary = do
|
arbitrary = do
|
||||||
size <- arbitrarySizedBoundedIntegral `suchThat` (< 100)
|
s <- S.fromList <$> resize 10 (listOf arbitrary)
|
||||||
s <- S.fromList <$> vector size
|
|
||||||
ifM arbitrary
|
ifM arbitrary
|
||||||
( return (FilterValues s)
|
( return (FilterValues s)
|
||||||
, return (ExcludeValues s)
|
, return (ExcludeValues s)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue