Page images
PDF
EPUB

10 PRINT "PROGRAM FILE 60: NUMERIC CONSTANTS USED AS SUBSCRIPTS" 20 PRINT " ARE ROUNDED TO NEAREST INTEGER."

30 PRINT " ANSI STANDARD 6.4, 5.4"

40 PRINT

50 PRINT "SECTION 60.2: NUMERIC CONSTANTS USED AS SUBSCRIPTS" 60 PRINT " ARE ROUNDED TO NEAREST INTEGER."

[merged small][merged small][merged small][merged small][merged small][merged small][merged small][merged small][ocr errors][merged small]

280 PRINT "SUBSCRIPT OF ";X$;" DID NOT EVALUATE TO ";Y$ 290 PRINT "*** TEST FAILED ***11

[blocks in formation]

PROGRAM FILE 60: NUMERIC CONSTANTS USED AS SUBSCRIPTS

ARE ROUNDED TO NEAREST INTEGER.

ANSI STANDARD 6.4, 5.4

SECTION 60.2: NUMERIC CONSTANTS USED AS SUBSCRIPTS
ARE ROUNDED TO NEAREST INTEGER.

[blocks in formation]

END PROGRAM 60

10 PRINT "PROGRAM FILE 61: NUMERIC EXPRESSIONS CONTAINING" 20 PRINT "

SUBSCRIPTED VARIABLES."

30 PRINT " ANSI STANDARD 6.2, 6.4, 7.2, 7.4"

40 PRINT

50 PRINT "SECTION 61.1: NUMERIC EXPRESSIONS CONTAINING" 60 PRINT "

70 PRINT

SUBSCRIPTED VARIABLES."

80 PRINT "THIS SECTION TESTS WHETHER SUBSCRIPTED VARIABLES"

90 PRINT "CAN BE USED AS PRIMARIES IN NUMERIC PRESSIONS."

[blocks in formation]

130 PRINT "CASE #","SHOULD BE","ACTUAL", "OUTCOME"

140 PRINT

150 LET F=0

160 LET C1=0

180 REM ARRAY B(I) CONTAINS FIBONACCI SERIES

200 LET B(1)=+001.00

210 LET B(2)=1

220 FOR I=3 TO 10

230 LET J=I-1

240 LET K=I-2

250 LET B(I)=B(J)+B(K)

260 NEXT I

270 LET A=B(5)+B(8)

280 LET Y=26

290 GOSUB 9000

300 LET C(7)=47.23/B(7)+23.E-1

310 LET H9=7.0

320 LET A=C(H9)+H9*B(H9)

330 LET Y=96.933076923

340 GOSUB 9000

350 LET H9=6

360 LET H9=B(H9)

370 LET H9=B(H9)

380 LET Z(0)=(H9/7)^B(4)*20/(B(7) −B(4))−B(10)—.02E+02 390 LET Z(1)=Z(0)+Z(0)

400 LET Z(2)=-Z(0)-Z(0)

410 LET Z(3)=2(0)*Z(0) 420 LET Z(4)=2(0)/Z(0)

430 LET Z(5)=2(0)^2(0)

440 LET A=Z(0)+Z(1)

450 LET Y=-9

460 GOSUB 9000

470 LET A=Z (2)+Z(3)+Z (4)+Z(5)

480 LET Y=15.962962963

490 GOSUB 9000

500 LET A=-2000.00E-03-B(10)-(B(4)-B(7))/2E+1*B(4)^(H9/7)

510 LET Y=-43.5

**

520 GOSUB 9000 530 FOR I=1 TO 7 540 FOR J=1 TO 7

550 LET Q(I, J)=I/J

560 NEXT J

570 NEXT I

580 LET A=Q(6,3)+Q(6,7)*Q(5,4)*(-Q(2,3))*Q(7,2)/Q(5,6)/Q(3,4)

590 LET Y=-2

600 GOSUB 9000

2000 PRINT

2010 IF F=0 THEN 2040

2020 PRINT "*** TEST FAILED IN ";F;" CASE(S). ***"

[blocks in formation]

9002 REM THIS SUBROUTINE ADOPTS A VERY LOOSE CRITERION OF CORRECTNESS 9004 REM (RELATIVE ERROR < .01). ITS PURPOSE IS NOT TO MEASURE ACCURACY 9006 REM BUT ONLY TO ASSURE THAT THE SEMANTICS OF THE EXPRESSION

9008 REM HAVE BEEN CORRECTLY IMPLEMENTED.

9010 LET C1=C1+1

9020 PRINT C1,Y,A,

9030 LET P$="FAILS"

9040 LET M=0.01

9050 LET T=(A-Y)/Y

9060 IF T>M THEN 9110

9070 LET T=-T

9080 IF T>M THEN 9110

9090 LET P$="PASSES"

9100 GOTO 9120

9110 LET F=F+1

9120 PRINT "TEST ";P$

9130 RETURN

9140 END

PROGRAM FILE 61: NUMERIC EXPRESSIONS CONTAINING
SUBSCRIPTED VARIABLES.

ANSI STANDARD 6.2, 6.4, 7.2, 7.4

SECTION 61.1: NUMERIC EXPRESSIONS CONTAINING
SUBSCRIPTED VARIABLES.

THIS SECTION TESTS WHETHER SUBSCRIPTED VARIABLES
CAN BE USED AS PRIMARIES IN NUMERIC EXPRESSIONS.

BEGIN TEST

CASE #

SHOULD BE

ACTUAL

OUTCOME

[blocks in formation]

10 PRINT "PROGRAM FILE 62: GENERAL SYNTACTIC AND SEMANTIC"

20 PRINT "

30 PRINT "

PROPERTIES OF ARRAY CONTROL STATEMENTS:"
OPTION AND DIM."

40 PRINT " ANSI STANDARD 15.2, 15.4"

50 PRINT

60 PRINT "SECTION 62.1: GENERAL SYNTACTIC AND SEMANTIC" 70 PRINT "

80 PRINT "

90 PRINT

PROPERTIES OF ARRAY CONTROL STATEMENTS:"
OPTION AND DIM."

100 PRINT "THIS SECTION ASSURES THAT OPTION-STATEMENTS MAY PRECEDE"
110 PRINT "DIM-STATEMENTS, THAT REFERENCES TO IMPLICITLY-DIMENSIONED"
120 PRINT "ARRAYS MAY ALSO PRECEDE DIM-STATEMENTS, AND THAT FLOW"
130 PRINT "OF CONTROL MAY PASS THROUGH OPTION AND DIM STATEMENTS."
140 PRINT

[blocks in formation]

190 REM CAN FALL THROUGH OR JUMP TO OPTION WITH NO EFFECT

200 IF T<>1 THEN 230

210 LET T=2

220 GOTO 180

230 LET A(1)=1

240 REM CAN REFERENCE ARRAY BEFORE ANY DIM-STATEMENT

250 FOR I=2 TO 10

260 LET J=I-1

270 LET A(I)=A(J)+A(J)

280 NEXT I

290 IF A(10)=512 THEN 320

300 LET M$="IMPLICIT ARRAY"

310 GOSUB 1000

320 LET T=1

330 DIM D(3),C(2,4),B(12)

340 REM CAN DIMENSION SEVERAL ARRAYS IN NON-ALPHA ORDER AND 350 REM OF DIFFERENT DIMENSIONALITY

360 REM CAN FALL THROUGH OR JUMP TO DIM

370 IF T<>1 THEN 400

380 LET T=2

*** ***

390 GOTO 330

400 LET B(12)=A(10)

410 FOR I=11 TO 1 STEP -1

420 LET J=I+1

430 LET B(I)=B(J)

440 NEXT I

450 IF B(1)=512 THEN 480

460 LET M$="EXPLICIT ARRAY"

470 GOSUB 1000

480 GOTO 510

490 DIM E(14)

500 REM DIM SETS ARRAY SIZE EVEN IF JUMPED OVER 510 LET A(10)=666

[merged small][merged small][merged small][merged small][ocr errors][merged small][merged small][merged small][merged small][merged small][merged small][merged small][merged small][merged small][merged small][merged small]

PROGRAM FILE 62: GENERAL SYNTACTIC AND SEMANTIC
PROPERTIES OF ARRAY CONTROL STATEMENTS:
OPTION AND DIM.

ANSI STANDARD 15.2, 15.4

SECTION 62.1: GENERAL SYNTACTIC AND SEMANTIC
PROPERTIES OF ARRAY CONTROL STATEMENTS:
OPTION AND DIM.

THIS SECTION ASSURES THAT OPTION-STATEMENTS MAY PRECEDE
DIM-STATEMENTS, THAT REFERENCES TO IMPLICITLY-DIMENSIONED
ARRAYS MAY ALSO PRECEDE DIM-STATEMENTS, AND THAT FLOW
OF CONTROL MAY PASS THROUGH OPTION AND DIM STATEMENTS.

BEGIN TEST

*** TEST PASSED 黃黃黃

« PreviousContinue »