ChipMaster's bwBASIC This also includes history going back to v2.10. *WARN* some binary files might have been corrupted by CRLF.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

185 lines
5.8 KiB

  1. REM ------------------------------------------------------------
  2. REM PURPOSE: TEST THE PARAMETER RANGE CHECKS
  3. REM AUTHOR: HOWARD WULF, AF5NE
  4. REM GENERATED: 02/21/2015 14:08:23
  5. REM FILENAME: F_INSTR_A_B_N.BAS
  6. REM SYNTAX: N = INSTR( A$, B$ )
  7. REM UNIQUEID: F_INSTR_A_B_N
  8. REM FUNCTION: INSTR
  9. REM
  10. REM VARIABLE DESCRIPTION
  11. REM I CURRENT TESTCASE NUMBER
  12. REM E EXPECTED ERROR FLAG
  13. REM F ACTUAL ERROR FLAG
  14. REM R EXPECTED FUNCTION RESULT
  15. REM N ACTUAL FUNCTION RESULT
  16. REM A$ ACTUAL FUNCTION PARAMETER
  17. REM B$ ACTUAL FUNCTION PARAMETER
  18. REM
  19. RESTORE 2000
  20. REM GET TESTCASE #
  21. READ I
  22. WHILE I > 0
  23. REM GET TESTCASE DATA
  24. READ E, R, A$, B$
  25. REM DISPLAY TESTCASE DATA
  26. PRINT "TESTCASE #";I,"E=";E,"R=";R, "A$=[";A$;"]", "B$=[";B$;"]"
  27. REM EXECUTE TESTCASE
  28. N = 0
  29. S$ = ""
  30. ON ERROR GOTO 9000
  31. F = 0
  32. 999 N = INSTR( A$, B$ )
  33. ERROR 0
  34. REM DISPLAY TESTCASE RESULTS
  35. PRINT ,"F=";F,"N=";N
  36. REM VERIFY EXPECTED ERROR
  37. IF E <> F THEN
  38. PRINT "*** TEST FAILED, EXCEPTION MISMATCH ***"
  39. STOP
  40. END IF
  41. REM VERIFY EXPECTED RESULT
  42. IF R > 0 THEN
  43. LET RMIN = 0.99 * R
  44. IF R > MAXNUM / 1.012 THEN
  45. LET RMAX = MAXNUM
  46. ELSE
  47. LET RMAX = 1.01 * R
  48. END IF
  49. END IF
  50. IF R < 0 THEN
  51. IF R < - MAXNUM / 1.012 THEN
  52. LET RMIN = -MAXNUM
  53. ELSE
  54. LET RMIN = 1.01 * R
  55. END IF
  56. LET RMAX = 0.99 * R
  57. END IF
  58. IF R = 0 THEN
  59. LET RMIN = -.01
  60. LET RMAX = +.01
  61. END IF
  62. IF N < RMIN THEN
  63. PRINT "*** TEST FAILED, RESULT MISMATCH ***"
  64. STOP
  65. END IF
  66. IF N > RMAX THEN
  67. PRINT "*** TEST FAILED, RESULT MISMATCH ***"
  68. STOP
  69. END IF
  70. PRINT "*** TEST PASSED ***"
  71. REM GET NEXT TESTCASE #
  72. READ I
  73. WEND
  74. PRINT "*** ALL TESTS PASSED ***"
  75. GOTO 9999
  76. 1999 REM TESTCASE, EXPECTED ERROR, EXPECTED RESULT, PARAMETERS...
  77. DATA 1 , 0 , 0 , "", ""
  78. DATA 2 , 0 , 1 , " ", " "
  79. DATA 3 , 0 , 1 , "3", "3"
  80. DATA 4 , 0 , 1 , "z", "z"
  81. DATA 5 , 0 , 1 , " ", " "
  82. DATA 6 , 0 , 1 , " 3", " 3"
  83. DATA 7 , 0 , 1 , " z", " z"
  84. DATA 8 , 0 , 1 , "3 ", "3 "
  85. DATA 9 , 0 , 1 , "z ", "z "
  86. DATA 10 , 0 , 1 , " 3 ", " 3 "
  87. DATA 11 , 0 , 1 , " z ", " z "
  88. DATA 12 , 0 , 1 , " LLLL", " LLLL"
  89. DATA 13 , 0 , 1 , " '' ", " '' "
  90. DATA 14 , 0 , 1 , " oo ", " oo "
  91. DATA 15 , 0 , 1 , " 00 ", " 00 "
  92. DATA 16 , 0 , 1 , " \\\\ ", " \\\\ "
  93. DATA 17 , 0 , 1 , " lllll ", " lllll "
  94. DATA 18 , 0 , 1 , " uuuu ", " uuuu "
  95. DATA 19 , 0 , 1 , " a ", " a "
  96. DATA 20 , 0 , 1 , " ", " "
  97. DATA 21 , 0 , 1 , " hh ", " hh "
  98. DATA 22 , 0 , 1 , " h ", " h "
  99. DATA 23 , 0 , 1 , " )", " )"
  100. DATA 24 , 0 , 1 , " 5 ", " 5 "
  101. DATA 25 , 0 , 1 , " 2 ", " 2 "
  102. DATA 26 , 0 , 1 , " - ", " - "
  103. DATA 27 , 0 , 1 , "dd ", "dd "
  104. DATA 28 , 0 , 1 , " tttt ", " tttt "
  105. DATA 29 , 0 , 1 , " :::: ", " :::: "
  106. DATA 30 , 0 , 1 , " ___ ", " ___ "
  107. DATA 31 , 0 , 1 , " ", " "
  108. DATA 32 , 0 , 1 , " ", " "
  109. DATA 33 , 0 , 1 , " _____ ", " _____ "
  110. DATA 34 , 0 , 1 , " S ", " S "
  111. DATA 35 , 0 , 1 , " FFFF ", " FFFF "
  112. DATA 36 , 0 , 1 , " kkk", " kkk"
  113. DATA 37 , 0 , 1 , " NNNN ", " NNNN "
  114. DATA 38 , 0 , 1 , " mmmm ", " mmmm "
  115. DATA 39 , 0 , 1 , " ,,,,, ", " ,,,,, "
  116. DATA 40 , 0 , 1 , "OO ", "OO "
  117. DATA 41 , 0 , 1 , " HHHH ", " HHHH "
  118. DATA 42 , 0 , 1 , " < ", " < "
  119. DATA 43 , 0 , 1 , " j ", " j "
  120. DATA 44 , 0 , 1 , " yyyy ", " yyyy "
  121. DATA 45 , 0 , 1 , " +++ ", " +++ "
  122. DATA 46 , 0 , 1 , "o ", "o "
  123. DATA 47 , 0 , 1 , " ((", " (("
  124. DATA 48 , 0 , 1 , " uu ", " uu "
  125. DATA 49 , 0 , 1 , " 00 ", " 00 "
  126. DATA 50 , 0 , 1 , " HH ", " HH "
  127. DATA 51 , 0 , 1 , " ", " "
  128. DATA 52 , 0 , 1 , " G ", " G "
  129. DATA 53 , 0 , 1 , " {{{{ ", " {{{{ "
  130. DATA 54 , 0 , 1 , " ]]] ", " ]]] "
  131. DATA 55 , 0 , 1 , "CCC", "CCC"
  132. DATA 56 , 0 , 1 , " 44 ", " 44 "
  133. DATA 57 , 0 , 1 , "^^ ", "^^ "
  134. DATA 58 , 0 , 1 , " QQ ", " QQ "
  135. DATA 59 , 0 , 1 , " FFFF ", " FFFF "
  136. DATA 60 , 0 , 1 , " n ", " n "
  137. DATA 61 , 0 , 1 , " hh ", " hh "
  138. DATA 62 , 0 , 1 , "555 ", "555 "
  139. DATA 63 , 0 , 1 , " YYYY ", " YYYY "
  140. DATA 64 , 0 , 1 , " w ", " w "
  141. DATA 65 , 0 , 1 , "MMMM ", "MMMM "
  142. DATA 66 , 0 , 1 , " JJJJ ", " JJJJ "
  143. DATA 67 , 0 , 1 , " %% ", " %% "
  144. DATA 68 , 0 , 1 , " * ", " * "
  145. DATA 69 , 0 , 1 , " @@@ ", " @@@ "
  146. DATA 70 , 0 , 1 , "I ", "I "
  147. DATA 71 , 0 , 1 , " ss ", " ss "
  148. DATA 72 , 0 , 1 , " f ", " f "
  149. DATA 73 , 0 , 1 , " D ", " D "
  150. DATA 74 , 0 , 1 , "### ", "### "
  151. DATA 75 , 0 , 1 , " ' ", " ' "
  152. DATA 76 , 0 , 1 , " dd ", " dd "
  153. DATA 77 , 0 , 1 , " TT ", " TT "
  154. DATA 78 , 0 , 1 , " vvv ", " vvv "
  155. DATA 79 , 0 , 1 , " X ", " X "
  156. DATA 80 , 0 , 1 , " % ", " % "
  157. DATA 81 , 0 , 1 , " ", " "
  158. DATA 82 , 0 , 1 , " 5555 ", " 5555 "
  159. DATA 83 , 0 , 1 , "FFFF ", "FFFF "
  160. DATA 84 , 0 , 1 , " %% ", " %% "
  161. DATA 85 , 0 , 1 , " ", " "
  162. DATA 86 , 0 , 1 , " ~~~~ ", " ~~~~ "
  163. DATA 87 , 0 , 1 , " || ", " || "
  164. DATA 88 , 0 , 1 , " SSS ", " SSS "
  165. DATA 89 , 0 , 1 , " 6666 ", " 6666 "
  166. DATA 90 , 0 , 1 , " ww ", " ww "
  167. DATA 91 , 0 , 1 , " 1111 ", " 1111 "
  168. DATA 92 , 0 , 1 , " K ", " K "
  169. DATA 93 , 0 , 1 , " ttttt ", " ttttt "
  170. DATA 94 , 0 , 1 , " OOOOO ", " OOOOO "
  171. DATA 95 , 0 , 1 , " E ", " E "
  172. DATA 96 , 0 , 1 , " PPPPP ", " PPPPP "
  173. DATA 97 , 0 , 1 , " == ", " == "
  174. DATA 98 , 0 , 1 , " VVVV ", " VVVV "
  175. DATA 99 , 0 , 1 , " c ", " c "
  176. DATA 100 , 0 , 1 , " yyyy ", " yyyy "
  177. DATA 0
  178. 9000 REM ERROR HANDLER
  179. IF ERL = 999 THEN
  180. F = ABS(SGN(ERR))
  181. RESUME NEXT
  182. END IF
  183. PRINT "*** UNEXPECTED ERROR ON LINE ";ERL;" ***"
  184. 9999 END