additional tests for linearizations

This commit is contained in:
krasimir
2010-01-12 13:18:37 +00:00
parent 712d079e7c
commit f8af5122b5
4 changed files with 57 additions and 5 deletions

View File

@@ -1,9 +1,16 @@
abstract Test = {
cat P ;
cat S ;
cat E ;
fun Exist : (E -> P) -> P ;
Even : E -> P ;
fun Exist : (E -> S) -> S ;
Even : E -> S ;
fun a : E ;
f,fa,fb : E -> S ;
fun IsString : String -> S ;
IsInteger : Int -> S ;
IsFloat : Float -> S ;
}

View File

@@ -4,9 +4,18 @@ param Number = Pl | Sg;
lincat E = {s:Str; n : Number} ;
lindef E = \s -> {s=s; n=Sg} ;
lincat P = {s:Str} ;
lincat S = {s:Str} ;
lin Exist f = {s = "exists" ++ f.$0 ++ "such that" ++ f.s};
lin Even x = {s = x.s ++ case x.n of {Sg => "is"; Pl => "are"} ++ "even"};
lin a = {s = pre {"a"; "aa" / strs {"a"}}; n = Pl} ;
lin f a = {s = a.s};
lin fa a = {s = a.s ++ "a"};
lin fb a = {s = a.s ++ "b"};
lin IsString x = {s = x.s ++ "is string"} ;
lin IsInteger x = {s = x.s ++ "is integer"} ;
lin IsFloat x = {s = x.s ++ "is float"} ;
}

View File

@@ -1,3 +1,12 @@
i -src testsuite/runtime/linearize/TestCnc.gf
l Exist (\x -> Even x)
l Even ?
l Exist (\x -> <Even : E -> S> x)
l f a
l fa a
l fb a
l IsString "abcd"
l IsInteger 100
l IsFloat 12.4
l <IsString "xyz" : S>
l <\x -> x : S -> S>

View File

@@ -1,3 +1,30 @@
?1 is even
exists x such that x is even
a
aa a
a b