BAS: Misc changes to test files

This commit is contained in:
Gregory Nutt 2014-11-09 08:20:19 -06:00
parent 58878c6ec9
commit 4f1d02e5cf
5 changed files with 379 additions and 340 deletions

View File

@ -9,7 +9,11 @@ config EXAMPLES_BASTEST
depends on INTERPRETERS_BAS depends on INTERPRETERS_BAS
select FS_ROMFS select FS_ROMFS
---help--- ---help---
Mount the ROMFS file system containing the BAS test files at /mnt/romfs. Mount the ROMFS file system containing the BAS test files at
/mnt/romfs.
The logic in certain tests (test33.bas and test36.bas will also fail
if there is no writable file system mount at /tmp.
if EXAMPLES_BASTEST if EXAMPLES_BASTEST
@ -17,16 +21,18 @@ config EXAMPLES_BASTEST_DEVMINOR
int "ROMFS Minor Device Number" int "ROMFS Minor Device Number"
default 0 default 0
---help--- ---help---
The minor device number of the ROMFS block. For example, the N in /dev/ramN. The minor device number of the ROMFS block. For example, the N in
Used for registering the RAM block driver that will hold the ROMFS file system /dev/ramN. Used for registering the RAM block driver that will hold
containing the BASIC files to be tested. Default: 0 the ROMFS file system containing the BASIC files to be tested.
Default: 0
config EXAMPLES_BASTEST_DEVPATH config EXAMPLES_BASTEST_DEVPATH
string "ROMFS Device Path" string "ROMFS Device Path"
default "/dev/ram0" default "/dev/ram0"
---help--- ---help---
The path to the ROMFS block driver device. This must match EXAMPLES_BASTEST_DEVMINOR. The path to the ROMFS block driver device. This must match
Used for registering the RAM block driver that will hold the ROMFS file system EXAMPLES_BASTEST_DEVMINOR. Used for registering the RAM block driver
containing the BASIC files to be tested. Default: "/dev/ram0" that will hold the ROMFS file system containing the BASIC files to
be tested. Default: "/dev/ram0"
endif endif

View File

@ -72,8 +72,14 @@ Expected Result
1 1
hello hello
0.0002 0.0002
2e-06 0.000
2e-07 0.0000020
0.0000002
Notes
-----
Output would differ on other platforms NttX does not use scientific
notation in floating point output.
test02.bas test02.bas
========== ==========
@ -1089,10 +1095,10 @@ Test File
Expected Result Expected Result
--------------- ---------------
1.333333e-08 1e-08 0.0000000 0.0000000
1.333333e-07 1e-07 0.0000001 0.0000001
1.333333e-06 1e-06 0.0000013 0.0000010
1.333333e-05 1e-05 0.0000133 0.0000100
0.000133 0.0001 0.000133 0.0001
0.001333 0.001 0.001333 0.001
0.013333 0.01 0.013333 0.01
@ -1104,8 +1110,13 @@ Expected Result
13333.33 10000 13333.33 10000
133333.3 100000 133333.3 100000
1333333 1000000 1333333 1000000
1.333333e+07 1e+07 13333333.3333333 10000000.0000000
1.333333e+08 1e+08 133333333.3333333 100000000.0000000
Notes
-----
Output would differ on other platforms NttX does not use scientific
notation in floating point output.
test032.bas test032.bas
========== ==========
@ -1131,13 +1142,13 @@ OPEN FOR BINARY
Test File Test File
--------- ---------
open "test.out" for binary as 1 open "/tmp/test.out" for binary as 1
put 1,1,"xy" put 1,1,"xy"
put 1,3,"z!" put 1,3,"z!"
put 1,10,1/3 put 1,10,1/3
put 1,20,9999 put 1,20,9999
close 1 close 1
open "test.out" for binary as 1 open "/tmp/test.out" for binary as 1
s$=" " s$=" "
get 1,1,s$ get 1,1,s$
get 1,10,x get 1,10,x
@ -1146,7 +1157,7 @@ close
print s$ print s$
print x print x
print n% print n%
kill "test.out" kill "/tmp/test.out"
Expected Result Expected Result
--------------- ---------------
@ -1154,6 +1165,12 @@ xyz!
0.333333 0.333333
9999 9999
Notes
-----
The logic in this test will fail if there is no writable file system
mount at /tmp.
test34.bas test34.bas
========== ==========
OPTION BASE OPTION BASE
@ -1217,7 +1234,7 @@ Test File
--------- ---------
on error goto 10 on error goto 10
print "opening file" print "opening file"
open "test.out" for output lock write as #1 open "/tmp/test.out" for output lock write as #1
print "open succeeded" print "open succeeded"
if command$<>"enough" then shell "sh ./test/runbas test.bas enough" if command$<>"enough" then shell "sh ./test/runbas test.bas enough"
end end
@ -1230,21 +1247,31 @@ open succeeded
opening file opening file
open failed open failed
Notes
-----
The logic in this test will fail if there is no writable file system
mount at /tmp.
test37.bas test37.bas
========== ==========
LINE INPUT reaching EOF LINE INPUT reaching EOF
Test File Test File
--------- ---------
10 open "i",1,"test.ref" 10 open "i",1,"/mnt/romfs/test37.dat"
20 while not eof(1) 20 while not eof(1)
30 line input #1,a$ 30 line input #1,a$
40 if a$="abc" then print a$; else print "def" 40 if a$="abc" then print a$; else print "def"
50 wend 50 wend
Data file (/mnt/romfs/test37.dat)
-------------------------------
abc
Result Result
------ ------
Output should match test.ref abc
test38.bas test38.bas
========== ==========
@ -1561,6 +1588,12 @@ Expected Result
9.650995e+07 9.650995e+07
1 1
Notes
-----
Output will differ because NuttX does not use scientific notation in
output. Some minor rounding differences may also be expected.
test50.bas test50.bas
========== ==========
Min and max function Min and max function
@ -1597,8 +1630,7 @@ PRINT "Line 1";TAB(78);1.23456789
Expected Result Expected Result
--------------- ---------------
Line 1 Line 1 1.234568
1.234568
test52.bas test52.bas
========== ==========

View File

@ -1,10 +1,10 @@
open "test.out" for binary as 1 open "/tmp/test.out" for binary as 1
put 1,1,"xy" put 1,1,"xy"
put 1,3,"z!" put 1,3,"z!"
put 1,10,1/3 put 1,10,1/3
put 1,20,9999 put 1,20,9999
close 1 close 1
open "test.out" for binary as 1 open "/tmp/test.out" for binary as 1
s$=" " s$=" "
get 1,1,s$ get 1,1,s$
get 1,10,x get 1,10,x
@ -13,5 +13,5 @@ close
print s$ print s$
print x print x
print n% print n%
kill "test.out" kill "/tmp/test.out"

View File

@ -1,6 +1,6 @@
on error goto 10 on error goto 10
print "opening file" print "opening file"
open "test.out" for output lock write as #1 open "/tmp/test.out" for output lock write as #1
print "open succeeded" print "open succeeded"
if command$<>"enough" then shell "sh ./test/runbas test.bas enough" if command$<>"enough" then shell "sh ./test/runbas test.bas enough"
end end

View File

@ -0,0 +1 @@
abc