diff --git a/test/InterpreterSpec.hs b/test/InterpreterSpec.hs index 81ec79485..2cb4f0a34 100644 --- a/test/InterpreterSpec.hs +++ b/test/InterpreterSpec.hs @@ -13,6 +13,7 @@ import Syntax import Term.Arbitrary import Test.Hspec import Test.Hspec.QuickCheck +import Test.QuickCheck spec :: Spec spec = parallel $ do @@ -39,10 +40,10 @@ spec = parallel $ do Pure a -> pure a let toTerm' c (ArbitraryTerm r f) = decorate (toTerm (ArbitraryTerm (setCategory r c) f)) let root = cofree . ((pure 0 .: Program .: RNil) :<) . Indexed - prop "produces unbiased deletions" $ - \ a b c -> let (a', b') = (toTerm' c a, toTerm' c (b :: ArbitraryTerm Text (Record '[Category]))) in + prop "produces unbiased deletions" . forAll (arbitrary `suchThat` \ (a, b, _) -> syntax a /= syntax b) $ + \ (a, b, c) -> let (a', b') = (toTerm' c a, toTerm' c (b :: ArbitraryTerm Text (Record '[Category]))) in stripDiff (diffTerms wrap compare diffCost (root [ a', b' ]) (root [ a' ])) `shouldBe` reverse' (stripDiff (diffTerms wrap compare diffCost (root [ b', a' ]) (root [ a' ]))) - prop "produces unbiased insertions" $ - \ a b c -> let (a', b') = (toTerm' c a, toTerm' c (b :: ArbitraryTerm Text (Record '[Category]))) in + prop "produces unbiased insertions" . forAll (arbitrary `suchThat` \ (a, b, _) -> syntax a /= syntax b) $ + \ (a, b, c) -> let (a', b') = (toTerm' c a, toTerm' c (b :: ArbitraryTerm Text (Record '[Category]))) in stripDiff (diffTerms wrap compare diffCost (root [ a' ]) (root [ a', b' ])) `shouldBe` reverse' (stripDiff (diffTerms wrap compare diffCost (root [ a' ]) (root [ b', a' ])))