replacing known values in output now (pretty sick)
This commit is contained in:
parent
9d209fee17
commit
3046beaef2
6 changed files with 276 additions and 7 deletions
19
test/NicetiesSpec.hs
Normal file
19
test/NicetiesSpec.hs
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
module NicetiesSpec (spec) where
|
||||
|
||||
import Bruijn (toDeBruijn)
|
||||
import Niceties (findKnown, replaceKnowns)
|
||||
import Parser (Expr (Abstraction, Application, Variable))
|
||||
import Test.Hspec
|
||||
|
||||
spec :: Spec
|
||||
spec = do
|
||||
describe "can find knowns" $ do
|
||||
it "can find identity" $
|
||||
findKnown identity `shouldBe` Just "I"
|
||||
describe "replaceKnowns" $ do
|
||||
it "can replace identity" $
|
||||
replaceKnowns identity `shouldBe` Variable "I"
|
||||
it "can replace identity of identity" $
|
||||
replaceKnowns (Application identity identity) `shouldBe` Application (Variable "I") (Variable "I")
|
||||
where
|
||||
identity = toDeBruijn $ Abstraction "x" (Variable "x")
|
||||
Loading…
Add table
Add a link
Reference in a new issue