1
1
mirror of https://github.com/github/semantic.git synced 2024-12-25 07:55:12 +03:00

Test that Interpreter produces zero-cost diffs of equal terms.

This commit is contained in:
Rob Rix 2016-06-30 13:34:31 -04:00
parent d674dd06b6
commit b0b8aa0616

View File

@ -23,3 +23,8 @@ spec = parallel $ do
prop "produces correct diffs" $
\ a b -> let diff = diffTerms (free . Free) ((==) `on` extract) diffCost (toTerm a) (toTerm b) :: Diff Text (Record '[Category]) in
(beforeTerm diff, afterTerm diff) `shouldBe` (Just (toTerm a), Just (toTerm b))
prop "constructs zero-cost diffs of equal terms" $
\ a -> let term = toTerm a
diff = diffTerms (free . Free) ((==) `on` extract) diffCost term term :: Diff Text (Record '[Category]) in
diffCost diff `shouldBe` 0