summaryrefslogtreecommitdiff
path: root/apps/examples/bas/tests/test06.bas
diff options
context:
space:
mode:
Diffstat (limited to 'apps/examples/bas/tests/test06.bas')
-rw-r--r--apps/examples/bas/tests/test06.bas42
1 files changed, 42 insertions, 0 deletions
diff --git a/apps/examples/bas/tests/test06.bas b/apps/examples/bas/tests/test06.bas
new file mode 100644
index 000000000..8a5402d04
--- /dev/null
+++ b/apps/examples/bas/tests/test06.bas
@@ -0,0 +1,42 @@
+#!/bin/sh
+
+echo -n $0: 'Recursive function without arguments... '
+
+cat >test.bas <<eof
+10 def fnloop
+20 if n=0.0 then
+30 r=0.0
+40 else
+50 print n
+60 n=n-1.0
+70 r=fnloop()
+80 end if
+90 =r
+100 n=10
+110 print fnloop
+eof
+
+cat >test.ref <<eof
+ 10
+ 9
+ 8
+ 7
+ 6
+ 5
+ 4
+ 3
+ 2
+ 1
+ 0
+eof
+
+sh ./test/runbas test.bas >test.data
+
+if cmp test.ref test.data
+then
+ rm -f test.*
+ echo passed
+else
+ echo failed
+ exit 1
+fi