From fd23564dd5a33ded641806a7a20c6fd2b19685df Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Thu, 11 Aug 2016 13:05:36 -0400 Subject: [PATCH] Use a single root function for both interpreter tests. --- test/InterpreterSpec.hs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/test/InterpreterSpec.hs b/test/InterpreterSpec.hs index 640f30037..81ec79485 100644 --- a/test/InterpreterSpec.hs +++ b/test/InterpreterSpec.hs @@ -38,12 +38,11 @@ spec = parallel $ do Free c -> wrap c 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]))) - root = cofree . ((pure 0 .: Program .: RNil) :<) . Indexed in + \ 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]))) - root = cofree . ((pure 0 .: Program .: RNil) :<) . Indexed in + \ 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' ])))