mirror of
https://github.com/github/semantic.git
synced 2024-12-24 23:42:31 +03:00
Shrink Fixed subterms recursively.
This commit is contained in:
parent
39cfe5f96f
commit
e1161b46db
@ -28,7 +28,7 @@ instance (Eq a, Eq annotation, Arbitrary a, Arbitrary annotation) => Arbitrary (
|
||||
shrink term@(ArbitraryTerm (annotation, syntax)) = filter (/= term) $ ArbitraryTerm <$> ((,) <$> shrink annotation <*> shrinkSyntax syntax)
|
||||
where shrinkSyntax (Leaf a) = Leaf <$> shrink a
|
||||
shrinkSyntax (Indexed i) = (getSyntax <$> i) ++ (Indexed <$> (shrink =<< List.subsequences i))
|
||||
shrinkSyntax (Syntax.Fixed f) = (getSyntax <$> f) ++ (Syntax.Fixed <$> List.subsequences f)
|
||||
shrinkSyntax (Syntax.Fixed f) = (getSyntax <$> f) ++ (Syntax.Fixed <$> (shrink =<< List.subsequences f))
|
||||
shrinkSyntax (Keyed k) = (getSyntax . snd <$> (Map.toList k)) ++ (Keyed . Map.fromList <$> shrink (Map.toList k))
|
||||
getSyntax (ArbitraryTerm (_, syntax)) = syntax
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user