summaryrefslogtreecommitdiff
path: root/test/typecheck
diff options
context:
space:
mode:
authorBrian Campbell2019-03-05 17:51:02 +0000
committerBrian Campbell2019-03-05 17:51:02 +0000
commit1425334fddf6c2147884edc18cfdf2cf0edb880a (patch)
tree5d63eb8625f2b5cea5a30778405f856d5caff547 /test/typecheck
parent25899e3f0b0c2b21da26111ce8691cf5a16f3bd5 (diff)
Add forgotten recursive function test
Diffstat (limited to 'test/typecheck')
-rw-r--r--test/typecheck/pass/recursion.sail15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/typecheck/pass/recursion.sail b/test/typecheck/pass/recursion.sail
new file mode 100644
index 00000000..5ca85f53
--- /dev/null
+++ b/test/typecheck/pass/recursion.sail
@@ -0,0 +1,15 @@
+default Order dec
+
+$include <prelude.sail>
+
+val log2 : int -> int
+
+function log2(n) =
+ if n <= 1 then 0 else 1 + log2(n/2)
+
+termination_measure log2(n) = n
+
+val testlog2 : unit -> unit effect {escape}
+
+function testlog2() =
+ assert(log2(64) == 6)