Files
lttb/test.bas
T

68 lines
1.9 KiB
QBasic

5 rem This is a comment and should never be executed
9 rem Program loaders should ignore empty lines correctly
10 print "Luxferre's Truly Tiny BASIC test suite"
15 print ""
20 print "All lines should end with OK to pass"
30 print "Let's go..."
35 print ""
40 print "Nested IF and A-I zero init: ";
50 if a=0 if b=0 if c=0 if d=0 if e=0 if g=0 if h=0 if i=0 print "OK"
55 print ""
60 print "Nested IF and J-Q zero init: ";
70 if j=0 if k=0 if l=0 if m=0 if n=0 if o=0 if p=0 if q=0 print "OK"
75 print ""
80 print "Nested IF and R-Y zero init: ";
90 if r=0 if s=0 if t=0 if u=0 if v=0 if w=0 if x=0 if y=0 print "OK"
95 print ""
100 print "Z zero init: ";
110 if z=0 print "OK"
120 print ""
130 print "Precedence: ";
140 if 2 + 2 * 2 - 3 / 3 = 5 print "OK"
150 print ""
160 print "Left assoc and full THEN form: ";
170 if 63 / 8 * 8 = 56 then print "OK"
180 print ""
190 print "Parentheses: ";
200 if 5 * (2+3) * (4 + 1) = 125 print "OK"
210 print ""
220 print "Int pos wrap: ";
230 if 32767 + 1 = -32768 print "OK"
240 print ""
250 print "Int neg wrap: ";
260 if -32768 - 1 = 32767 print "OK"
270 print ""
280 print "int mod wrap: ";
290 if 32767 + 65535 = 32766 print "OK"
300 print ""
310 print "This should display 108 after a space: ";12*9;" -> OK"
315 print ""
320 print "This should display 56 after a tab: ", 63/8*8 ; " -> OK"
325 print ""
330 print "GOTO: ";
340 goto 3 * 300
350 print ""
360 print "GOSUB: ";
370 GOSUB 2 + 918
380 print "OK"
390 print ""
400 print "RND: ";
410 x = rnd(100) + rnd(100) + rnd(100) + rnd(100) + rnd(100) + rnd(100)
420 if x < 600 if rnd(100) <> x/6 print "OK"
430 print ""
440 print "Indirect line rewriting in if/then form: ";
450 if x > -1 then 950 print "OK"
460 gosub 950
470 print ""
480 print "Test end, thank you!"
490 end
890 print "This line should never be printed"
900 print "OK"
910 goto 350
920 print "OK"
930 print "RETURN: ";
940 return
950 print "NOT OK"
960 return