1
1
mirror of https://github.com/github/semantic.git synced 2024-11-24 08:54:07 +03:00

Diff terms of records.

This commit is contained in:
Rob Rix 2016-06-23 16:30:43 -04:00
parent 365e84301d
commit 0b37ae936b

View File

@ -1,8 +1,12 @@
{-# LANGUAGE DataKinds #-}
module TermSpec where
import ArbitraryTerm
import Category
import Data.String
import Data.Text.Arbitrary ()
import Data.Record
import Data.Record.Arbitrary ()
import Diff
import Diff.Arbitrary
import Interpreter
@ -28,9 +32,9 @@ spec = parallel $ do
describe "Diff" $ do
prop "equality is reflexive" $
\ a b -> let diff = diffTerms (free . Free) (==) diffCost (toTerm a) (toTerm (b :: ArbitraryTerm String CategorySet)) in
\ a b -> let diff = diffTerms (free . Free) (==) diffCost (toTerm a) (toTerm (b :: ArbitraryTerm String (Record '[Category]))) in
diff == diff
prop "equal terms produce identity diffs" $
\ a -> let term = toTerm (a :: ArbitraryTerm String CategorySet) in
\ a -> let term = toTerm (a :: ArbitraryTerm String (Record '[Category])) in
diffCost (diffTerms (free . Free) (==) diffCost term term) == 0