extend the abstract syntax API

This commit is contained in:
krangelov
2021-08-06 12:43:30 +02:00
parent 87f1e24384
commit dc1644563f
11 changed files with 257 additions and 25 deletions

View File

@@ -1,8 +1,10 @@
abstract basic = {
cat N ;
cat N; S ;
fun Z : N ;
S : N -> N ;
fun z : N ;
s : N -> N ;
fun c : N -> S ;
}

View File

@@ -3,4 +3,10 @@ import PGF2
main = do
gr <- readPGF "tests/basic.pgf"
runTestTTAndExit (TestCase (assertEqual "abstract names" "basic" (abstractName gr)))
runTestTTAndExit $
TestList [TestCase (assertEqual "abstract names" "basic" (abstractName gr))
,TestCase (assertEqual "abstract categories" ["Float","Int","N","S","String"] (categories gr))
,TestCase (assertEqual "abstract functions" ["c","s","z"] (functions gr))
,TestCase (assertEqual "abstract functions by cat 1" ["s","z"] (functionsByCat gr "N"))
,TestCase (assertEqual "abstract functions by cat 2" ["c"] (functionsByCat gr "S"))
]

Binary file not shown.