mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-20 18:29:33 -06:00
added working transactions. still not atomic
This commit is contained in:
@@ -74,11 +74,8 @@ main = do
|
||||
print (e :: SomeException)
|
||||
|
||||
gr1 <- readPGF "tests/basic.pgf"
|
||||
print (abstractName gr1)
|
||||
gr2 <- bootNGF "tests/basic.pgf" "tests/basic.ngf"
|
||||
print (abstractName gr2)
|
||||
gr3 <- readNGF "tests/basic.ngf"
|
||||
print (abstractName gr3)
|
||||
|
||||
rp1 <- testLoadFailure (readPGF "non-existing.pgf")
|
||||
rp2 <- testLoadFailure (readPGF "tests/basic.gf")
|
||||
|
||||
18
src/runtime/haskell/tests/transactions.hs
Normal file
18
src/runtime/haskell/tests/transactions.hs
Normal file
@@ -0,0 +1,18 @@
|
||||
import Test.HUnit
|
||||
import PGF2
|
||||
import PGF2.Transactions
|
||||
|
||||
main = do
|
||||
gr1 <- readPGF "tests/basic.pgf"
|
||||
let Just ty = readType "(N -> N) -> P (s z)"
|
||||
gr2 <- modifyPGF gr1 (createFunction "foo" ty pi)
|
||||
|
||||
runTestTTAndExit $
|
||||
TestList $
|
||||
[TestCase (assertEqual "original functions" ["c","ind","s","z"] (functions gr1))
|
||||
,TestCase (assertEqual "extended functions" ["c","foo","ind","s","z"] (functions gr2))
|
||||
,TestCase (assertEqual "old function type" Nothing (functionType gr1 "foo"))
|
||||
,TestCase (assertEqual "new function type" (Just ty) (functionType gr2 "foo"))
|
||||
,TestCase (assertEqual "old function prob" (-log 0) (functionProb gr1 "foo"))
|
||||
,TestCase (assertEqual "new function prob" pi (functionProb gr2 "foo"))
|
||||
]
|
||||
Reference in New Issue
Block a user