summaryrefslogtreecommitdiffstats
path: root/test/fib.t
diff options
context:
space:
mode:
authorBenedikt Böhm <bb@xnull.de>2009-07-07 10:43:01 +0200
committerBenedikt Böhm <bb@xnull.de>2009-07-07 10:43:01 +0200
commit8582e3520ff487ea71e68a10fa8641fd95e74706 (patch)
tree6e8a84141d45b6bd4f1bfa494b1dbe7270627754 /test/fib.t
parent4ad083bf274a972ed7286b9b52179e30873aa830 (diff)
downloadswppy-8582e3520ff487ea71e68a10fa8641fd95e74706.tar.gz
swppy-8582e3520ff487ea71e68a10fa8641fd95e74706.tar.xz
swppy-8582e3520ff487ea71e68a10fa8641fd95e74706.zip
cleanup test code
Diffstat (limited to 'test/fib.t')
-rw-r--r--test/fib.t18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/fib.t b/test/fib.t
new file mode 100644
index 0000000..2a24f6d
--- /dev/null
+++ b/test/fib.t
@@ -0,0 +1,18 @@
+fun fib[a]
+ if a < 2
+ @1
+ end
+ @( call fib[a-1] + call fib[a-2] )
+end
+
+# main function
+fun main[num]
+ sum = 0
+ i = 0
+ while (i < num)
+ sum = sum + call fib[i]
+ i = i + 1
+ end
+ print sum
+ @0
+end