1
0
forked from GitHub/gf-core

added test case for showPGF

This commit is contained in:
krangelov
2021-11-18 13:55:57 +01:00
parent 06980404a9
commit f8fb64a53e
2 changed files with 40 additions and 0 deletions

View File

@@ -6,6 +6,7 @@ import PGF2
main = do
g <- newStdGen
let
limit = 10 ^ 100
ns = take 5000 (randomRs (-limit,limit) g)
@@ -79,6 +80,7 @@ main = do
gr1 <- readPGF "tests/basic.pgf"
gr2 <- bootNGF "tests/basic.pgf" "tests/basic.ngf"
gr3 <- readNGF "tests/basic.ngf"
pmcfg <- readFile "tests/basic.pmcfg"
rp1 <- testLoadFailure (readPGF "non-existing.pgf")
rp2 <- testLoadFailure (readPGF "tests/basic.gf")
@@ -103,6 +105,8 @@ main = do
,TestCase (assertBool "wrong file format (GF)" rn2)
,TestCase (assertBool "wrong file format (PGF)" rn3)
,TestCase (assertEqual "show pgf" (init pmcfg) (showPGF gr1))
]
++ grammarTests gr1
++ grammarTests gr2

View File

@@ -0,0 +1,36 @@
abstract basic {
cat Float ; -- 0.693147
cat Int ; -- 0.693147
cat N ; -- 0.693147
cat P N ; -- 0.693147
cat S ; -- 0.693147
cat String ; -- 0.693147
data c : N -> S ; -- -0
fun ind : P z -> ((x : N) -> P x -> P (s x)) -> (x : N) -> P x ; -- -0
data s : N -> N ; -- 0.693147
data z : N ; -- 0.693147
}
concrete basic_cnc {
lincat N = [
"s"
]
lincat P = [
]
lincat S = [
""
]
lin c : N(j) -> S(0) = [
<0,0>
]
lin ind : P(0) * P(0) * N(j) -> P(0) = [
]
lin s : N(0) -> N(0) = [
<0,0> "+" "1"
]
lin s : N(1) -> N(0) = [
"1"
]
lin z : N(1) = [
"0"
]
}