BAS: Convert all BAS text scripts to BASIC files
This commit is contained in:
parent
d6155e75fb
commit
ae574b0251
@ -23,7 +23,7 @@ hello
|
||||
2e-06
|
||||
2e-07
|
||||
|
||||
test01.bas
|
||||
test02.bas
|
||||
==========
|
||||
Array variable assignment
|
||||
|
||||
@ -43,7 +43,7 @@ Expected Result
|
||||
11
|
||||
12
|
||||
|
||||
test01.bas
|
||||
test03.bas
|
||||
==========
|
||||
FOR loops
|
||||
|
||||
@ -89,7 +89,7 @@ aaaaaaaa
|
||||
aaaaaaaaa
|
||||
aaaaaaaaaa
|
||||
|
||||
test01.bas
|
||||
test04.bas
|
||||
==========
|
||||
REPEAT UNTIL loop
|
||||
|
||||
@ -113,7 +113,7 @@ Expected Result
|
||||
8
|
||||
9
|
||||
|
||||
test01.bas
|
||||
test05.bas
|
||||
==========
|
||||
GOSUB RETURN subroutines
|
||||
|
||||
@ -134,7 +134,7 @@ hello, world
|
||||
hello, world
|
||||
hello, world
|
||||
|
||||
test01.bas
|
||||
test06.bas
|
||||
==========
|
||||
Recursive function without arguments
|
||||
|
||||
@ -166,7 +166,7 @@ Expected Result
|
||||
1
|
||||
0
|
||||
|
||||
test01.bas
|
||||
test07.bas
|
||||
==========
|
||||
Recursive function with arguments
|
||||
|
||||
@ -181,7 +181,7 @@ Expected Result
|
||||
---------------
|
||||
5040
|
||||
|
||||
test01.bas
|
||||
test08.bas
|
||||
==========
|
||||
DATA, READ and RESTORE
|
||||
|
||||
@ -205,7 +205,7 @@ Error: end of `data' in line 80 at:
|
||||
80 read j$,k$
|
||||
^
|
||||
|
||||
test01.bas
|
||||
test09.bas
|
||||
==========
|
||||
LOCAL variables
|
||||
|
||||
@ -226,7 +226,7 @@ Expected Result
|
||||
5
|
||||
3
|
||||
|
||||
test01.bas
|
||||
test10.bas
|
||||
==========
|
||||
PRINT USING
|
||||
|
||||
@ -296,7 +296,7 @@ aSbaTb
|
||||
aSb
|
||||
aSbTc
|
||||
|
||||
test01.bas
|
||||
test11.bas
|
||||
==========
|
||||
OPEN and LINE INPUT
|
||||
|
||||
@ -316,7 +316,7 @@ Expected Result
|
||||
40 print a$
|
||||
50 wend
|
||||
|
||||
test01.bas
|
||||
test12.bas
|
||||
==========
|
||||
Exception handling
|
||||
|
||||
@ -354,7 +354,7 @@ Expected Result
|
||||
a
|
||||
c
|
||||
|
||||
test01.bas
|
||||
test14.bas
|
||||
==========
|
||||
SELECT CASE
|
||||
|
||||
@ -586,7 +586,7 @@ i after case else
|
||||
9 9
|
||||
i after case else
|
||||
|
||||
test01.bas
|
||||
test15.bas
|
||||
==========
|
||||
FIELD, PUT and GET
|
||||
|
||||
@ -617,7 +617,7 @@ a$=hi ya
|
||||
after close a$=
|
||||
after get b$=hi ya
|
||||
|
||||
test01.bas
|
||||
test16.bas
|
||||
==========
|
||||
SWAP
|
||||
|
||||
@ -640,7 +640,7 @@ a= 2 b= 1
|
||||
a$(1,0)=ab$(0,1)=b
|
||||
a$(1,0)=bb$(0,1)=a
|
||||
|
||||
test01.bas
|
||||
test17.bas
|
||||
==========
|
||||
DO, EXIT DO, LOOP
|
||||
|
||||
@ -670,7 +670,7 @@ i is 9
|
||||
i is 10
|
||||
loop ended
|
||||
|
||||
test01.bas
|
||||
test18.bas
|
||||
==========
|
||||
DO WHILE, LOOP
|
||||
|
||||
@ -703,7 +703,7 @@ y$ is
|
||||
y$ is b
|
||||
loop ended
|
||||
|
||||
test01.bas
|
||||
test19.bas
|
||||
==========
|
||||
ELSEIF
|
||||
|
||||
@ -738,7 +738,7 @@ Expected Result
|
||||
2b
|
||||
3b
|
||||
|
||||
test01.bas
|
||||
test20.bas
|
||||
==========
|
||||
Caller trace
|
||||
|
||||
@ -774,7 +774,7 @@ Called in line 10 at:
|
||||
10 gosub 20
|
||||
^
|
||||
|
||||
test01.bas
|
||||
test21.bas
|
||||
==========
|
||||
Matrix assignment
|
||||
|
||||
@ -807,7 +807,7 @@ Expected Result
|
||||
0 21 22 23 24
|
||||
0 31 32 33 34
|
||||
|
||||
test01.bas
|
||||
test22.bas
|
||||
==========
|
||||
MAT PRINT
|
||||
|
||||
@ -837,7 +837,7 @@ Expected Result
|
||||
11.00 12.00
|
||||
21.00 22.00
|
||||
|
||||
test01.bas
|
||||
test23.bas
|
||||
==========
|
||||
Matrix addition and subtraction
|
||||
|
||||
@ -867,7 +867,7 @@ hi
|
||||
|
||||
hihi
|
||||
|
||||
test01.bas
|
||||
test24.bas
|
||||
==========
|
||||
Matrix multiplication
|
||||
|
||||
@ -893,7 +893,7 @@ Expected Result
|
||||
14 13
|
||||
10 11
|
||||
|
||||
test01.bas
|
||||
test25.bas
|
||||
==========
|
||||
Matrix scalar multiplication
|
||||
|
||||
@ -933,7 +933,7 @@ Expected Result
|
||||
254
|
||||
99.9998
|
||||
|
||||
test01.bas
|
||||
test26.bas
|
||||
==========
|
||||
MAT READ
|
||||
|
||||
@ -949,7 +949,7 @@ Expected Result
|
||||
5 5 5
|
||||
8 8 8
|
||||
|
||||
test01.bas
|
||||
test27.bas
|
||||
==========
|
||||
Matrix inversion
|
||||
|
||||
@ -972,7 +972,7 @@ Expected Result
|
||||
1 0
|
||||
0 1
|
||||
|
||||
test01.bas
|
||||
test28.bas
|
||||
==========
|
||||
TDL BASIC FNRETURN/FNEND
|
||||
|
||||
@ -988,7 +988,7 @@ Expected Result
|
||||
---------------
|
||||
3628800
|
||||
|
||||
test01.bas
|
||||
test29.bas
|
||||
==========
|
||||
TDL INSTR
|
||||
|
||||
@ -1010,7 +1010,7 @@ Expected Result
|
||||
0 = 0?
|
||||
8 = 8?
|
||||
|
||||
test01.bas
|
||||
test30.bas
|
||||
==========
|
||||
Type mismatch check
|
||||
|
||||
@ -1022,7 +1022,7 @@ Expected Result
|
||||
---------------
|
||||
Error: Invalid binary operand at: end of program
|
||||
|
||||
test01.bas
|
||||
test31.bas
|
||||
==========
|
||||
PRINT default format
|
||||
|
||||
@ -1055,7 +1055,7 @@ Expected Result
|
||||
1.333333e+07 1e+07
|
||||
1.333333e+08 1e+08
|
||||
|
||||
test01.bas
|
||||
test032.bas
|
||||
==========
|
||||
SUB routines
|
||||
|
||||
@ -1073,7 +1073,7 @@ Expected Result
|
||||
---------------
|
||||
abc
|
||||
|
||||
test01.bas
|
||||
test33.bas
|
||||
==========
|
||||
OPEN FOR BINARY
|
||||
|
||||
@ -1102,7 +1102,7 @@ xyz!
|
||||
0.333333
|
||||
9999
|
||||
|
||||
test01.bas
|
||||
test34.bas
|
||||
==========
|
||||
OPTION BASE
|
||||
|
||||
@ -1135,7 +1135,7 @@ Expected Result
|
||||
10
|
||||
20
|
||||
|
||||
test01.bas
|
||||
test35.bas
|
||||
==========
|
||||
Real to integer conversion
|
||||
|
||||
@ -1157,7 +1157,7 @@ Expected Result
|
||||
0
|
||||
-1
|
||||
|
||||
test01.bas
|
||||
test36.bas
|
||||
==========
|
||||
OPEN file locking
|
||||
|
||||
@ -1178,7 +1178,7 @@ open succeeded
|
||||
opening file
|
||||
open failed
|
||||
|
||||
test01.bas
|
||||
test37.bas
|
||||
==========
|
||||
LINE INPUT reaching EOF
|
||||
|
||||
@ -1194,7 +1194,7 @@ Result
|
||||
------
|
||||
Output should match test.ref
|
||||
|
||||
test01.bas
|
||||
test38.bas
|
||||
==========
|
||||
MAT REDIM
|
||||
|
||||
@ -1241,7 +1241,7 @@ Expected Result
|
||||
0
|
||||
0
|
||||
|
||||
test01.bas
|
||||
test39.bas
|
||||
==========
|
||||
Nested function and procedure calls
|
||||
|
||||
@ -1263,7 +1263,7 @@ Expected Result
|
||||
---------------
|
||||
6
|
||||
|
||||
test01.bas
|
||||
test40.bas
|
||||
==========
|
||||
IMAGE
|
||||
|
||||
@ -1279,7 +1279,7 @@ Expected Result
|
||||
3.1
|
||||
3.10
|
||||
|
||||
test01.bas
|
||||
test41.bas
|
||||
==========
|
||||
EXIT FUNCTION
|
||||
|
||||
@ -1301,7 +1301,7 @@ f running
|
||||
f running
|
||||
42
|
||||
|
||||
test01.bas
|
||||
test42.bas
|
||||
==========
|
||||
Arithmetic
|
||||
|
||||
@ -1327,7 +1327,7 @@ Expected Result
|
||||
-0.3
|
||||
0.3
|
||||
|
||||
test01.bas
|
||||
test43.bas
|
||||
==========
|
||||
Matrix multiplication size checks
|
||||
|
||||
@ -1358,7 +1358,7 @@ Error: Dimension mismatch in line 14 at:
|
||||
mat c=a*b
|
||||
^
|
||||
|
||||
test01.bas
|
||||
test44.bas
|
||||
==========
|
||||
DELETE
|
||||
|
||||
@ -1374,7 +1374,6 @@ Test File
|
||||
|
||||
Usage
|
||||
-----
|
||||
|
||||
load "test.bas"
|
||||
delete -20
|
||||
delete 60-
|
||||
@ -1387,7 +1386,7 @@ Expected Result
|
||||
Error: No such line at: 15
|
||||
50 print 50
|
||||
|
||||
test01.bas
|
||||
test45.bas
|
||||
==========
|
||||
MID$ on left side
|
||||
|
||||
@ -1408,7 +1407,7 @@ Expected Result
|
||||
01234ABCD9
|
||||
01234ABCD9
|
||||
|
||||
test01.bas
|
||||
test46.bas
|
||||
==========
|
||||
END used without program
|
||||
|
||||
@ -1420,7 +1419,7 @@ Expected Result
|
||||
---------------
|
||||
1 2 3 4 5 6 7 8 9 10
|
||||
|
||||
test01.bas
|
||||
test47.bas
|
||||
==========
|
||||
MAT WRITE
|
||||
|
||||
@ -1446,7 +1445,7 @@ Expected Result
|
||||
21,22,23,24
|
||||
31,32,33,34
|
||||
|
||||
test01.bas
|
||||
test48.bas
|
||||
==========
|
||||
Multi assignment
|
||||
|
||||
@ -1466,7 +1465,7 @@ Expected Result
|
||||
2 0 2
|
||||
test test
|
||||
|
||||
test01.bas
|
||||
test49.bas
|
||||
==========
|
||||
Matrix determinant
|
||||
|
||||
@ -1510,7 +1509,7 @@ Expected Result
|
||||
9.650995e+07
|
||||
1
|
||||
|
||||
test01.bas
|
||||
test50.bas
|
||||
==========
|
||||
Min and max function
|
||||
|
||||
@ -1536,7 +1535,7 @@ Expected Result
|
||||
0.3
|
||||
4
|
||||
|
||||
test01.bas
|
||||
test51.bas
|
||||
==========
|
||||
Print items
|
||||
|
||||
@ -1549,7 +1548,7 @@ Expected Result
|
||||
Line 1
|
||||
1.234568
|
||||
|
||||
test01.bas
|
||||
test52.bas
|
||||
==========
|
||||
MAT INPUT
|
||||
|
||||
|
@ -1,8 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo -n $0: 'Scalar variable assignment... '
|
||||
|
||||
cat >test.bas <<eof
|
||||
10 a=1
|
||||
20 print a
|
||||
30 a$="hello"
|
||||
@ -13,23 +8,3 @@ cat >test.bas <<eof
|
||||
80 print a
|
||||
90 a=.2e-6
|
||||
100 print a
|
||||
eof
|
||||
|
||||
cat >test.ref <<eof
|
||||
1
|
||||
hello
|
||||
0.0002
|
||||
2e-06
|
||||
2e-07
|
||||
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
|
||||
|
@ -1,8 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo -n $0: 'Array variable assignment... '
|
||||
|
||||
cat >test.bas <<eof
|
||||
10 dim a(1)
|
||||
20 a(0)=10
|
||||
30 a(1)=11
|
||||
@ -10,21 +5,4 @@ cat >test.bas <<eof
|
||||
50 print a(0)
|
||||
60 print a(1)
|
||||
70 print a
|
||||
eof
|
||||
|
||||
cat >test.ref <<eof
|
||||
10
|
||||
11
|
||||
12
|
||||
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
|
||||
|
@ -1,8 +1,3 @@
|
||||
#!/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
|
||||
@ -19,38 +14,3 @@ cat >test.bas <<eof
|
||||
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
|
||||
|
@ -1,34 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo -n $0: 'REPEAT UNTIL loop... '
|
||||
|
||||
cat >test.bas <<eof
|
||||
10 a=1
|
||||
20 repeat
|
||||
30 print a
|
||||
40 a=a+1
|
||||
50 until a=10
|
||||
eof
|
||||
|
||||
cat >test.ref <<eof
|
||||
1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
9
|
||||
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
|
||||
|
@ -1,8 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo -n $0: 'GOSUB RETURN subroutines... '
|
||||
|
||||
cat >test5.bas <<eof
|
||||
10 gosub 100
|
||||
20 gosub 100
|
||||
30 end
|
||||
@ -10,22 +5,4 @@ cat >test5.bas <<eof
|
||||
110 gosub 200
|
||||
120 return
|
||||
200 print "hello, world":return
|
||||
eof
|
||||
|
||||
cat >test5.ref <<eof
|
||||
hello, world
|
||||
hello, world
|
||||
hello, world
|
||||
hello, world
|
||||
eof
|
||||
|
||||
sh ./test/runbas test5.bas >test5.data
|
||||
|
||||
if cmp test5.ref test5.data
|
||||
then
|
||||
rm -f test5.*
|
||||
echo passed
|
||||
else
|
||||
echo failed
|
||||
exit 1
|
||||
fi
|
||||
|
@ -1,8 +1,3 @@
|
||||
#!/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
|
||||
@ -14,29 +9,4 @@ cat >test.bas <<eof
|
||||
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
|
||||
|
@ -1,25 +1,5 @@
|
||||
#!/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
|
||||
|
@ -1,8 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo -n $0: 'DATA, READ and RESTORE... '
|
||||
|
||||
cat >test.bas <<eof
|
||||
10 data "a",b
|
||||
20 data "c","d
|
||||
40 read j$
|
||||
@ -12,23 +7,4 @@ cat >test.bas <<eof
|
||||
80 read j$,k$
|
||||
90 print "j=";j$;" k=";k$
|
||||
100 next
|
||||
eof
|
||||
|
||||
cat >test.ref <<'eof'
|
||||
j=a
|
||||
j=c k=d
|
||||
Error: end of `data' in line 80 at:
|
||||
80 read j$,k$
|
||||
^
|
||||
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
|
||||
|
@ -1,8 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo -n $0: 'LOCAL variables... '
|
||||
|
||||
cat >test.bas <<eof
|
||||
10 def fna(a)
|
||||
20 local b
|
||||
30 b=a+1
|
||||
@ -11,21 +6,4 @@ cat >test.bas <<eof
|
||||
70 print b
|
||||
80 print fna(4)
|
||||
90 print b
|
||||
eof
|
||||
|
||||
cat >test.ref <<eof
|
||||
3
|
||||
5
|
||||
3
|
||||
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
|
||||
|
@ -1,8 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo -n $0: 'PRINT USING... '
|
||||
|
||||
cat >test.bas <<'eof'
|
||||
10 print using "!";"abcdef"
|
||||
20 print using "\ \";"abcdef"
|
||||
30 print using "###-";-1
|
||||
@ -33,48 +28,4 @@ cat >test.bas <<'eof'
|
||||
280 print using "a!b";"S","T"
|
||||
290 print using "a!b!c";"S"
|
||||
300 print using "a!b!c";"S","T"
|
||||
eof
|
||||
|
||||
cat >test.ref <<'eof'
|
||||
a
|
||||
abc
|
||||
1-
|
||||
0
|
||||
1
|
||||
1-
|
||||
0+
|
||||
1+
|
||||
1,000
|
||||
*1,000.00
|
||||
+1.00
|
||||
+1.23
|
||||
+123.46
|
||||
+123.
|
||||
+123
|
||||
abc def 1.30 efg
|
||||
500.00E-002
|
||||
100.00E+01
|
||||
.50E+01
|
||||
23E-10
|
||||
.23E-08
|
||||
2.3E-09
|
||||
-.1147E+005
|
||||
$***3,729,825.24
|
||||
$**3729825.24
|
||||
$456.78
|
||||
aSb
|
||||
aSbaTb
|
||||
aSb
|
||||
aSbTc
|
||||
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
|
||||
|
@ -1,30 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo -n $0: 'OPEN and LINE INPUT... '
|
||||
|
||||
cat >test.bas <<'eof'
|
||||
10 open "i",1,"test.bas"
|
||||
20 while not eof(1)
|
||||
30 line input #1,a$
|
||||
40 print a$
|
||||
50 wend
|
||||
eof
|
||||
|
||||
cat >test.ref <<eof
|
||||
10 open "i",1,"test.bas"
|
||||
20 while not eof(1)
|
||||
30 line input #1,a$
|
||||
40 print a$
|
||||
50 wend
|
||||
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
|
||||
|
@ -1,8 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo -n $0: 'Exception handling... '
|
||||
|
||||
cat >test.bas <<'eof'
|
||||
10 on error print "global handler 1 caught error in line ";erl : resume 30
|
||||
20 print mid$("",-1)
|
||||
30 on error print "global handler 2 caught error in line ";erl : end
|
||||
@ -12,21 +7,4 @@ cat >test.bas <<'eof'
|
||||
70 end proc
|
||||
80 procx
|
||||
90 print 1 mod 0
|
||||
eof
|
||||
|
||||
cat >test.ref <<eof
|
||||
global handler 1 caught error in line 20
|
||||
local handler caught error in line 60
|
||||
global handler 2 caught error in line 90
|
||||
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
|
||||
|
@ -1,26 +1,4 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo -n $0: 'Unnumbered lines... '
|
||||
|
||||
cat >test.bas <<'eof'
|
||||
print "a"
|
||||
goto 20
|
||||
print "b"
|
||||
20 print "c"
|
||||
eof
|
||||
|
||||
cat >test.ref <<eof
|
||||
a
|
||||
c
|
||||
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
|
||||
|
@ -1,8 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo -n $0: 'SELECT CASE... '
|
||||
|
||||
cat >test.bas <<'eof'
|
||||
10 for i=0 to 9
|
||||
20 for j=0 to 9
|
||||
30 print i,j
|
||||
@ -24,219 +19,4 @@ cat >test.bas <<'eof'
|
||||
190 end select
|
||||
200 next
|
||||
210 next
|
||||
eof
|
||||
|
||||
cat >test.ref <<eof
|
||||
0 0
|
||||
i after case 0
|
||||
0 1
|
||||
i after case 0
|
||||
0 2
|
||||
i after case 0
|
||||
0 3
|
||||
i after case 0
|
||||
0 4
|
||||
i after case 0
|
||||
0 5
|
||||
i after case 0
|
||||
0 6
|
||||
i after case 0
|
||||
0 7
|
||||
i after case 0
|
||||
0 8
|
||||
i after case 0
|
||||
0 9
|
||||
i after case 0
|
||||
1 0
|
||||
i after case 1
|
||||
j after case 0
|
||||
1 1
|
||||
i after case 1
|
||||
1 2
|
||||
i after case 1
|
||||
1 3
|
||||
i after case 1
|
||||
1 4
|
||||
i after case 1
|
||||
1 5
|
||||
i after case 1
|
||||
1 6
|
||||
i after case 1
|
||||
1 7
|
||||
i after case 1
|
||||
1 8
|
||||
i after case 1
|
||||
1 9
|
||||
i after case 1
|
||||
2 0
|
||||
is after case is <9
|
||||
2 1
|
||||
is after case is <9
|
||||
2 2
|
||||
is after case is <9
|
||||
2 3
|
||||
is after case is <9
|
||||
2 4
|
||||
is after case is <9
|
||||
2 5
|
||||
is after case is <9
|
||||
2 6
|
||||
is after case is <9
|
||||
2 7
|
||||
is after case is <9
|
||||
2 8
|
||||
is after case is <9
|
||||
2 9
|
||||
is after case is <9
|
||||
3 0
|
||||
i after case 3 to 5, 7
|
||||
3 1
|
||||
i after case 3 to 5, 7
|
||||
3 2
|
||||
i after case 3 to 5, 7
|
||||
3 3
|
||||
i after case 3 to 5, 7
|
||||
3 4
|
||||
i after case 3 to 5, 7
|
||||
3 5
|
||||
i after case 3 to 5, 7
|
||||
3 6
|
||||
i after case 3 to 5, 7
|
||||
3 7
|
||||
i after case 3 to 5, 7
|
||||
3 8
|
||||
i after case 3 to 5, 7
|
||||
3 9
|
||||
i after case 3 to 5, 7
|
||||
4 0
|
||||
i after case 3 to 5, 7
|
||||
4 1
|
||||
i after case 3 to 5, 7
|
||||
4 2
|
||||
i after case 3 to 5, 7
|
||||
4 3
|
||||
i after case 3 to 5, 7
|
||||
4 4
|
||||
i after case 3 to 5, 7
|
||||
4 5
|
||||
i after case 3 to 5, 7
|
||||
4 6
|
||||
i after case 3 to 5, 7
|
||||
4 7
|
||||
i after case 3 to 5, 7
|
||||
4 8
|
||||
i after case 3 to 5, 7
|
||||
4 9
|
||||
i after case 3 to 5, 7
|
||||
5 0
|
||||
i after case 3 to 5, 7
|
||||
5 1
|
||||
i after case 3 to 5, 7
|
||||
5 2
|
||||
i after case 3 to 5, 7
|
||||
5 3
|
||||
i after case 3 to 5, 7
|
||||
5 4
|
||||
i after case 3 to 5, 7
|
||||
5 5
|
||||
i after case 3 to 5, 7
|
||||
5 6
|
||||
i after case 3 to 5, 7
|
||||
5 7
|
||||
i after case 3 to 5, 7
|
||||
5 8
|
||||
i after case 3 to 5, 7
|
||||
5 9
|
||||
i after case 3 to 5, 7
|
||||
6 0
|
||||
is after case is <9
|
||||
6 1
|
||||
is after case is <9
|
||||
6 2
|
||||
is after case is <9
|
||||
6 3
|
||||
is after case is <9
|
||||
6 4
|
||||
is after case is <9
|
||||
6 5
|
||||
is after case is <9
|
||||
6 6
|
||||
is after case is <9
|
||||
6 7
|
||||
is after case is <9
|
||||
6 8
|
||||
is after case is <9
|
||||
6 9
|
||||
is after case is <9
|
||||
7 0
|
||||
i after case 3 to 5, 7
|
||||
7 1
|
||||
i after case 3 to 5, 7
|
||||
7 2
|
||||
i after case 3 to 5, 7
|
||||
7 3
|
||||
i after case 3 to 5, 7
|
||||
7 4
|
||||
i after case 3 to 5, 7
|
||||
7 5
|
||||
i after case 3 to 5, 7
|
||||
7 6
|
||||
i after case 3 to 5, 7
|
||||
7 7
|
||||
i after case 3 to 5, 7
|
||||
7 8
|
||||
i after case 3 to 5, 7
|
||||
7 9
|
||||
i after case 3 to 5, 7
|
||||
8 0
|
||||
is after case is <9
|
||||
8 1
|
||||
is after case is <9
|
||||
8 2
|
||||
is after case is <9
|
||||
8 3
|
||||
is after case is <9
|
||||
8 4
|
||||
is after case is <9
|
||||
8 5
|
||||
is after case is <9
|
||||
8 6
|
||||
is after case is <9
|
||||
8 7
|
||||
is after case is <9
|
||||
8 8
|
||||
is after case is <9
|
||||
8 9
|
||||
is after case is <9
|
||||
9 0
|
||||
i after case else
|
||||
9 1
|
||||
i after case else
|
||||
9 2
|
||||
i after case else
|
||||
9 3
|
||||
i after case else
|
||||
9 4
|
||||
i after case else
|
||||
9 5
|
||||
i after case else
|
||||
9 6
|
||||
i after case else
|
||||
9 7
|
||||
i after case else
|
||||
9 8
|
||||
i after case else
|
||||
9 9
|
||||
i after case else
|
||||
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
|
||||
|
@ -1,8 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo -n $0: 'FIELD, PUT and GET... '
|
||||
|
||||
cat >test.bas <<'eof'
|
||||
a$="a"
|
||||
open "r",1,"test.dat",128
|
||||
print "before field a$=";a$
|
||||
@ -20,22 +15,4 @@ get #2
|
||||
print "after get b$=";b$
|
||||
close #2
|
||||
kill "test.dat"
|
||||
eof
|
||||
|
||||
cat >test.ref <<eof
|
||||
before field a$=a
|
||||
a$=hi ya
|
||||
after close a$=
|
||||
after get b$=hi ya
|
||||
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
|
||||
|
@ -1,8 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo -n $0: 'SWAP... '
|
||||
|
||||
cat >test.bas <<'eof'
|
||||
a=1 : b=2
|
||||
print "a=";a;"b=";b
|
||||
swap a,b
|
||||
@ -12,22 +7,4 @@ a$(1,0)="a" : b$(0,1)="b"
|
||||
print "a$(1,0)=";a$(1,0);"b$(0,1)=";b$(0,1)
|
||||
swap a$(1,0),b$(0,1)
|
||||
print "a$(1,0)=";a$(1,0);"b$(0,1)=";b$(0,1)
|
||||
eof
|
||||
|
||||
cat >test.ref <<'eof'
|
||||
a= 1 b= 2
|
||||
a= 2 b= 1
|
||||
a$(1,0)=ab$(0,1)=b
|
||||
a$(1,0)=bb$(0,1)=a
|
||||
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
|
||||
|
@ -1,8 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo -n $0: 'DO, EXIT DO, LOOP... '
|
||||
|
||||
cat >test.bas <<'eof'
|
||||
print "loop started"
|
||||
i=1
|
||||
do
|
||||
@ -11,30 +6,4 @@ do
|
||||
if i>10 then exit do
|
||||
loop
|
||||
print "loop ended"
|
||||
eof
|
||||
|
||||
cat >test.ref <<'eof'
|
||||
loop started
|
||||
i is 1
|
||||
i is 2
|
||||
i is 3
|
||||
i is 4
|
||||
i is 5
|
||||
i is 6
|
||||
i is 7
|
||||
i is 8
|
||||
i is 9
|
||||
i is 10
|
||||
loop ended
|
||||
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
|
||||
|
@ -1,8 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo -n $0: 'DO WHILE, LOOP... '
|
||||
|
||||
cat >test.bas <<'eof'
|
||||
print "loop started"
|
||||
x$=""
|
||||
do while len(x$)<3
|
||||
@ -15,29 +10,4 @@ do while len(x$)<3
|
||||
loop
|
||||
loop
|
||||
print "loop ended"
|
||||
eof
|
||||
|
||||
cat >test.ref <<'eof'
|
||||
loop started
|
||||
x$ is
|
||||
y$ is
|
||||
y$ is b
|
||||
x$ is a
|
||||
y$ is
|
||||
y$ is b
|
||||
x$ is aa
|
||||
y$ is
|
||||
y$ is b
|
||||
loop ended
|
||||
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
|
||||
|
@ -1,8 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo -n $0: 'ELSEIF... '
|
||||
|
||||
cat >test.bas <<'eof'
|
||||
for x=1 to 3
|
||||
if x=1 then
|
||||
print "1a"
|
||||
@ -22,24 +17,4 @@ for x=1 to 3
|
||||
print "2b"
|
||||
elseif x=3 then print "3b"
|
||||
next
|
||||
eof
|
||||
|
||||
cat >test.ref <<'eof'
|
||||
1a
|
||||
2a
|
||||
3a
|
||||
1b
|
||||
2b
|
||||
3b
|
||||
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
|
||||
|
@ -1,8 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo -n $0: 'Caller trace... '
|
||||
|
||||
cat >test.bas <<'eof'
|
||||
10 gosub 20
|
||||
20 gosub 30
|
||||
30 procb
|
||||
@ -13,34 +8,4 @@ cat >test.bas <<'eof'
|
||||
80 def procb
|
||||
90 proca
|
||||
100 end proc
|
||||
eof
|
||||
|
||||
cat >test.ref <<'eof'
|
||||
hi
|
||||
Break in line 60 at:
|
||||
60 stop
|
||||
^
|
||||
Proc Called in line 90 at:
|
||||
90 proca
|
||||
^
|
||||
Proc Called in line 30 at:
|
||||
30 procb
|
||||
^
|
||||
Called in line 20 at:
|
||||
20 gosub 30
|
||||
^
|
||||
Called in line 10 at:
|
||||
10 gosub 20
|
||||
^
|
||||
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
|
||||
|
@ -1,8 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo -n $0: 'Matrix assignment... '
|
||||
|
||||
cat >test.bas <<'eof'
|
||||
dim a(3,4)
|
||||
for i=0 to 3
|
||||
for j=0 to 4
|
||||
@ -18,26 +13,4 @@ for i=0 to 3
|
||||
next
|
||||
print
|
||||
next
|
||||
eof
|
||||
|
||||
cat >test.ref <<'eof'
|
||||
0 1 2 3 4
|
||||
10 11 12 13 14
|
||||
20 21 22 23 24
|
||||
30 31 32 33 34
|
||||
0 0 0 0 0
|
||||
0 11 12 13 14
|
||||
0 21 22 23 24
|
||||
0 31 32 33 34
|
||||
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
|
||||
|
@ -1,8 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo -n $0: 'MAT PRINT... '
|
||||
|
||||
cat >test.bas <<'eof'
|
||||
dim a(2,2)
|
||||
for i=0 to 2
|
||||
for j=0 to 2
|
||||
@ -16,25 +11,4 @@ for j=1 to 2
|
||||
print
|
||||
next
|
||||
mat print using " ##.##";a,a
|
||||
eof
|
||||
|
||||
cat >test.ref <<'eof'
|
||||
11.00 21.00
|
||||
12.00 22.00
|
||||
11.00 12.00
|
||||
21.00 22.00
|
||||
|
||||
11.00 12.00
|
||||
21.00 22.00
|
||||
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
|
||||
|
@ -1,8 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo -n $0: 'Matrix addition and subtraction... '
|
||||
|
||||
cat >test.bas <<'eof'
|
||||
dim a(2,2)
|
||||
a(2,2)=2.5
|
||||
dim b%(2,2)
|
||||
@ -15,26 +10,4 @@ c$(2,1)="hi"
|
||||
mat print c$
|
||||
mat c$=c$+c$
|
||||
mat print c$
|
||||
eof
|
||||
|
||||
cat >test.ref <<'eof'
|
||||
0 0
|
||||
0 2.5
|
||||
0 0
|
||||
0 -0.5
|
||||
|
||||
hi
|
||||
|
||||
hihi
|
||||
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
|
||||
|
@ -1,8 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo -n $0: 'Matrix multiplication... '
|
||||
|
||||
cat >test.bas <<'eof'
|
||||
10 dim b(2,3),c(3,2)
|
||||
20 for i=1 to 2 : for j=1 to 3 : read b(i,j) : next : next
|
||||
30 for i=1 to 3 : for j=1 to 2 : read c(i,j) : next : next
|
||||
@ -10,27 +5,4 @@ cat >test.bas <<'eof'
|
||||
50 mat print b,c,a
|
||||
60 data 1,2,3,3,2,1
|
||||
70 data 1,2,2,1,3,3
|
||||
eof
|
||||
|
||||
cat >test.ref <<'eof'
|
||||
1 2 3
|
||||
3 2 1
|
||||
|
||||
1 2
|
||||
2 1
|
||||
3 3
|
||||
|
||||
14 13
|
||||
10 11
|
||||
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
|
||||
|
@ -1,8 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo -n $0: 'Matrix scalar multiplication... '
|
||||
|
||||
cat >test.bas <<'eof'
|
||||
10 dim a(3,3)
|
||||
20 for i=1 to 3 : for j=1 to 3 : read a(i,j) : next : next
|
||||
30 mat print a
|
||||
@ -16,35 +11,4 @@ cat >test.bas <<'eof'
|
||||
110 mat print inch_array
|
||||
120 mat cm_array=(2.54)*inch_array
|
||||
130 mat print cm_array
|
||||
eof
|
||||
|
||||
cat >test.ref <<'eof'
|
||||
1 2 3
|
||||
4 5 6
|
||||
7 8 9
|
||||
|
||||
3 6 9
|
||||
12 15 18
|
||||
21 24 27
|
||||
1
|
||||
12
|
||||
36
|
||||
100
|
||||
39.37
|
||||
2.54
|
||||
30.48
|
||||
91.44
|
||||
254
|
||||
99.9998
|
||||
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
|
||||
|
@ -1,26 +1,5 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo -n $0: 'MAT READ... '
|
||||
|
||||
cat >test.bas <<'eof'
|
||||
dim a(3,3)
|
||||
data 5,5,5,8,8,8,3,3
|
||||
mat read a(2,3)
|
||||
mat print a
|
||||
eof
|
||||
|
||||
cat >test.ref <<'eof'
|
||||
5 5 5
|
||||
8 8 8
|
||||
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
|
||||
|
@ -1,8 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo -n $0: 'Matrix inversion... '
|
||||
|
||||
cat >test.bas <<'eof'
|
||||
data 1,2,3,4
|
||||
mat read a(2,2)
|
||||
mat print a
|
||||
@ -10,24 +5,4 @@ mat b=inv(a)
|
||||
mat print b
|
||||
mat c=a*b
|
||||
mat print c
|
||||
eof
|
||||
|
||||
cat >test.ref <<'eof'
|
||||
1 2
|
||||
3 4
|
||||
-2 1
|
||||
1.5 -0.5
|
||||
1 0
|
||||
0 1
|
||||
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
|
||||
|
@ -1,26 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo -n $0: 'TDL BASIC FNRETURN/FNEND... '
|
||||
|
||||
cat >test.bas <<'eof'
|
||||
def fnfac(n)
|
||||
if n=1 then fnreturn 1
|
||||
fnend n*fnfac(n-1)
|
||||
|
||||
print fnfac(10)
|
||||
eof
|
||||
|
||||
cat >test.ref <<'eof'
|
||||
3628800
|
||||
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
|
||||
|
@ -1,32 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo -n $0: 'TDL INSTR... '
|
||||
|
||||
cat >test.bas <<'eof'
|
||||
print instr("123456789","456");" = 4?"
|
||||
print INSTR("123456789","654");" = 0?"
|
||||
print INSTR("1234512345","34");" = 3?"
|
||||
print INSTR("1234512345","34",6);" = 8?"
|
||||
print INSTR("1234512345","34",6,2);" = 0?"
|
||||
print INSTR("1234512345","34",6,4);" = 8?"
|
||||
eof
|
||||
|
||||
cat >test.ref <<'eof'
|
||||
4 = 4?
|
||||
0 = 0?
|
||||
3 = 3?
|
||||
8 = 8?
|
||||
0 = 0?
|
||||
8 = 8?
|
||||
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
|
||||
|
@ -1,22 +1,2 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo -n $0: 'Type mismatch check... '
|
||||
|
||||
cat >test.bas <<'eof'
|
||||
print 1+"a"
|
||||
eof
|
||||
|
||||
cat >test.ref <<'eof'
|
||||
Error: Invalid binary operand at: end of program
|
||||
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
|
||||
|
@ -1,43 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo -n $0: 'PRINT default format... '
|
||||
|
||||
cat >test.bas <<'eof'
|
||||
10 for i=-8 to 8
|
||||
20 x=1+1/3 : y=1 : j=i
|
||||
30 for j=i to -1 : x=x/10 : y=y/10 : next
|
||||
40 for j=i to 1 step -1 : x=x*10 : y=y*10 : next
|
||||
50 print x,y
|
||||
60 next
|
||||
eof
|
||||
|
||||
cat >test.ref <<'eof'
|
||||
1.333333e-08 1e-08
|
||||
1.333333e-07 1e-07
|
||||
1.333333e-06 1e-06
|
||||
1.333333e-05 1e-05
|
||||
0.000133 0.0001
|
||||
0.001333 0.001
|
||||
0.013333 0.01
|
||||
0.133333 0.1
|
||||
1.333333 1
|
||||
13.33333 10
|
||||
133.3333 100
|
||||
1333.333 1000
|
||||
13333.33 10000
|
||||
133333.3 100000
|
||||
1333333 1000000
|
||||
1.333333e+07 1e+07
|
||||
1.333333e+08 1e+08
|
||||
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
|
||||
|
@ -1,8 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo -n $0: 'SUB routines... '
|
||||
|
||||
cat >test.bas <<'eof'
|
||||
PUTS("abc")
|
||||
END
|
||||
|
||||
@ -10,19 +5,4 @@ SUB PUTS(s$)
|
||||
FOR i=1 to LEN(s$) : print mid$(s$,i,1); : NEXT
|
||||
PRINT
|
||||
END SUB
|
||||
eof
|
||||
|
||||
cat >test.ref <<'eof'
|
||||
abc
|
||||
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
|
||||
|
@ -1,8 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo -n $0: 'OPEN FOR BINARY... '
|
||||
|
||||
cat >test.bas <<'eof'
|
||||
open "test.out" for binary as 1
|
||||
put 1,1,"xy"
|
||||
put 1,3,"z!"
|
||||
@ -19,21 +14,4 @@ print s$
|
||||
print x
|
||||
print n%
|
||||
kill "test.out"
|
||||
eof
|
||||
|
||||
cat >test.ref <<'eof'
|
||||
xyz!
|
||||
0.333333
|
||||
9999
|
||||
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
|
||||
|
@ -1,8 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo -n $0: 'OPTION BASE... '
|
||||
|
||||
cat >test.bas <<'eof'
|
||||
option base 3
|
||||
dim a(3,5)
|
||||
a(3,3)=1
|
||||
@ -20,24 +15,4 @@ print a(3,3)
|
||||
print a(3,5)
|
||||
print b(-2,-2)
|
||||
print b(-1,2)
|
||||
eof
|
||||
|
||||
cat >test.ref <<'eof'
|
||||
1
|
||||
2
|
||||
1
|
||||
2
|
||||
10
|
||||
20
|
||||
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
|
||||
|
@ -1,8 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo -n $0: 'Real to integer conversion... '
|
||||
|
||||
cat >test.bas <<'eof'
|
||||
a%=1.2
|
||||
print a%
|
||||
a%=1.7
|
||||
@ -11,22 +6,4 @@ a%=-0.2
|
||||
print a%
|
||||
a%=-0.7
|
||||
print a%
|
||||
eof
|
||||
|
||||
cat >test.ref <<'eof'
|
||||
1
|
||||
2
|
||||
0
|
||||
-1
|
||||
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
|
||||
|
@ -1,8 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo -n $0: 'OPEN file locking... '
|
||||
|
||||
cat >test.bas <<'eof'
|
||||
on error goto 10
|
||||
print "opening file"
|
||||
open "test.out" for output lock write as #1
|
||||
@ -10,22 +5,4 @@ print "open succeeded"
|
||||
if command$<>"enough" then shell "sh ./test/runbas test.bas enough"
|
||||
end
|
||||
10 print "open failed"
|
||||
eof
|
||||
|
||||
cat >test.ref <<'eof'
|
||||
opening file
|
||||
open succeeded
|
||||
opening file
|
||||
open failed
|
||||
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
|
||||
|
@ -1,24 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo -n $0: 'LINE INPUT reaching EOF... '
|
||||
|
||||
cat >test.bas <<'eof'
|
||||
10 open "i",1,"test.ref"
|
||||
20 while not eof(1)
|
||||
30 line input #1,a$
|
||||
40 if a$="abc" then print a$; else print "def"
|
||||
50 wend
|
||||
eof
|
||||
|
||||
awk 'BEGIN{ printf("abc") }' </dev/null >test.ref
|
||||
|
||||
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
|
||||
|
@ -1,8 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo -n $0: 'MAT REDIM... '
|
||||
|
||||
cat >test.bas <<'eof'
|
||||
dim x(10)
|
||||
mat read x
|
||||
mat print x
|
||||
@ -11,47 +6,4 @@ mat print x
|
||||
mat redim x(12)
|
||||
mat print x
|
||||
data 1,2,3,4,5,6,7,8,9,10
|
||||
eof
|
||||
|
||||
cat >test.ref <<'eof'
|
||||
1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
9
|
||||
10
|
||||
1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
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
|
||||
|
@ -1,8 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo -n $0: 'Nested function and procedure calls... '
|
||||
|
||||
cat >test.bas <<'eof'
|
||||
def proc_a(x)
|
||||
print fn_b(1,x)
|
||||
end proc
|
||||
@ -14,19 +9,4 @@ def fn_c(b)
|
||||
= b+3
|
||||
|
||||
proc_a(2)
|
||||
eof
|
||||
|
||||
cat >test.ref <<'eof'
|
||||
6
|
||||
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
|
||||
|
@ -1,26 +1,5 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo -n $0: 'IMAGE... '
|
||||
|
||||
cat >test.bas <<'eof'
|
||||
d=3.1
|
||||
print using "#.#";d
|
||||
print using 10;d
|
||||
10 image #.##
|
||||
eof
|
||||
|
||||
cat >test.ref <<'eof'
|
||||
3.1
|
||||
3.10
|
||||
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
|
||||
|
@ -1,8 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo -n $0: 'EXIT FUNCTION... '
|
||||
|
||||
cat >test.bas <<'eof'
|
||||
function f(c)
|
||||
print "f running"
|
||||
if (c) then f=42 : exit function
|
||||
@ -11,22 +6,4 @@ end function
|
||||
|
||||
print f(0)
|
||||
print f(1)
|
||||
eof
|
||||
|
||||
cat >test.ref <<'eof'
|
||||
f running
|
||||
43
|
||||
f running
|
||||
42
|
||||
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
|
||||
|
@ -1,8 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo -n $0: 'Arithmetic... '
|
||||
|
||||
cat >test.bas <<eof
|
||||
10 print 4.7\3
|
||||
20 print -2.3\1
|
||||
30 print int(-2.3)
|
||||
@ -11,26 +6,4 @@ cat >test.bas <<eof
|
||||
60 print fix(2.3)
|
||||
70 print fp(-2.3)
|
||||
80 print fp(2.3)
|
||||
eof
|
||||
|
||||
cat >test.ref <<eof
|
||||
1
|
||||
-2
|
||||
-3
|
||||
2
|
||||
-2
|
||||
2
|
||||
-0.3
|
||||
0.3
|
||||
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
|
||||
|
@ -1,8 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo -n $0: 'Matrix multiplication size checks... '
|
||||
|
||||
cat >test.bas <<eof
|
||||
DIM a(3,3),b(3,1),c(3,3)
|
||||
MAT READ a
|
||||
MAT READ b
|
||||
@ -18,24 +13,4 @@ MAT READ a
|
||||
MAT READ b
|
||||
MAT c=a*b
|
||||
MAT PRINT c
|
||||
eof
|
||||
|
||||
cat >test.ref <<eof
|
||||
17
|
||||
47
|
||||
77
|
||||
Error: Dimension mismatch in line 14 at:
|
||||
mat c=a*b
|
||||
^
|
||||
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
|
||||
|
@ -1,8 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo -n $0: 'DELETE... '
|
||||
|
||||
cat >test.bas <<eof
|
||||
10 print 10
|
||||
20 print 20
|
||||
30 print 30
|
||||
@ -10,29 +5,4 @@ cat >test.bas <<eof
|
||||
50 print 50
|
||||
60 print 60
|
||||
70 print 70
|
||||
eof
|
||||
|
||||
cat >test.input <<eof
|
||||
load "test.bas"
|
||||
delete -20
|
||||
delete 60-
|
||||
delete 30-40
|
||||
delete 15
|
||||
list
|
||||
eof
|
||||
|
||||
cat >test.ref <<eof
|
||||
Error: No such line at: 15
|
||||
50 print 50
|
||||
eof
|
||||
|
||||
sh ./test/runbas <test.input >test.data
|
||||
|
||||
if cmp test.ref test.data
|
||||
then
|
||||
rm -f test.*
|
||||
echo passed
|
||||
else
|
||||
echo failed
|
||||
exit 1
|
||||
fi
|
||||
|
@ -1,8 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo -n $0: 'MID$ on left side... '
|
||||
|
||||
cat >test.bas <<'eof'
|
||||
10 mid$(a$,6,4) = "ABCD"
|
||||
20 print a$
|
||||
30 a$="0123456789"
|
||||
@ -11,21 +6,4 @@ cat >test.bas <<'eof'
|
||||
60 a$="0123456789"
|
||||
70 let mid$(a$,6,4) = "ABCD"
|
||||
80 print a$
|
||||
eof
|
||||
|
||||
cat >test.ref <<'eof'
|
||||
|
||||
01234ABCD9
|
||||
01234ABCD9
|
||||
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
|
||||
|
@ -1,22 +1,2 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo -n $0: 'END used without program... '
|
||||
|
||||
cat >test.bas <<'eof'
|
||||
for i=1 to 10:print i;:next i:end
|
||||
eof
|
||||
|
||||
cat >test.ref <<'eof'
|
||||
1 2 3 4 5 6 7 8 9 10
|
||||
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
|
||||
|
@ -1,8 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo -n $0: 'MAT WRITE... '
|
||||
|
||||
cat >test.bas <<'eof'
|
||||
dim a(3,4)
|
||||
for i=0 to 3
|
||||
for j=0 to 4
|
||||
@ -12,25 +7,4 @@ for i=0 to 3
|
||||
print
|
||||
next
|
||||
mat write a
|
||||
eof
|
||||
|
||||
cat >test.ref <<'eof'
|
||||
0 1 2 3 4
|
||||
10 11 12 13 14
|
||||
20 21 22 23 24
|
||||
30 31 32 33 34
|
||||
11,12,13,14
|
||||
21,22,23,24
|
||||
31,32,33,34
|
||||
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
|
||||
|
@ -1,8 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo -n $0: 'Multi assignment... '
|
||||
|
||||
cat >test.bas <<'eof'
|
||||
a,b = 10
|
||||
print a,b
|
||||
dim c(10)
|
||||
@ -10,21 +5,4 @@ a,c(a) = 2
|
||||
print a,c(2),c(10)
|
||||
a$,b$="test"
|
||||
print a$,b$
|
||||
eof
|
||||
|
||||
cat >test.ref <<'eof'
|
||||
10 10
|
||||
2 0 2
|
||||
test test
|
||||
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
|
||||
|
@ -1,8 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo -n $0: 'Matrix determinant... '
|
||||
|
||||
cat >test.bas <<'eof'
|
||||
width 120
|
||||
dim a(7,7),b(7,7)
|
||||
mat read a
|
||||
@ -18,37 +13,4 @@ data 66,72,71,38,40,27,69
|
||||
mat b=inv(a)
|
||||
mat print b
|
||||
print det
|
||||
eof
|
||||
|
||||
cat >test.ref <<'eof'
|
||||
58 71 67 36 35 19 60
|
||||
50 71 71 56 45 20 52
|
||||
64 40 84 50 51 43 69
|
||||
31 28 41 54 31 18 33
|
||||
45 23 46 38 50 43 50
|
||||
41 10 28 17 33 41 46
|
||||
66 72 71 38 40 27 69
|
||||
|
||||
9.636025e+07 320206 -537449 2323650 -1.135486e+07 3.019632e+07
|
||||
-9.650941e+07
|
||||
4480 15 -25 108 -528 1404 -4487
|
||||
-39436 -131 220 -951 4647 -12358 39497
|
||||
273240 908 -1524 6589 -32198 85625 -273663
|
||||
-1846174 -6135 10297 -44519 217549 -578534 1849032
|
||||
1.315035e+07 43699 -73346 317110 -1549606 4120912 -1.31707e+07
|
||||
|
||||
-9.636079e+07 -320208 537452 -2323663 1.135493e+07 -3.019649e+07
|
||||
9.650995e+07
|
||||
1
|
||||
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
|
||||
|
@ -1,8 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo -n $0: 'Min and max function... '
|
||||
|
||||
cat >test.bas <<'eof'
|
||||
print min(1,2)
|
||||
print min(2,1)
|
||||
print min(-0.3,0.3)
|
||||
@ -11,26 +6,4 @@ print max(1,2)
|
||||
print max(2,1)
|
||||
print max(-0.3,0.3)
|
||||
print max(-0.3,4)
|
||||
eof
|
||||
|
||||
cat >test.ref <<'eof'
|
||||
1
|
||||
1
|
||||
-0.3
|
||||
-0.3
|
||||
2
|
||||
2
|
||||
0.3
|
||||
4
|
||||
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
|
||||
|
@ -1,23 +1,2 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo -n $0: 'Print items... '
|
||||
|
||||
cat >test.bas <<'eof'
|
||||
PRINT "Line 1";TAB(78);1.23456789
|
||||
eof
|
||||
|
||||
cat >test.ref <<'eof'
|
||||
Line 1
|
||||
1.234568
|
||||
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
|
||||
|
@ -1,37 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo -n $0: 'MAT INPUT... '
|
||||
|
||||
cat >test.bas <<'eof'
|
||||
dim a(2,2)
|
||||
mat input a
|
||||
mat print a
|
||||
mat input a
|
||||
mat print a
|
||||
eof
|
||||
|
||||
cat >test.input <<'eof'
|
||||
1,2,3,4,5
|
||||
1
|
||||
3,4
|
||||
eof
|
||||
|
||||
cat >test.ref <<'eof'
|
||||
?
|
||||
1 2
|
||||
3 4
|
||||
? ?
|
||||
1 0
|
||||
3 4
|
||||
eof
|
||||
|
||||
sh ./test/runbas test.bas <test.input >test.data
|
||||
|
||||
if cmp test.ref test.data
|
||||
then
|
||||
rm -f test.*
|
||||
echo passed
|
||||
else
|
||||
echo failed
|
||||
exit 1
|
||||
fi
|
||||
|
Loading…
x
Reference in New Issue
Block a user