summaryrefslogtreecommitdiff
path: root/apps/examples/bas/tests/test07.bas
blob: 57f2899a6d217d76111b2d66f3774eef1b0c8765 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/bin/sh

echo -n $0: 'Recursive function with arguments... '

cat >test.bas <<eof
10 def fna(x)
20   if x=0 then r=1 else r=x*fna(x-1)
30 =r
40 print fna(7)
eof

cat >test.ref <<eof
 5040 
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