summaryrefslogtreecommitdiff
path: root/apps/examples/bas/tests/test03.bas
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2014-11-07 14:02:53 -0600
committerGregory Nutt <gnutt@nuttx.org>2014-11-07 14:02:53 -0600
commit20c645e1cdf2456d09e3c85d2b21e4c32b88b83e (patch)
treec6832ac6658ee21dfd732cada7a06196f13fcd0f /apps/examples/bas/tests/test03.bas
parent7711da2981698ff86c0b7a4b49bbc44f0f26a834 (diff)
downloadnuttx-20c645e1cdf2456d09e3c85d2b21e4c32b88b83e.tar.gz
nuttx-20c645e1cdf2456d09e3c85d2b21e4c32b88b83e.tar.bz2
nuttx-20c645e1cdf2456d09e3c85d2b21e4c32b88b83e.zip
BAS: Move test files from apps/interpreter/bas to apps/examples/bas
Diffstat (limited to 'apps/examples/bas/tests/test03.bas')
-rw-r--r--apps/examples/bas/tests/test03.bas56
1 files changed, 56 insertions, 0 deletions
diff --git a/apps/examples/bas/tests/test03.bas b/apps/examples/bas/tests/test03.bas
new file mode 100644
index 000000000..b7b1496e0
--- /dev/null
+++ b/apps/examples/bas/tests/test03.bas
@@ -0,0 +1,56 @@
+#!/bin/sh
+
+echo -n $0: 'FOR loops... '
+
+cat >test.bas <<eof
+ 10 for i=0 to 10
+ 20 print i
+ 30 if i=5 then exit for
+ 40 next
+ 50 for i=0 to 0
+ 60 print i
+ 70 next I
+ 80 for i=1 to 0 step -1
+ 90 print i
+100 next
+110 for i=1 to 0
+120 print i
+130 next
+140 for i$="" to "aaaaaaaaaa" step "a"
+150 print i$
+160 next
+eof
+
+cat >test.ref <<eof
+ 0
+ 1
+ 2
+ 3
+ 4
+ 5
+ 0
+ 1
+ 0
+
+a
+aa
+aaa
+aaaa
+aaaaa
+aaaaaa
+aaaaaaa
+aaaaaaaa
+aaaaaaaaa
+aaaaaaaaaa
+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