@@ -0,0 +1,39 @@
|
||||
module Gyehoek.Test.CPS.Syntax (root) where
|
||||
|
||||
import Test.Tasty (TestTree, testGroup)
|
||||
import Test.Tasty.HUnit
|
||||
import Language.Sexp.Located qualified as SL
|
||||
import Language.SexpGrammar ()
|
||||
import Gyehoek.CPS.Syntax (cps)
|
||||
import Gyehoek.CPS.Syntax qualified as Sut
|
||||
import Data.Function (on)
|
||||
import Gyehoek.Test.Sexp (equivto)
|
||||
|
||||
|
||||
root :: IO TestTree
|
||||
root = pure . testGroup "cps syntax" $
|
||||
[ qqTree
|
||||
]
|
||||
|
||||
qqTree :: TestTree
|
||||
qqTree = testGroup "parser"
|
||||
[ testCase "lambda" do
|
||||
assertEqual "" (Sut.MkLambda ["x","y"] "ktail"
|
||||
(Sut.ExpContinue "ktail" [Sut.ValVar "x"]))
|
||||
[cps|(λ (x y ktail) (continue ktail x))|]
|
||||
assertEqual "" (Sut.MkLambda [] "ktail"
|
||||
(Sut.ExpContinue "ktail" [Sut.ValVar "x"]))
|
||||
[cps|(λ (ktail) (continue ktail x))|]
|
||||
, testCase "kappa" do
|
||||
assertEqual "" (Sut.MkKappa ["x","y"]
|
||||
(Sut.ExpContinue "k123" [Sut.ValVar "x", Sut.ValVar "y"]))
|
||||
[cps|(κ (x y) (continue k123 x y))|]
|
||||
, testCase "application" do
|
||||
assertEqual "" (Sut.ExpApply (Sut.ValVar "f")
|
||||
[Sut.ValVar "x",Sut.ValVar "y"]
|
||||
"k")
|
||||
[cps|(f x y k)|]
|
||||
assertEqual "" (Sut.ExpApply (Sut.ValVar "f")
|
||||
[] "k")
|
||||
[cps|(f k)|]
|
||||
]
|
||||
@@ -14,7 +14,7 @@ import qualified System.Process.Text as PT
|
||||
|
||||
disabled :: List String
|
||||
disabled =
|
||||
[ "square"
|
||||
[
|
||||
]
|
||||
|
||||
root :: IO TestTree
|
||||
|
||||
@@ -1,4 +1,10 @@
|
||||
module Gyehoek.Test.Sexp (root) where
|
||||
module Gyehoek.Test.Sexp
|
||||
( root
|
||||
, EquivSexp(..)
|
||||
, assertEquiv
|
||||
, equivto
|
||||
)
|
||||
where
|
||||
|
||||
import Test.Tasty (TestTree, testGroup)
|
||||
import Test.Tasty.HUnit
|
||||
|
||||
@@ -4,6 +4,7 @@ import Test.Tasty (TestTree, testGroup)
|
||||
import Test.Tasty.Silver.Interactive (defaultMain)
|
||||
import qualified Gyehoek.Test.Golden
|
||||
import qualified Gyehoek.Test.Sexp
|
||||
import qualified Gyehoek.Test.CPS.Syntax
|
||||
|
||||
|
||||
main :: IO ()
|
||||
@@ -13,5 +14,6 @@ root :: IO TestTree
|
||||
root = testGroup "test" <$> sequenceA
|
||||
[ Gyehoek.Test.Golden.root
|
||||
, Gyehoek.Test.Sexp.root
|
||||
, Gyehoek.Test.CPS.Syntax.root
|
||||
]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user