summaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorkrasimir <krasimir@chalmers.se>2009-07-07 11:40:14 +0000
committerkrasimir <krasimir@chalmers.se>2009-07-07 11:40:14 +0000
commit5abc99b291b01ce9619e51cb21a397a5c0c89a72 (patch)
tree0243225d58bbe10fe19bff202fab0a9d3cd8bd77 /testsuite
parentfd03f9fa0f799fabaef7b850d6b4808f280fdf1d (diff)
added testcases for evaluation with suspension
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/runtime/eval/Test.gf13
-rw-r--r--testsuite/runtime/eval/eval.gfs5
-rw-r--r--testsuite/runtime/eval/eval.gfs.gold10
3 files changed, 28 insertions, 0 deletions
diff --git a/testsuite/runtime/eval/Test.gf b/testsuite/runtime/eval/Test.gf
index 7d7edf369..71a7dc2c2 100644
--- a/testsuite/runtime/eval/Test.gf
+++ b/testsuite/runtime/eval/Test.gf
@@ -11,6 +11,9 @@ def g2 1 x = x ;
fun g0 : Int -> Int -> Int ;
def g0 = g2 ;
+fun g3 : Int -> (Int -> Int) ;
+def g3 3 = g ;
+
fun const : Int -> Int -> Int ;
def const x _ = x ;
@@ -25,4 +28,14 @@ def dec zero = zero ;
dec (succ n) = n ;
dec n = err ; -- for fall through checking
+fun plus : Nat -> Nat -> Nat ;
+def plus err zero = err ;
+ plus m err = err ;
+ plus m zero = m ;
+ plus m (succ n) = plus (succ m) n ;
+
+fun dec2 : Int -> Nat -> Nat ;
+def dec2 0 zero = err ;
+ dec2 _ (succ n) = n ;
+
} \ No newline at end of file
diff --git a/testsuite/runtime/eval/eval.gfs b/testsuite/runtime/eval/eval.gfs
index 1ce8cb1b5..dd1cede9c 100644
--- a/testsuite/runtime/eval/eval.gfs
+++ b/testsuite/runtime/eval/eval.gfs
@@ -27,3 +27,8 @@ pt -compute dec (succ (succ zero))
pt -compute dec (succ ?)
pt -compute \x -> dec x
pt -compute dec ?
+pt -compute (\f -> f 0) (g3 ?)
+pt -compute g (g2 ? 0)
+pt -compute plus (succ zero) (succ zero)
+pt -compute dec2 0 (succ zero)
+pt -compute plus err (succ zero) \ No newline at end of file
diff --git a/testsuite/runtime/eval/eval.gfs.gold b/testsuite/runtime/eval/eval.gfs.gold
index 87b0b8cc4..861c8534c 100644
--- a/testsuite/runtime/eval/eval.gfs.gold
+++ b/testsuite/runtime/eval/eval.gfs.gold
@@ -48,3 +48,13 @@ succ zero
dec ?
+g3 ? 0
+
+g (g2 ? 0)
+
+succ (succ zero)
+
+zero
+
+succ err
+