From 02b22b8b78606ee185af4d7c4817d5144d326331 Mon Sep 17 00:00:00 2001 From: krasimir Date: Tue, 7 Jul 2009 11:40:14 +0000 Subject: [PATCH] added testcases for evaluation with suspension --- testsuite/runtime/eval/Test.gf | 13 +++++++++++++ testsuite/runtime/eval/eval.gfs | 5 +++++ testsuite/runtime/eval/eval.gfs.gold | 10 ++++++++++ 3 files changed, 28 insertions(+) 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 +