From f8af5122b5dd1e09288df59e5f6d77705f99b287 Mon Sep 17 00:00:00 2001 From: krasimir Date: Tue, 12 Jan 2010 13:18:37 +0000 Subject: [PATCH] additional tests for linearizations --- testsuite/runtime/linearize/Test.gf | 13 ++++++--- testsuite/runtime/linearize/TestCnc.gf | 11 +++++++- testsuite/runtime/linearize/linearize.gfs | 11 +++++++- .../runtime/linearize/linearize.gfs.gold | 27 +++++++++++++++++++ 4 files changed, 57 insertions(+), 5 deletions(-) diff --git a/testsuite/runtime/linearize/Test.gf b/testsuite/runtime/linearize/Test.gf index 2b7459806..db120bcc3 100644 --- a/testsuite/runtime/linearize/Test.gf +++ b/testsuite/runtime/linearize/Test.gf @@ -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 ; } \ No newline at end of file diff --git a/testsuite/runtime/linearize/TestCnc.gf b/testsuite/runtime/linearize/TestCnc.gf index 025e7af34..81353e35e 100644 --- a/testsuite/runtime/linearize/TestCnc.gf +++ b/testsuite/runtime/linearize/TestCnc.gf @@ -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"} ; + } \ No newline at end of file diff --git a/testsuite/runtime/linearize/linearize.gfs b/testsuite/runtime/linearize/linearize.gfs index 6ffeb52b6..ba4486217 100644 --- a/testsuite/runtime/linearize/linearize.gfs +++ b/testsuite/runtime/linearize/linearize.gfs @@ -1,3 +1,12 @@ i -src testsuite/runtime/linearize/TestCnc.gf -l Exist (\x -> Even x) +l Even ? +l Exist (\x -> S> x) +l f a +l fa a +l fb a +l IsString "abcd" +l IsInteger 100 +l IsFloat 12.4 +l +l <\x -> x : S -> S> \ No newline at end of file diff --git a/testsuite/runtime/linearize/linearize.gfs.gold b/testsuite/runtime/linearize/linearize.gfs.gold index 22477a5ba..90630ee0b 100644 --- a/testsuite/runtime/linearize/linearize.gfs.gold +++ b/testsuite/runtime/linearize/linearize.gfs.gold @@ -1,3 +1,30 @@ +?1 is even + + exists x such that x is even +a + + +aa a + + +a b + + +abcd is string + + +100 is integer + + +12.4 is float + + +xyz is string + + + + +