Page images
PDF
EPUB
[blocks in formation]

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

[blocks in formation]

2010 PRINT "SECTION 26.2: MIXED OPERATORS, PARENTHESES, AND VARIABLES" 2020 PRINT

2030 PRINT "THIS SECTION TESTS THE USE OF PARENTHESES TO ALTER THE" 2040 PRINT "ORDER OF EVALUATION, EXPRESSIONS WITH SEVERAL OPERATORS," 2050 PRINT "AND THE USE OF VARIABLES AND CONSTANTS."

[blocks in formation]

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

2086 PRINT

2090 LET F=0

2100 LET 0$="1"

2110 LET A=4

2120 LET A=3-(A-5)

2130 LET Y=4

2140 GOSUB 9000

2150 LET 0$="2"

2160 LET B=2

2170 LET A=+2-B+2/B*2^B

[blocks in formation]

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

[blocks in formation]

PROGRAM FILE 26: PRECEDENCE RULES FOR NUMERIC EXPRESSIONS. ANSI STANDARD 7.2, 7.4

THIS PROGRAM TESTS WHETHER THE PRECEDENCE RULES ARE
CORRECTLY IMPLEMENTED.

SECTION 26.1: PRECEDENCE ACCORDING TO OPERATOR AND
POSITION (LEFT TO RIGHT).

THIS SECTION TESTS THE PRECEDENCE RULES USING SIMPLE
INTEGER OPERANDS AND ALL ORDERED PAIRS OF OPERATORS
FOR WHICH THE ORDER OF EVALUATION MAKES A DIFFERENCE.
NO PARENTHESES ARE USED.

[blocks in formation]

SECTION 26.2: MIXED OPERATORS, PARENTHESES, AND VARIABLES

THIS SECTION TESTS THE USE OF PARENTHESES TO ALTER THE
ORDER OF EVALUATION, EXPRESSIONS WITH SEVERAL OPERATORS,
AND THE USE OF VARIABLES AND CONSTANTS.

[blocks in formation]

5 PRINT "PROGRAM FILE 27: ACCURACY OF CONSTANTS AND VARIABLES."

10 PRINT " ANSI STANDARD 5.2, 5.4, 6.2, 6.4, 10.4"

15 PRINT

20 PRINT "***

25 PRINT "

30 PRINT "

35 PRINT "

40 PRINT " 45 PRINT

NOTE: THIS PROGRAM MAKES USE OF THE ON-GOTO STATEMENT"
AND FOR-BLOCKS (THE FOR AND NEXT STATEMENTS) WHICH"
HAVE NOT YET BEEN TESTED. IF SUBSEQUENT TESTS SHOW"
THESE FEATURES TO BE INCORRECTLY IMPLEMENTED, THEN THE "
VALIDITY OF THE RESULTS OF THIS TEST ROUTINE IS DOUBTFUL."

50 PRINT "THIS PROGRAM TESTS THE LEVEL OF ACCURACY OF NUMERIC VALUES," 55 PRINT "USING THE IF-THEN STATEMENT."

60 LET T1=34

70 LET T2=50

80 LET T3-T1+2

90 LET T4=T2+2

100 PRINT

110 PRINT "SECTION 27.1: ACCURACY IN COMPARISON OF VARIABLES." 120 PRINT

130 PRINT "THIS SECTION COMPARES TWO VARIABLES WHICH HAVE BEEN ASSIGNED" 140 PRINT "NUMERICALLY 'CLOSE' VALUES AND THEN DETERMINES WHETHER THE"

150 PRINT "IMPLEMENTATION CAN DISTINGUISH BETWEEN THEM OR IF THEY ARE" 160 PRINT "TREATED AS EQUAL."

170 PRINT

[blocks in formation]

3000 PRINT "SECTION 27.2: ACCURACY IN THE COMPARISON OF VARIABLES" 3010 PRINT "

3020 PRINT

WITH CONSTANTS."

3030 PRINT "THIS SECTION COMPARES A VARIABLE AND A CONSTANT WHICH HAVE" 3040 PRINT "NUMERICALLY 'CLOSE' VALUES AND THEN DETERMINES WHETHER THE" 3050 PRINT "IMPLEMENTATION CAN DISTINGUISH BETWEEN THEM OR IF THEY ARE" 3060 PRINT "TREATED AS EQUAL."

[blocks in formation]
« PreviousContinue »