mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-09 04:59:31 -06:00
added test case for showPGF
This commit is contained in:
@@ -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
|
||||
|
||||
36
src/runtime/haskell/tests/basic.pmcfg
Normal file
36
src/runtime/haskell/tests/basic.pmcfg
Normal 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"
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user