2015-12-17 21:08:47 +03:00
|
|
|
module TermSpec where
|
|
|
|
|
|
|
|
import Test.Hspec
|
|
|
|
import Test.Hspec.QuickCheck
|
|
|
|
import Test.QuickCheck hiding (Fixed)
|
|
|
|
|
|
|
|
import Categorizable
|
|
|
|
import Interpreter
|
|
|
|
import Diff
|
|
|
|
import Syntax
|
|
|
|
import Term
|
2015-12-22 20:53:31 +03:00
|
|
|
import ArbitraryTerm
|
2015-12-17 21:08:47 +03:00
|
|
|
|
|
|
|
main :: IO ()
|
|
|
|
main = hspec spec
|
|
|
|
|
|
|
|
spec :: Spec
|
|
|
|
spec = do
|
|
|
|
describe "Term" $ do
|
|
|
|
prop "equality is reflexive" $
|
|
|
|
\ a -> unTerm a == unTerm (a :: ArbitraryTerm String ())
|
|
|
|
|
|
|
|
describe "Diff" $ do
|
|
|
|
prop "equality is reflexive" $
|
|
|
|
\ a b -> let diff = interpret comparable (unTerm a) (unTerm (b :: ArbitraryTerm String CategorySet)) in
|
|
|
|
diff == diff
|
|
|
|
|
|
|
|
prop "equal terms produce identity diffs" $
|
|
|
|
\ a -> let term = unTerm (a :: ArbitraryTerm String CategorySet) in
|
|
|
|
diffCost (interpret comparable term term) == 0
|