status: working, IO not yet implemented
This commit is contained in:
commit
188d6dbbe5
14 changed files with 1333 additions and 0 deletions
52
test/Test.hs
Normal file
52
test/Test.hs
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
{-# LANGUAGE TemplateHaskell #-}
|
||||
|
||||
module Test (tests) where
|
||||
|
||||
import CombParse
|
||||
import Distribution.TestSuite (Progress (Finished), Result (Error, Fail, Pass), Test (Group, Test))
|
||||
import Test.TemplateStuff (mkSimpleCheck)
|
||||
|
||||
mkSimpleCheck "checkStr" 'parseVal "\"Str\"" [p|Str "Str"|] "parse a Str"
|
||||
mkSimpleCheck "checkNumb" 'parseVal "69420" [p|Numb 69420|] "parse a Numb"
|
||||
mkSimpleCheck "checkId" 'parseVal "x" [p|Id "x"|] "parse an Id"
|
||||
mkSimpleCheck "checkI" 'parseExpr "I x" [p|Comb (Var (Id "I")) (Var (Id "x"))|] "parse \"I x\""
|
||||
mkSimpleCheck "checkK" 'parseExpr "K x y" [p|Comb (Comb (Var (Id "K")) (Var (Id "x"))) (Var (Id "y"))|] "parse \"K x y\""
|
||||
mkSimpleCheck "checkS" 'parseExpr "S x y" [p|Comb (Comb (Var (Id "S")) (Var (Id "x"))) (Var (Id "y"))|] "parse \"S x y\""
|
||||
mkSimpleCheck "checkIimpl" 'parseExpr "S K x" [p|Comb (Comb (Var (Id "S")) (Var (Id "K"))) (Var (Id "x"))|] "parse \"S K x\""
|
||||
mkSimpleCheck "checkMimpl" 'parseExpr "S I I" [p|Comb (Comb (Var (Id "S")) (Var (Id "I"))) (Var (Id "I"))|] "parse \"S I I\""
|
||||
mkSimpleCheck "checkNOTimpl" 'parseExpr "S (S I (K F)) (K T) b" [p|(Comb (Comb (Comb (Var (Id "S")) (Comb (Comb (Var (Id "S")) (Var (Id "I"))) (Comb (Var (Id "K")) (Var (Id "F"))))) (Comb (Var (Id "K")) (Var (Id "T")))) (Var (Id "b")))|] "parse \"S I I\""
|
||||
|
||||
tests :: IO [Test]
|
||||
tests =
|
||||
return
|
||||
[ Group
|
||||
"value"
|
||||
False
|
||||
( map
|
||||
Test
|
||||
[ checkStr,
|
||||
checkNumb,
|
||||
checkId
|
||||
]
|
||||
),
|
||||
Group
|
||||
"Comb"
|
||||
False
|
||||
( map
|
||||
Test
|
||||
[ checkI,
|
||||
checkK,
|
||||
checkS
|
||||
]
|
||||
),
|
||||
Group
|
||||
"complex"
|
||||
False
|
||||
( map
|
||||
Test
|
||||
[ checkIimpl,
|
||||
checkMimpl,
|
||||
checkNOTimpl
|
||||
]
|
||||
)
|
||||
]
|
||||
Loading…
Add table
Add a link
Reference in a new issue