mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-25 12:32:50 -06:00
correctly distinguish between fun and data judgements
This commit is contained in:
Binary file not shown.
19
src/runtime/haskell/tests/basic_cnc.gf
Normal file
19
src/runtime/haskell/tests/basic_cnc.gf
Normal file
@@ -0,0 +1,19 @@
|
||||
concrete basic_cnc of basic = open Prelude in {
|
||||
|
||||
lincat N = {s : Str; is_zero : Bool} ;
|
||||
lincat S = Str ;
|
||||
|
||||
lin z = {s="0"; is_zero=True} ;
|
||||
s n = {
|
||||
s = case n.is_zero of {
|
||||
True => "1" ;
|
||||
False => n.s ++ "+" ++ "1"
|
||||
} ;
|
||||
is_zero = False
|
||||
} ;
|
||||
|
||||
lin c n = n.s ;
|
||||
|
||||
lincat P = {};
|
||||
|
||||
}
|
||||
@@ -9,9 +9,9 @@ main = do
|
||||
gr1 <- readPGF "tests/basic.pgf"
|
||||
let Just ty = readType "(N -> N) -> P (s z)"
|
||||
|
||||
gr2 <- modifyPGF gr1 (createFunction "foo" ty 0 pi >>
|
||||
gr2 <- modifyPGF gr1 (createFunction "foo" ty 0 [] pi >>
|
||||
createCategory "Q" [(Explicit,"x",ty)] pi)
|
||||
gr3 <- branchPGF gr1 "bar_branch" (createFunction "bar" ty 0 pi >>
|
||||
gr3 <- branchPGF gr1 "bar_branch" (createFunction "bar" ty 0 [] pi >>
|
||||
createCategory "R" [(Explicit,"x",ty)] pi)
|
||||
|
||||
Just gr4 <- checkoutPGF gr1 "master"
|
||||
@@ -44,8 +44,8 @@ main = do
|
||||
,TestCase (assertEqual "new function prob" pi (functionProbability gr2 "foo"))
|
||||
,TestCase (assertEqual "old category prob" (-log 0) (categoryProbability gr1 "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 "empty concretes" ["basic_cnc"] (Map.keys (languages gr1)))
|
||||
,TestCase (assertEqual "extended concretes" ["basic_cnc","basic_eng"] (Map.keys (languages gr7)))
|
||||
,TestCase (assertEqual "added concrete flag" (Just (LStr "test")) (concreteFlag cnc "test_flag"))
|
||||
]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user