if pbver < 3.9 then print "Incorrect Version of PBASIC":stop start = timer dim ar(100), cr(100) dim br(10) cls restore a = -1 if port=1 then a=romver ?"rom Version ";a;" Free: ";fre(0) ?"Running test of PBASIC " pbver " on "; if port=0 then ?"PC" else ?"Portfolio" print "Command Tail : " command$ read a,b : if a <> 1 then print "Read Error":stop read a : if a <> 11 then print "Read Error":stop read a : if a <> 12 then print "Data Error":stop y = 11 if y <> 11 then print "Assignment Error":stop for x = 1 to 10 y = y + 2 next x restore 13 read a : if a <> 21 then print "Restore Error":stop if y = 31 then goto 10 else print "Loop Error":stop print "this is never execute" : stop 10 a = 1 a = a + 15 if a <> 16 then print "Addition error":stop a = a * 10 if a <> 160 then print "Multiply error":stop a = a / 20 if a <> 8 then print "divide error":stop a = a - 5 if a <> 3 then print "Subtraction Error":stop a = 10 b = a \ 3 if b <> 3 then print "Int. Division Error":stop b = a % 3 if b <> 1 then print "Mod Error":stop if 2^5 <> 32 then print "Exp Error":stop if int(12^2.5) <> int(498.831) then print "Exp Error":stop if 2^-1 <> .5 then print "Exp Error":stop if fix(1234567.123)<>1234567 then print "Fix Error":stop if int(1234565.123)<>1234565 then print "Int Error":stop 11 data 1,2 12 data 11,12,13,14,15,16,17,18,19,20 13 data 21,22,23,24,25,26,27,28,29,30 a = 1.23e+2 : if a<> 123 then print "Real Number error":stop a = 1.23e-2 : if a <> .0123 then print "Real Number Error":stop for a1 = 0 to 10 ar(a1) = a1 : br(a1) = ar(a1) next if abs(-5)<>5 then print "ABS Error":stop for a1 = 10 to 0 step -1 if ar(a1) <> br(a1) then print "Array Error" : stop next a1 m = 1 n = 2 swap m,n : if m<> 2 then print "Swap Error" :stop swap m,n swap ar(7),br(8) : if br(8) <> 7 then print br(8), "Swap Error":stop swap ar(7),br(8) swap ar(5), m : if m <> 5 then print "Swap Error":stop swap m, ar(5) : if m <> 1 then print "Swap Error":stop y = 12 for x = 10 to 1 step -1 y = y - 2 next x if y = 10 then print "Loop error":stop if y >= 0 then print "loop error":stop if y < 10 then goto 20 print "If Error":stop 20 if y <= -8 then goto 30 print "If error":stop 30 if y <> -8 then print "Loop Error":stop gosub 100 if y = -8 then "Gosub error":stop if &h100 <> 256 then print "Hex error":stop if &o377 <> 255 then print "Octal error":stop if 15 <> &17 then print "Octal error":stop if port=1 then def seg=&hb000 else def seg = &hb800 poke 0,196 if port=1 then refresh if peek(0) <> 196 then print peek(0),"Peek/Poke/Seg Error":stop poke 0,82 if port=1 then refresh abcde = 12345 rem abcde = 0 if abcde <> 12345 then print "Rem error":stop 'abcde = 1 if abcde = 1 then print "Rem Error":stop z = 1+2*3+4/5*6-1 w = 10.8 if z <> w then print z,w,"Precedence error":stop if sqr(100)<>10 then print "SQR Error":stop cx = csrlin : cy = pos(0) locate 5,6 if csrlin <> 5 then print "Locate Error":stop if pos(0) <> 6 then print "Locate Error":stop locate cx, cy gosub 1234: ' string tests on port+1 goto 1000, 2000 'port tests print "On Goto Error":stop 1000 ' new features for 4.0 if deg(rad(deg(rad(45)))) <> 45 then ? "DEG/RAD Error":stop if (3 and 1) <> 1 then ?"AND Error":stop if (3 or 1) <> 3 then ?"OR Error":stop if (10 xor 5) <> 15 then ?"XOR Error":stop if (not true) <> false then ?"TRUE/FALSE Error":stop if (5 imp 124) <> -2 then ?"IMP Error":stop if (126 eqv 23) <> -106 then ?"EQV Error":stop if tan(pi/4) <> 1 then ? "TAN/PI Error":stop a$ = " BOB": if ltrim$(a$)<>"BOB" then ? "LTRIM$ Error":stop if rtrim$("X ") <> "X" then ?"RTRIM$ Error":stop a=0 repeat incr(a) until a=10 if a<>10 then ?"REPEAT/UNTIL Error":stop while a>1 decr(a) wend if a<>1 then ?"WHILE/WEND Error":stop print: 'print "End of test - OK" print "Test took " timer-start " seconds" : end end 100 y = 1 : return print "Multiline or Return Error":stop 2000 'port tests status 1 beep status 1 locate 7,14 click print "1-201-555-1234"; locate 7,13 status 0 box 6,11,8,30,1 dial "1-201-555-1234" box 6,11,8,30,0 for ct = 48 to 63 sound ct, 15 next ct locate 4,1 olddis = getdisplay display 2 'static vlocate 1,1 dir = 4:gosub 5000 dir = 2:gosub 5000 vx=vcsrlin:vy=vpos(0) vlocate 11,12 if vcsrlin<>11 then print "VCSRLIN Error":stop if vpos(0)<>12 then print "VPOS Error":stop vlocate vx,vy dir = 3:gosub 5000 dir = 1:gosub 5000 vlocate 1,1 display olddis goto 1000 5000 for xx = 1 to 5 vmove dir,1 click next xx return 9999 print fre(0) wait return ' ' This the string test file. It will be added to ' TEST.BAS later. ' ' 1234 dim bz(5,5) for x = 1 to 5 for y = 1 to 5 if bz(x,y)<>0 then print "Array Initialize Error":stop next y next x for x = 1 to 5 for y = 1 to 5 bz(x,y) = (x-1)*5+y next y next x for x = 1 to 5 for y = 1 to 5 if bz(x,y) <> (x-1)*5+y then print "Two Dimensional Array Error":stop next y next x dim sa$(10) print time$;" ";date$;" Free ";fre(0) sa$(1) = "array 1" sa$(2) = "array 2" if sa$(1)<>"array 1" then print "string array Error":stop s$="BJGleason" f$=left$(s$,2) if f$<>"BJ" then print "Left$ Error":stop m$=mid$(s$,2,2) if m$<>"JG" then print "Mid$ Error":stop if right$(s$,7)<>"Gleason" then print "Right$ Error":stop if instr(s$,"Gle")<>3 then print "Instr Error":stop c$ = "123" d$ = c$ + "456" + c$ if d$<>"123456123" then print "String Cat Error":stop if val("910")<>910 then print "Val Error":stop if asc("1")<>49 then print "ASC Error":stop qw$=str$(val(str$(val("66"))+"5")+1) if qw$<>"666" then print "String Error":stop if port=1 then dial d$ if bin$(7) <> "111" then print "BIN$ Error":stop if ucase$("abc") <> "ABC" then print "UCASE$ Error":stop if lcase$("CdC") <> "cdc" then print "LCASE$ Error":stop bjt = 123 bjt$ = "bjt = 345" eval bjt$ if bjt <> 345 then print "Eval Error":stop a$ = "BOB" a$ = A$ + a$ if a$<>"BOBBOB" then print "String Addition Error":stop return