home *** CD-ROM | disk | FTP | other *** search
/ GEMini Atari / GEMini_Atari_CD-ROM_Walnut_Creek_December_1993.iso / zip / portfoli / pbas21.lzh / test.bas < prev    next >
BASIC Source File  |  1991-08-22  |  4KB  |  162 lines

  1.    start = timer
  2.    dim ar(100),cr(100)
  3.    dim br(10)
  4.    cls
  5.    restore
  6.    a = -1
  7.    if port=1 then a=romver
  8.    print "rom Version ";a;"  Free: ";fre(0)
  9.    print "Running test of PBASIC 2.1 on ";
  10.    if port=0 then print "PC" else print "Portfolio"
  11.    read a,b : if a <> 1 then print "Read Error":stop
  12.    read a : if a <> 11 then print "Read Error":stop
  13.    read a : if a <> 12 then print "Data Error":stop
  14.  
  15.    y = 11
  16.    if y <> 11 then print "Assignment Error":stop
  17.    for x = 1 to 10
  18.      y = y + 2
  19.    next x
  20.    restore 13
  21.    read a : if a <> 21 then print "Restore Error":stop
  22.    if y = 31 then goto 10 else print "Loop Error":stop
  23.    print "this is never execute" : stop
  24. 10 a = 1
  25.    a = a + 15
  26.    if a <> 16 then print "Addition error":stop
  27.    a = a * 10
  28.    if a <> 160 then print "Multiply error":stop
  29.    a = a / 20
  30.    if a <> 8 then print "divide error":stop
  31.    a = a - 5
  32.    if a <> 3 then print "Subtraction Error":stop
  33.    a = 10
  34.    b = a \ 3
  35.    if b <> 3 then print "Int. Division Error":stop
  36.    b = a % 3
  37.    if b <> 1 then print "Mod Error":stop
  38.    if 2^5 <> 32 then print "Exp Error":stop
  39.    if int(12^2.5) <> int(498.831) then print "Exp Error":stop
  40.    if 2^-1 <> .5 then print "Exp Error":stop
  41.  
  42.    if fix(1234567.123)<>1234567 then print "Fix Error":stop
  43.    if int(1234565.123)<>1234565 then print "Int Error":stop
  44.  
  45. 11 data 1,2
  46. 12 data 11,12,13,14,15,16,17,18,19,20
  47. 13 data 21,22,23,24,25,26,27,28,29,30
  48.  
  49.    a = 1.23e+2 : if a<> 123 then print "Real Number error":stop
  50.    a = 1.23e-2 : if a <> .0123 then print "Real Number Error":stop
  51.  
  52.  
  53.    for a1 = 0 to 10
  54.       ar(a1) = a1 : br(a1) = ar(a1)
  55.    next
  56.  
  57.    if abs(-5)<>5 then print "ABS Error":stop
  58.    for a1 = 10 to 0 step -1
  59.       if ar(a1) <> br(a1) then print "Array Error" : stop
  60.    next a1
  61.  
  62.    m = 1
  63.    n = 2
  64.    swap m,n : if m<> 2 then print "Swap Error" :stop
  65.    swap m,n
  66.  
  67.    swap ar(7),br(8) : if br(8) <> 7 then print br(8), "Swap Error":stop
  68.    swap ar(7),br(8)
  69.  
  70.    swap ar(5), m : if m <> 5 then print "Swap Error":stop
  71.    swap m, ar(5) : if m <> 1 then print "Swap Error":stop
  72.    y = 12
  73.    for x = 10 to 1 step -1
  74.       y = y - 2
  75.    next x
  76.    if y = 10 then print "Loop error":stop
  77.    if y >= 0 then print "loop error":stop
  78.    if y < 10 then goto 20
  79.    print "If Error":stop
  80. 20 if y <= -8 then goto 30
  81.    print "If error":stop
  82. 30 if y <> -8 then print "Loop Error":stop
  83.    gosub 100
  84.    if y = -8 then "Gosub error":stop
  85.  
  86.    if &h100 <> 256 then print "Hex error":stop
  87.    if &o377 <> 255 then print "Octal error":stop
  88.    if 15 <> &17 then print "Octal error":stop
  89.  
  90.    if port=1 then def seg=&hb000 else def seg = &hb800
  91.    poke 0,196
  92.    if port=1 then refresh
  93.    if peek(0) <> 196 then print peek(0),"Peek/Poke/Seg Error":stop
  94.    poke 0,82
  95.    if port=1 then refresh
  96.  
  97.    abcde = 12345
  98.    rem abcde = 0
  99.    if abcde <> 12345 then print "Rem error":stop
  100.    'abcde = 1
  101.    if abcde = 1 then print "Rem Error":stop
  102.  
  103.    z = 1+2*3+4/5*6-1
  104.    w = 10.8
  105.    if z <> w then print z,w,"Precedence error":stop
  106.  
  107.    if sqr(100)<>10 then print "SQR Error":stop
  108.  
  109.    cx = csrlin : cy = pos(0)
  110.    locate 5,6
  111.    if csrlin <> 5 then print "Locate Error":stop
  112.    if pos(0) <> 6 then print "Locate Error":stop
  113.    locate cx, cy
  114.  
  115.       on port+1 goto 1000, 2000 'port tests
  116.       print "On Goto Error":stop
  117. 1000  print "End of test - OK"
  118.       print "Test took " timer-start " seconds" : end
  119.       end
  120.  
  121.  
  122. 100 y = 1 : return
  123.     print "Multiline or Return Error":stop
  124.  
  125.  
  126. 2000 'port tests
  127.      status 1
  128.      beep
  129.      status 1
  130.      locate 7,14
  131.      click
  132.      print "1-201-555-1234";
  133.      locate 7,13
  134.      status 0
  135.      box 6,11,8,30,1
  136.      dial "1-201-555-1234"
  137.      box 6,11,8,30,0
  138.      for ct = 48 to 63
  139.        sound ct, 15
  140.      next ct
  141.      locate 3,1
  142.      display 2 'static
  143.      vlocate 1,1
  144.      dir = 4:gosub 5000
  145.      dir = 2:gosub 5000
  146.      vx=vcsrlin:vy=vpos(0)
  147.      vlocate 11,12
  148.      if vcsrlin<>11 then print "VCSRLIN Error":stop
  149.      if vpos(0)<>12 then print "VPOS Error":stop
  150.      vlocate vx,vy
  151.      dir = 3:gosub 5000
  152.      dir = 1:gosub 5000
  153.      vlocate 1,1
  154.      goto 1000
  155.  
  156.  
  157. 5000  for xx = 1 to 5
  158.          vmove dir,1
  159.          click
  160.       next xx
  161.       return
  162. ə