mirror of
https://github.com/github/semantic.git
synced 2024-12-24 23:42:31 +03:00
We don’t need to use ArbitrarySyntax for this.
This commit is contained in:
parent
fd0c1e7abe
commit
2cbe8959fe
10
test/Spec.hs
10
test/Spec.hs
@ -36,11 +36,11 @@ instance (Arbitrary a, Arbitrary annotation) => Arbitrary (ArbitraryTerm a annot
|
||||
|
||||
arbitraryBounded :: (Arbitrary a, Arbitrary annotation) => Int -> Gen (ArbitraryTerm a annotation)
|
||||
arbitraryBounded k = make <$> arbitrary <*> oneof [
|
||||
ArbitrarySyntax . Leaf <$> arbitrary,
|
||||
ArbitrarySyntax . Indexed <$> vectorOfAtMost k (arbitraryBounded $ k - 1),
|
||||
ArbitrarySyntax . Syntax.Fixed <$> vectorOfAtMost k (arbitraryBounded $ k - 1),
|
||||
ArbitrarySyntax . Keyed . Map.fromList <$> arbitrary ]
|
||||
where make annotation syntax = ArbitraryTerm $ (annotation, unSyntax syntax)
|
||||
Leaf <$> arbitrary,
|
||||
Indexed <$> vectorOfAtMost k (arbitraryBounded $ k - 1),
|
||||
Syntax.Fixed <$> vectorOfAtMost k (arbitraryBounded $ k - 1),
|
||||
Keyed . Map.fromList <$> arbitrary ]
|
||||
where make annotation syntax = ArbitraryTerm $ (annotation, syntax)
|
||||
vectorOfAtMost k gen = choose (0, k) >>= \n -> vectorOf n gen
|
||||
|
||||
instance Arbitrary HTML where
|
||||
|
Loading…
Reference in New Issue
Block a user