forked from GitHub/gf-core
test cases for the concrete syntax
This commit is contained in:
@@ -62,4 +62,5 @@ test-suite transactions
|
|||||||
build-depends:
|
build-depends:
|
||||||
base,
|
base,
|
||||||
HUnit >= 1.6.1.0,
|
HUnit >= 1.6.1.0,
|
||||||
|
containers,
|
||||||
pgf2
|
pgf2
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import PGF2
|
|||||||
import PGF2.Transactions
|
import PGF2.Transactions
|
||||||
import System.Mem
|
import System.Mem
|
||||||
import System.Exit (exitSuccess, exitFailure)
|
import System.Exit (exitSuccess, exitFailure)
|
||||||
|
import qualified Data.Map as Map
|
||||||
|
|
||||||
main = do
|
main = do
|
||||||
gr1 <- readPGF "tests/basic.pgf"
|
gr1 <- readPGF "tests/basic.pgf"
|
||||||
@@ -18,6 +19,11 @@ main = do
|
|||||||
|
|
||||||
gr6 <- modifyPGF gr1 (dropFunction "ind" >> dropCategory "S")
|
gr6 <- modifyPGF gr1 (dropFunction "ind" >> dropCategory "S")
|
||||||
|
|
||||||
|
gr7 <- modifyPGF gr1 $
|
||||||
|
createConcrete "basic_eng" $ do
|
||||||
|
setConcreteFlag "test_flag" (LStr "test")
|
||||||
|
let Just cnc = Map.lookup "basic_eng" (languages gr7)
|
||||||
|
|
||||||
c <- runTestTT $
|
c <- runTestTT $
|
||||||
TestList $
|
TestList $
|
||||||
[TestCase (assertEqual "original functions" ["c","ind","s","z"] (functions gr1))
|
[TestCase (assertEqual "original functions" ["c","ind","s","z"] (functions gr1))
|
||||||
@@ -38,6 +44,9 @@ main = do
|
|||||||
,TestCase (assertEqual "new function prob" pi (functionProbability gr2 "foo"))
|
,TestCase (assertEqual "new function prob" pi (functionProbability gr2 "foo"))
|
||||||
,TestCase (assertEqual "old category prob" (-log 0) (categoryProbability gr1 "Q"))
|
,TestCase (assertEqual "old category prob" (-log 0) (categoryProbability gr1 "Q"))
|
||||||
,TestCase (assertEqual "new category prob" pi (categoryProbability gr2 "Q"))
|
,TestCase (assertEqual "new category prob" pi (categoryProbability gr2 "Q"))
|
||||||
|
,TestCase (assertEqual "empty concretes" [] (Map.keys (languages gr1)))
|
||||||
|
,TestCase (assertEqual "extended concretes" ["basic_eng"] (Map.keys (languages gr7)))
|
||||||
|
,TestCase (assertEqual "added concrete flag" (Just (LStr "test")) (concreteFlag cnc "test_flag"))
|
||||||
]
|
]
|
||||||
|
|
||||||
performMajorGC
|
performMajorGC
|
||||||
|
|||||||
Reference in New Issue
Block a user