module ExprTests where import Expr import Test.HUnit inner :: Expr inner = Abs "x" (Var 0 "A") $ Var 2 "f" <.> Var 0 "x" e1 :: Expr e1 = Abs "A" Star inner fFree :: Test fFree = TestCase $ assertBool "f free" $ occursFree 0 e1 incE1 :: Test incE1 = TestCase $ assertEqual "incIndices e1" ( Abs "A" Star $ Abs "x" (Var 0 "A") $ Var 3 "f" <.> Var 0 "x" ) (incIndices e1) after :: Expr after = Abs "x" (Var 2 "B") $ Var 1 "f" <.> Var 0 "x" substE1 :: Test substE1 = TestCase $ assertEqual "e1[A := B]" after (subst 0 (Var 2 "B") inner) betaNFe1 :: Test betaNFe1 = TestCase $ assertEqual "e1 B" after (betaNF $ e1 <.> Var 2 "B") tests :: Test tests = TestList [ TestLabel "fFree" fFree , TestLabel "incE1" incE1 , TestLabel "substE1" substE1 , TestLabel "betaNFe1" betaNFe1 ]