mirror of
https://github.com/apache/nuttx-apps.git
synced 2026-08-05 22:29:05 +00:00
25 lines
325 B
Bash
25 lines
325 B
Bash
#!/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
|