NBSIR 78-1420-3 fNBS Minimal BASIC Test

Programs - Version 1

User's Manual

Volume 3 - Control Statements, Data Structure, Program Input

David E. Gilsinn

Charles L. Sheppard

Systems and Software Division

Institute for Computer Sciences and Technology

National Bureau of Standards

Washington, D C. 20234

U S. DEPARTMENT OF COMMERCE

NATIONAL BUREAU OF STANDARDS

NBSIR 78-1420-3

NBS MINIMAL BASIC TEST

PROGRAMS - VERSION 1 USER'S MANUAL

Volume 3 - Control Statements, Data Structure, Program Input

David E. Gilsinn

Charles L. Sheppard

Systems and Software Division

Institute for Computer Sciences and Technology

National Bureau of Standards

Washington, D C. 20234

U.S. DEPARTMENT OF COMMERCE, Juanita M. Kreps, Secretary

Dr. Sidney Harman, Under Secretary

Jordan J. Baruch, Assistant Secretary for Science and Technology

NATIONAL BUREAU OF STANDARDS, Ernest Ambler, Acting Director
ABSTRACT

This volume is the third of four volumes that comprise the user's guide

to the NBS Minimal BASIC test programs. The programs test whether a BASIC

processor accepts the syntactical forms and produces semantically meaningful

results according co the specifications given in BSR X3.60 Proposed Amer i can National Standard for Minimal BASIC . The object of this volume is to

compTete Tlie ~ testing of the control structures, introduce new data

structures, and test the user interactive capability of the language. There

are sixty individual programs in this volume that cover looping structures,

array variables, exception tests, subroutines, multiway branch structures,

data declarations and interactive data inputs,

available on tape.

The entire set of programs is

Key Words: BASIC, BASIC standard, BASIC validation, compiler validation,

computer programming language, computer standards
Table of Contents

Page

0.0 Introduction... 1

34.0 The FOR - NEXT Statements 3 Program Listing 5 Sample Output 9 35.0 Exiting from FOR - Blocks 12

Program Listing 12

Sample Output 13

36.0 Syntax Diagnostic - A FOR - Statement Without a Matching

NEXT - Statement 15

Program Listing 15

Sample Output 16

37.0 Syntax Diagnostic - A NEXT - Statement Without a Matching FOR - Statement 17

Program Listing 17

Sample Output 17

38.0 Semantic Error - The Interleaving of Two FOR - Blocks 19

Program Listing 79

Sample Output 20

39.0 Introducing the Dimension Statement 21

Program Listing.. 23

Sample Output 25

40.0 Extending IF - THEN Capabilities by Using One - Dimensional

Arrays in the Comparison 27

Program Listing 27

Sample Output 31

41.0 Extending IF - THEN Capabilities by Using Two - Dimensional

Arrays in the Comparison 33

Program Listing 33

Sample Output 38

42.0 The ABS Function With Subscripted Variables for Arguments 39

Program Listing 39

Sample Output 1+0 43.0 Using Elementary Operations on Subscripted Variables Assigned

Same Type Constants 1+2 Program Listing 1*2 Sample Output 1+5 44.0 Using Elementary Operations on Subscripted Variables Assigned

Same Type Constants (Continued) 1*8 Program Listing..... 1*8 Sample Output 52

45.0 Using Elementary Operations on Subscripted Variables Assigned

Mixed Type Constants 56

Program Listing 56

i i i
Sample Output 58

46.0 Using Elementary Operations on Subscripted Variables Assigned

Mixed Type Constants (Continued) 60

Program Listing 60

Sample Output.... 62

47.0 Using Elementary Operations on Subscripted Variables Assigned

Mixed Type Constants (Continued) 6k

Program Listing 6k

Sample Output 70

48.0 Addition of More Than Two Terms Containing Array Elements 73

Program Listing 73

Sample Output 73

49.0 Multiplication of More Than Two Terms 77

Program Listing 77

Sample Output 79

50.0 Hierarchy of Operators and Parentheses 81

Program Listing 81

Sample Output 86

51.0 Evaluation of Expressions that have a Variety of Operators 89

Program Listing. 89

Sample Output 92

52.0 Exception Test - Zero Raised to a Negative Power 914 Program Listing 9

1+ Sample Output 99

53.0 Exception Test - A Negative Number Raised to a Non - Negative

Power g6

Program Listing 96

Sample Output 9

7

54.0 Semantic Error - Subscripted Variable with Different Numbers

of Subscripts gg

Program Listing gg

Sample Output gg

55.0 Exception Test - A Subscript is not in the Range of the

Implicit Dimensioning Bounds 100

Program Listing 100

Sample Output 10i

56.0 Exception Test - A subscript is not in the Range of an Explicitly Dimensioned Variable 102

Program Listing 102

Sample Output 102

57.0 Attempting String Overflow by Variable Assignment 10^

Program Listing 10I4 Sample Output 105

58.0 Test for Undefined Variables 107

iv
Program Listing 107

Sample Output 108

59.0 Exception Test - On Division by Zero..... HO

Program Listing HO

Sample Output HI

60.0 Exception Test - On Expression Evaluation Resulting in

Overflow.... 113

Program Listing n3

Sample Output nU

61.0 Semantic Test - On the Magnitude of a Nonzero Numeric Constant

That is too Small H7 Program Listing n7

Sample Output Hg

62.0 Exception Test - On the Magnitude of a Nonzero Numeric Constant

That is too large n9

Program Listing n9

Sample Output 12 o 63.0 DIM Statement With the OPTION Statement 122

Program Listing 122

Sample Output 123

64.0 Using the OPTION BASE - Statement to Change Implicit Array

Lower Bounds.' 125

Program Listing 125

Sample Output 125

65.0 Testing the Assignment of Zero for an Expression Causing

Underflow upon Evaluation..... 127

Program Listing 127

Sample Output 127

66.0 GOSUB/RETURN - Statement 129

Program Listing 130

Sample Output 131

67.0 Semantic Error - Test on GOSUB Transfer to an Illegal Line

Number 133

Program Listing 133

Sample Output 13^

68.0 Exception Test - RETURN - Statement Without GOSUB 135

Program Listing 135

Sample Output 136

69.0 Testing Roundoff to Six Significant Digits of Constants of

Arbitrary Length 137

Program Listing 137

Sample Output Ill

70.0 The ON - GOTO Statement ll3

Program Listing I 1*

1* Sample Output 1 U 7

v
71.0 Semantic Diagnostic - ON - GOTO Statement Referring to a Non-Existent Line Number 1^8

Program Listing 1^8

Sample Output 1^9

72.0 Exception Test - Value of ON - GOTO Expression Less than One.( . 150

Program Listing 150

Sample Output 150

73.0 Exception Test - Value of ON - GOTO Expression Greater than

the Number of Line Numbers in the List 152

Program Listing 152

Sample Output 152

74.0 READ/DATA Statements 15 1* Program Listing 156

Sample Output 159

75.0 Exception Test - READ - Statement Encounters Insufficient

DATA l6l

Program Listing l6l

Sample Output 162

76.0 Exception Test - Non-Matching String Datum Assigned to a Numeric Variable 163

Program Listing 163

Sample Output 163

77.0 Exception Test - Attempting a String Datum Overflow 165

Program Listing 165

Sample Output 166

78.0 Semantic Interpretation - A Numeric Value in a DATA List

Causes an Underflow 167

Program Listing 167

Sample Output 167

79.0 Exception Test - A Numeric Value in a DATA Statement Causes

an Overflow 169

Program Listing 169

Sample Output 169

80.0 Exception Test - Overflow Caused by a Numeric Value in a DATA Statement (Continued) 171

Program Listing 171

Sample Output 171

81.0 Restoring READ Data 173

Program Listing 173

Sample Output 17L1 82.0 INPUT Statement for Numeric Constants 176

Program Listing 177

Sample Output 181

83.0 INPUT of Numeric Data to Subscripted Variables and Unquoted

Str i ngs 183
Program Listing....... 183

Sample Output 187

84.0 Inputting Mixed Data 190

Program Listing 190

Sample Output 1 9

L

85.0 Exception Test - Type of Datum Incorrect 196

Program Listing 196

Sample Output 197

86.0 Exception Test - Too much Data in DATA List 198

Program Listing ^98

Sample Output. 199

87.0 Exception Test - Insufficient Data in DATA List 200

Program Listing 200

Sample Output 201

88.0 Numeric Underflow on INPUT 202

Program Listing 202

Sample Output 202

89.0 Exception Test - Numeric Overflow 20U

Program Listing 20U

Sample Output 205

90.0 Testing the INT and SGN Functions 206

Program Listing 206

Sample Outpu t 208

' 91.0 Printing Strings Beyond the Margin..... 210

Program Listing. 211

Sample Output.... 21 U 92.0 Tabbing Strings Beyond the Margin. 217

Program Listing 217

Sample Output 220

93.0 Exception Test - String Overflow.... 229

Program Listing 229

Sample Output 230

vi i
.
0.0 INTRODUCTION

This volume is the third in a set of four volumes that comprise the

user's guide to the NBS Minimal BASIC test programs. There are sixty

individual programs in this volume that cover looping structures, array

variables, exception tests, subroutines, multiway branch structures, data

declarations and the interactive data inputs. As in the previous volumes the

user is assumed to be familiar with the American National Standard for

Minimal BASIC, BSR X3.60.

The first tests execute various forms of FOR - NEXT

statements. These include tests that use loops with and without the step

clause. Although the standard does not specify the depth to which loops can

be nested, one test executes a nest of three deep to accomodate at least the

looping needed to handle a matrix within some iterative algorithms consisting

of one loop. The matrix itself is doubly dimensioned. Another test checks

the control variable on exiting from a loop. There are finally some error detection routines for looping.

A natural extension to the looping tests is the introduction of

dimensioned variables. These programs first test implicit and explicit

dimensioning without the OPTION statement. The OPTION statement in Minimal

BASIC allows the user to redefine the lower bound of array indices, which is

assumed to be 0 unless altered by the OPTION BASE statement. Next, arrays

are used in simple expressions which control some conditional branches.

These branch statements are then used to test more complex arithmetic

expressions that make use of arrays. Many of the tests of arithmetic

'expression evaluation are similar to previous arithmetic tests, but in the

present volume the expressions also use arrayed variables as well as simple

variables and constants. There are a number of exception tests included, as

for example, checking for subscripts out of bounds. The OPTION statement is

then introduced and tested by checking whether out of bounds errors are detected when the zero-th element of an array is called for after the OPTION

BASE was used to specify a lower array bound of one, for example.

Up to this point only the elementary direct transfer GOTO and

conditional branch IF-THEN have been tested and used. Two new control

structures are now introduced. The tests first examine the GOSUB and RETURN

statements. Although no minimal depth of subroutine nesting is spec i f i ed , one

of the tests assumes the capability of handling at least four GOSUB levels.

There are also some exception tests associated with the GOSUB capability.

The next control structure introduced after the GOSUB statement is the

ON-GOTO statement. The main issue in this statement is whether the

expression used after the ON is rounded by the test system to the nearest

integer rather than truncated. Several tests execute different cases for

this statement type, including diagnostic and exception tests.

The final statement types tested in this

into a program either as a list or through

these is the DATA statement. Several issues

For example not only does the READ sta

sequential datum to the READ list item but it

the datum is compatible with the variable,

two ways. Each of these has to be examined,

there is insufficient or too much data

volume allow insertion of data

an external media. The first of

are tested in these routines,

tement have to assign the proper

must be able to detect whether

String data can be specified in

Such exceptions as whether

have to be tested. Finally the

1
RESTORE statement has to be tested in order to determine that the data list can be reread. Although the DATA statement is one way of entering data to a program, another way is by means of the INPUT statement that calls for

interaction with an external data source. Again the tests not only had to

test whether data could be entered but whether it was compatible with what

the program assumes is being entered, whether there is too much or too little

data being entered, or whether leading and trailing string spaces are accepted or ignored.

The last tests in this volume consider what happens when strings are too

long to fit within the margin. The tests include ones to determine how the

system handles the tabbing of a string beyond the margin. In general the

system must determine how many margin widths fit within the number of spaces

requested, skip that many lines and then print the item in the appropriate

column computed by a specified formula. The last test uses the INPUT

capability to test the exception handling capability of the test system when

string overflow is encountered.

2
34.0

THE FOR-NEXT STATEMENTS

This unit tests several uses of the FOR-statement and the

NEXT-statement . They provide for the construction of loops, if the following

conditions are met: (1) the control variable is any simple numeric variable;

and, (2) both FOR and NEXT have the same control variable. In the absence of

the STEP clause, the increment is always +1.

The sequence of statements from the FOR-statement and NEXT-statement

forms a block referred to as the FOR-block. FOR-blocks can be nested (one can be contained within another), but they cannot be interleaved. All

FOR-blocks are inactive at the initiation of a program but become active upon

execution of the FOR-statement. It remains active until it is exited via its

NEXT-statement, or until control is transferred to a FOR-statement (which may

or may not be the one associated with that FOR-block) having the same control

variable. However, control can exit a FOR-block via a control statement in

which case the FOR-block should remain active. When exit from a FOR-block is

via a NEXT-statement, the value of the control variable should be the first

value not used. For the precise specifications a user is referred to section

11 of BSR X3. 60 .

34.1

FOR/NEXT, Without a STEP Clause

The objective of this subsection is to verify that in the absence of a STEP clause in a FOR-statement, the implementation will assume the increment

to be + 1

.

34.1.1 Initial-Value and Limit Are Integers

The objective here is to initiate the use of the FOR-statement by using

integer values only.

34.1.1.1 Different Initial and Limit Values

In this test each loop of the FOR-block is counted, and the final value

of the counter, C, determines whether the test passed or failed. There is

also a variable, T, in the FOR-block that keeps a running total of the values

assigned to the control var iable , i .e . I in this case. On output there

should be a message indicating whether the test failed or passed. If the

test failed then the following message should be printed: TEST FAILED. If

the test passed then the following message should be printed: TEST PASSED.

34.1.1.2 Equal Initial and Limit Values

This test shows that looping should not terminate until an increment

causes the value of the control variable to exceed the value of the limit,

unless there is an exit via a control statement. The actions of the C and

the T variables are the same as in section 34.1.1.1 and so is the output.

34.1.2 Fractions Contained in the Limit

The purpose of this test is to continue loop testing in the absence of

the STEP clause increments, but using numbers in the control variable limits

with fractional values. To have a limit containing a fraction with an integer initial value means that incrementing should cause the control

variable to be either less than or greater than the limit, thus never

3
teaching the limit in the absence of the STEP clause. The actions of the C

and the T variables are34.2the same as in test 34.1.1.1, and so is the output.

FOR/NEXT Using Step Clause

The objective here is to use the STEP clause as a parameter in the

FOR-statement

.

34.2.1

Using Fractional Increments

This test verifies that the processor recognizes and, within machine

accuracy considerations, will increment a loop control variable with a fractional step in the proper manner. 34.2.1.1 For an Increasing Control Value

The STEP clause for this test is a fraction while its other parameters

are integers. The C and T variables are again used. The T variable for this

test is testing for added increments of +.5, since +.5 is the value for the

STEP clause in this test. The output for this test should be similar to the

output in test 34.1.1.1.

34.2.1.2 For a Decreasing Control Value

The object of this test is to show that looping of a FOR-block, when the

initial value is to be decreased in value, should not terminate until the

control variable has been assigned a value less than the value of the limit,

unless there is an exit via a control statement. As in the previous test, C

and T variables are used. The T variable for this test is testing for added

decrements of -.5, since -.5 is the value for the STEP clause in this test.

The output for this test should be the same as the output in test 34.1.1.1.

34.2.2

Using Integer Increments

The objective of this test is to use the STEP clause for increments

where the assigned STEP parameters are integer valued.

34.2.2.1

For Decreasing the Control Value

This test shows some of the various ways in which the STEP clause can be

used to decrease the value of the initial value to a desired limit value.

The output for all tests below is similar to test 34.1.1.1.

34.2.2.1.1 Positive to Positive

The object here is to test decreasing the control variable's value from

a positive number to a smaller positive number. The value for the STEP

clause in this test is -2.

34.2.2.1.2 Positive to Negative

The object here is to test decreasing the initial value from a positive

number to a negative number in step increments of -4.

34.2.2.1.3 Negative to Negative

k
The object here is to test decreasing the i ni t i al -value from one negative number to another negative number in increments of -1.

34.2.2.2 For Increasing Control Variable

This test is constructed to increase the control variable's value from one negative number to another negative number in increments of 2.

34.2.3 Fractions

The object of this test is to show that the initial value is allowed to

contain a fraction. The control variable will be stepped forward each time

by +2

.

34.3 Nesting FOR-Blocks, Three Deep

The object of this test is to test that FOR-blocks can be nested to a depth of three. That is, three FOR-blocks can be active at one time.

*******************

* PROGRAM FILE 34 * *******************

PRINT "PROGRAM FILE

PRINT

0010

0060

0070 PRINT

PRINT

PRINT

PRINT

PRINT

0120 PRINT

0130 PRINT " 0140 PRINT

PRINT " PRINT

0170 LET C=0

0180 LET T=0

0190 FOR I =-2 TO 3 0200 LET C=C+1

0210 LET T=T+I

0220 NEXT I IF C 06 THEN 250

IF T=3 THEN 270

34'

0080

0090

0100

0110

0150

0160

SECTION 34.1: FOR/NEXT, WITHOUT STEP CLAUSE.

SECTION 34.1.1: INITIAL VALUE AND LIMIT ARE INTEGERS.

SECTION 34.1.1.1: DIFFERENT VALUES, LOW TO HIGH.

BEGIN TEST."

0230

0240

0250

0260

PRINT " GOTO 300THE 6 LOOPS (-2 TO 3) , FAILED TEST

0270

0280

PRINT " PRINTTHE 6 LOOPS (-2 TO 3) , PASSED TEST

0290

0300

PRINT

PRINT

END TEST."

5
0310 PRINT " SECTION 34.1.1.2: EQUAL VALUES."

0320 PRINT

0330 PRINT " BEGIN TEST."

0340 PRINT

0350 LET C = 0 0360 LET T = 0 0370 FOR 1=3 TO 3 0380 LET C=C+1

0390 LET T=T+I

0400 NEXT I 0410 IF COl THEN 430

0420 IF T=3 THEN 450

0430 PRINT " THE 1 LOOP (3 TO 3), FAILED TEST

0440 GOTO 480

0450 PRINT " THE 1 LOOP (3 TO 3), PASSED TEST

0460 PRINT

0470 PRINT " END TEST.

0480 PRINT

0490 PRINT " SECTION 34.1.2: FRACTION CONTAINED IN THE LIMIT

0500 PRINT

0510 PRINT

0515 LET C = 0 0520 LET T=0

0530 FOR 1=4 TO 5.9

0540 LET C=C+1

0550 LET T=T+I

0560 NEXT I 0570 IF C<>2 THEN 590

0580 IF T=9 THEN

0590 PRINT " 0600 GOTO 640

0610 PRINT " 0620 PRINT

0630 PRINT M 0640 PRINT

0650 PRINT " 0660 PRINT

0670 PRINT " 0680 PRINT

0690 PRINT " 0700 PRINT

0710 PRINT " 0720 PRINT

0730 LET C=0

0740 LET T=0

0750 FOR 1=0 TO 4 STEP .5

0760 LET C=C+1

0770 LET T=T+I

0780 NEXT I 0790 IF C<>9 THEN 810

0800 IF T=1 8 THEN 830

0810

0820

PRINT " GOTO 860

THE 9 LOOPS (0 TO 4) , INCREMENTED BY .5, FAILED TEST

0830

0840

PRINT " PRINT

THE 9 LOOPS (0 TO 4) , INCREMENTED BY -5, PASSED TEST

0850 PRINT " 0860 PRINT

THE 2 LOOPS (4 TO 5.9) , FAILED TEST

THE 2 LOOPS (4 TO 5.9) , PASSED TEST

END TEST. n

SECTION 34.2: FOR/NEXT, USING STEP CLAUSE.

SECTION 34.2.1: USING FRACTIONAL INCREMENTS

SECTION 34.2.1.1: FOR INCREASING INITIAL VALUE

BEGIN TEST."

END TEST
0870 PRINT " SECTION 34.2

0880 PRINT

0890 PRINT " 0900 PRINT

0910 LET C = 0 0920 LET T=0

0930 FOR 1=2 TO 2 STEP -.5

0940 LET C=C+1

0950 LET T=T+I

0960 NEXT I 0970 IF COl THEN 990

0980 IF T=2 THEN 1010

0990 PRINT " THE 1 LOOP (2 TO 2) , 1000 GOTO 1040

1010 PRINT " THE 1 LOOP (2 TO 2)

,

1020 PRINT

1030 PRINT " 1040 PRINT

1050 PRINT " SECTION

1060 PRINT

1070 PRINT “ SECTION 34.

1080 PRINT

1090 PRINT " SECTION

1100 PRINT

1110 PRINT " 1120 LET C=0

1130 LET T=0

1140 FOR 1=4 TO' 1 STEP -2

1150 LET C=C + 1 1160 LET T=T+I

1170 NEXT I 1180 IF C<>2 THEN 1200

1190 IF T=6 THEN 1220

1200 PRINT " THE 2 LOOPS (4 TO 1)

1210 GOTO 1250

1220 PRINT " THE 2 LOOPS (4 TO 1)

1230 PRINT

1240 PRINT " 1250 PRINT

1260 PRINT " SECTION

1270 PRINT

1280 PRINT " 1290 PRINT

1300 LET C=0

1310 LET T=0

1320 FOR 1=8 TOi -8 STEP -4

1330 LET C=C+1

1340 LET T=T+I

1350 NEXT I 1360 IF C<>5 THEN 1380

1370 IF T=0 THEN 1400

1380 PRINT " THE 5 LOOPS (8 TO -8

1390 GOTO 1430

1400 PRINT " THE 5 LOOPS (8 TO -8

1410 PRINT

1420 PRINT " 1430 PRINT

1.2: FOR DECREASING INITIAL VALUE.

BEGIN TEST."

INCREMENTED BY -.5, FAILED TEST

INCREMENTED BY -.5, PASSED TEST

END TEST.

34.2.2: USING INTEGER INCREMENTS."

.2.1: FOR DECREASING INITIAL VALUE.

34.2.2.1.1: POSITIVE TO POSITIVE."

BEGIN TEST."

INCREMENTED BY -2, FAILED TEST."

INCREMENTED BY -2, PASSED TEST."

END TEST.

34.2.2.1.2: POSITIVE TO NEGATIVE."

BEGIN TEST."

, INCREMENTED BY -4, FAILED TEST."

, INCREMENTED BY -4, PASSED TEST."

END TEST."

T
1440

1450

1460

1470

1480

1490

1500

1510

1520

1530

1540

1550

1560

1570

1580

1590

1600

1610

1620

1630

1640

1650

1660

1670

1680

1690

1700

1710

1720

1730

1740

1750

1760

1770

1780

1790

1800

1810

1820

1830

1840

1850

1860

1870

1880

1890

1900

1910

1920

1930

1940

1950

1960

1970

1980

1990

2000

PRINT " SECTION 34.2.2.1.3: NEGATIVE TO NEGATIVE.

PRINT

PRINT " BEGIN TEST."

PRINT

LET C = 0 LET T=0

FOR I=-l TO -3 STEP -1

LET C=C + 1 LET T=T+I

NEXT I IF C <> 3 THEN 1560

IF T= (-6

)

THEN 1580

PRINT " GOTO 1610THE 3 LOOPS (-1 TO -3)

,

PRINT " PRINT

PRINT "

THE 3 LOOPS (-1 TO -3)

,

PRINT

PRINT " SECTION 34 .2.2.2:

PRINT

PRINT “ PRINT

LET C = 0 LET T=0

FOR I=-12 TO -5 STEP 3 LET C=C+1

LET T=T+I

NEXT I IF C<>3 THEN 1740

IF T= (-27) THEN 1760

PRINT " THE 3 LOOPS

GOTO 1790

PRINT " THE 3 LOOPS

PRINT

PRINT " PRINT

PRINT " PRINT

PRINT " PRINT

LET C=0

LET T=0

FOR 1=1.5 TO 3 STEP 2

INCREMENTED BY -1, FAILED TEST

INCREMENTED BY -1, PASSED TEST

END TEST."

FOR INCREASING INITIAL VALUE."

BEGIN TEST."

INCREMENTED BY 3, FAILED TEST

INCREMENTED BY 3, PASSED TEST

END TEST."

(-12 TO -5)

,

(-12 TO -5)

,

SECTION 34.2.3: FRACTION CONTAINED BY THE INITIAL VALUE.

BEGIN TEST."

LET C=C+1

LET T=T+I

NEXT I IF COl THEN 1920

IF T=1 . 5 THEN 1940

PRINT " GOTO 1970

THE 1 LOOP (1.5 TO 3)

PRINT " THE 1 LOOP (1.5 TO 3)

PRINT

PRINT " PRINT

PRINT " SECTION 34.3:

PRINT

PRINT "

INCREMENTED BY 2, FAILED TEST."

INCREMENTED BY 2, PASSED TEST."

END TEST.

NESTING FOR-BLOCKS, THREE DEEP.

BEGIN TEST."

8
2010 PRINT

2020 LET C = 0 2030 LET T=0

2040 FOR 11=1 TO 2 2050 FOR 12=3 TO 1 STEP -1

2060 FOR 13=1 TO 3 STEP 1 2120 LET C=C+1

2130 LET T=T+I 3 2190 NEXT 13

2200 NEXT 12

2210 NEXT II

2220 IF COl 8 THEN 2240

2230 IF T=36 THEN 2260

2240 PRINT " 3 NESTED LOOPS, FAILED TEST.

2250 GOTO 2290

2260 PRINT " 3 NESTED LOOPS, PASSED TEST.

2270 PRINT

2280 PRINT " END TEST."

2290 PRINT

2300 PRINT

2310 END

*****************

* SAMPLE OUTPUT * *****************

PROGRAM FILE 34

SECTION 34.1: FOR/NEXT, WITHOUT STEP CLAUSE.

SECTION 34.1.1: INITIAL VALUE AND LIMIT ARE INTEGERS.

SECTION 34.1.1.1: DIFFERENT VALUES, LOW TO HIGH.

BEGIN TEST.

THE 6 LOOPS (-2 TO 3), PASSED TEST.

END TEST.

SECTION 34.1.1.2: EQUAL VALUES.

BEGIN TEST.

THE 1 LOOP (3 TO 3) , PASSED TEST.

END TEST.

9
SECTION 34.1.2: FRACTION CONTAINED IN THE LIMIT.

THE 2 LOOPS (4 TO 5.9), PASSED TEST.

END TEST.

SECTION 34.2: FOR/NEXT, USING STEP CLAUSE.

SECTION 34.2.1: USING FRACTIONAL INCREMENTS.

SECTION 34.2.1.1: FOR INCREASING INITIAL VALUE.

BEGIN TEST.

THE 9 LOOPS (0 TO 4), INCREMENTED BY .5, PASSED TEST.

END TEST.

SECTION 34.2.1.2: FOR DECREASING INITIAL VALUE.

BEGIN TEST.

THE 1 LOOP (2 TO 2), INCREMENTED BY -.5, PASSED TEST.

END TEST.

SECTION 34.2.2: USING INTEGER INCREMENTS.

SECTION 34.2.2.1: FOR DECREASING INITIAL VALUE.

SECTION 34.2.2.1.1: POSITIVE TO POSITIVE.

BEGIN TEST.

THE 2 LOOPS (4 TO 1), INCREMENTED BY -2, PASSED TEST.

END TEST.

SECTION 34.2.2.1.2: POSITIVE TO NEGATIVE.

BEGIN TEST.

THE 5 LOOPS (8 TO -8), INCREMENTED BY -4, PASSED TEST.

END TEST.

SECTION 34.2.2.1.3: NEGATIVE TO NEGATIVE.

BEGIN TEST.

THE 3 LOOPS (-1 TO -3), INCREMENTED BY -1, PASSED TEST.

END TEST.

SECTION 34.2.2.2: FOR INCREASING INITIAL VALUE.

BEGIN TEST.

10
THE 3 LOOPS (-12 TO -5), INCREMENTED BY 3, PASSED TEST.

END TEST.

SECTION 34.2.3: FRACTION CONTAINED BY THE INITIAL VALUE.

BEGIN TEST.

THE 1 LOOP (1.5 TO 3), INCREMENTED BY 2, PASSED TEST.

END TEST.

SECTION 34.3: NESTING FOR-BLOCKS, THREE DEEP.

BEGIN TEST.

3 NESTED LOOPS, PASSED TEST.

END TEST.

11
35.0

EXITING FROM FOR-BLOCKS

35.1

FOR-Block Exiting Via Control Statement

This routine tests exiting from a FOR-block via a control statement. In

this routine the control statement is the IF-THEN-statement . Since the first

FOR-block for this test does not exit naturally (via its NEXT-statement),

there should be only 11 loops performed and a T variable sum of 30. The

output is similar to test 34.1.1.1.

35.2

Compatability Between Initial-Value, Limit, and STEP Clause

This routine tests t)^e compatibility between the initial value, the

limit and the increment. There are two cases which determine this

compatibility: (1) if the initial value is smaller than the limit, then the

increment's value must be positive; and (2) if the initial value is larger

than the limit, then the increment's value must be negative. If either case

is violated, no looping in the FOR-block should be performed. In this test

the initial value, the limit, and the increment are not compatible, therefore

the number of loops should be zero. The output is similar to test 34.1.1.1.

35.3

Normal Exit Via NEXT-Statement

The object here is to test the value of the control variable upon

exiting via the NEXT-statement. Its value should be the first value not

used. For output refer to test 34.1.1.1.

*******************

* PROGRAM FILE 35 * *******************

0010 PRINT "PROGRAM FILE 35"

0060 PRINT

0070 PRINT

0080 PRINT

0090 PRINT " SECTION 35.1: FOR-BLOCK EXITING VIA CONTROL STATEMENT."

0100 PRINT

0110 PRINT " BEGIN TEST."

0120 PRINT

0130 LET C=0

0140 LET T=0

0150 FOR 1=1 TO 10

0160 LET C=C+1

0170 LET T=T+I

0180 IF 1=5 THEN 200

0190 NEXT I 0200 IF 1=5 THEN 240

0210 PRINT " THE SYSTEM FAILED TO RETAIN THE INCREMENTED INITIAL"

12
0220

0230

0240

0250

0260

0270

0280

0290

0300

0310

0320

0330

0340

0350

0360

0370

0380

0390

0400

0410

0420

0430

0440

0450

0460

0470

0480

0490

0500

0510

0520

0530

0540

0550

0560

0570

0580

0590

0600

0610

0620

0630

0640

0650

0660

0670

0680

0690

0 7 0 0

THE 11 LOOPS (EXIT VIA IF/THEN), PASSED TEST.

END TEST.

PRINT "VALUE VIA A CONTROL STATEMENT."

GOTO 350

FOR J = 2 TO 4 FOR 1=2 TO 3 LET C=C+1

LET T=T+I

NEXT I NEXT J IF COll THEN 320

IF T=30 THEN 340

PRINT " THE 11 LOOPS (EXIT VIA IF/THEN), FAILED TEST."

GOTO 370

PRINT " PRINT

PRINT " PRINT

PRINT " SECTION 35.2 COMPATIBILITY/INITIAL VALUE, LIMIT AND STEP.'

PRINT

PRINT “ BEGIN TEST."

PRINT

LET C=0

FOR 1=4 TO 2 STEP 1 LET C=C+1

NEXT I IF C=0 THEN 490

PRINT " THE SKIPPING OF (4 TO 2), INCREMENTED BY 1, FAILED TEST."

GOTO 520

PRINT " THE SKIPPING OF (4 TO 2), INCREMENTED BY 1, PASSED TEST."

PRINT

PRINT " END TEST.

PRINT

PRINT " PRINT

PRINT " PRINT

LET C =0

FOR 1=1 TO 6 LET C=C + 1 NEXT I IF C<>6 THEN 630

IF 1=7 THEN 650

PRINT "CONTROL VALUE OF 7 (EXIT VIA NEXT-STATEMENT), FAILED TEST."

GOTO 680

PRINT "CONTROL VALUE OF 7 (EXIT VIA NEXT-STATEMENT), PASSED TEST."

PRINT

PRINT " END TEST."

PRINT

PRINT

END

SECTION 35.3: NORMAL EXIT VIA NEXT-STATEMENT.

BEGIN TEST."

******:*********

* SAMPLE OUTPUT *

13
PROGRAM FILE 35

SECTION 35.1: FOR-BLOCK EXITING VIA CONTROL STATEMENT.

BEGIN TEST.

THE 11 LOOPS (EXIT VIA IF/THEN), PASSED TEST.

END TEST.

SECTION 35.2 COMPATIBILITY/INITIAL VALUE, LIMIT AND STEP.

BEGIN TEST.

THE SKIPPING OF (4 TO 2), INCREMENTED BY 1, PASSED TEST.

END TEST.

SECTION 35.3: NORMAL EXIT VIA NEXT-STATEMENT.

BEGIN TEST.

CONTROL VALUE OF 7 (EXIT VIA NEXT-STATEMENT) , PASSED TEST.

END TEST.

\

l»t
36.0 SYNTAX DIAGNOSTIC - A FOR-STATEMENT WITHOUT A

MATCHING NEXT-STATEMENT

This routine and the next two perform tests on the FOR-NEXT statement

which should be diagnosed as errors. These are specifically constructed to

demonstrate the diagnostic capability of the language processor. Although no exceptions have been specified with regard to FOR-NEXT Statements the

situations tested here are considered significant and require a processor to

report the error

.

The objective of this test is to verify that the execution of a FOR-statement without a matching NEXT-statement will be recognized as a syntactic error. This error must be recognized and reported. It should

result in the execution of the program being suspended. There should be some form of implementation-defined diagnostic on output.

*******************

* PROGRAM FILE 36 * *******************

0010

0100

. 0110

0120

0130

0140

0150

0160

0170

0160

0190

0200

0210

0220

0250

0260

0270

0280

0290

0 300

0310

0320

0330

0340

0350

0360

0 370

0380

0390

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

LET N FOR I LET N

"PROGRAM FILE 36'

SECTION 36.0"

A FOR-STATEMENT WITHOUT A MATCHING NEXT-STATEMENT."

" THE OBJECTIVE OF THIS SECTION IS TO USE A FOR-STATE-

"MENT WITHOUT ANY OCCURRING OR MATCHING NEXT-STATEMENT IN"

"THE SEQUENTIALLY FOLLOWING PROGRAM LINES. IF THE SYSTEM"

"RECOGNIZES THIS AS A SYNTAX ERROR THE TEST PASSED"

BEGIN TEST."

= 0 =1 TO 100

= N + 1 PRINT N

; " LOOPS WERE MADE, THEREFORE TEST FAILS SINCE THE EXCLUSION

PRINT "OF A MATCHING NEXT-STATEMENT WAS NOT RECOGNIZED BY THE SYSPRINT "TEM."

PRINT

PRINT " END TEST.

PRINT

END

15
*****************

* SAMPLE OUTPUT * *****************

For

In order for this test to pass, an error example, a possible error diagnostic for

must be diagnosed

this program might

and

be

:

reported

.

? FOR WITHOUT NEXT IN LINE 310

16
37.(1 SYNTAX DIAGNOSTIC - A NEXT-STATEMENT WITHOUT A

MATCHING FOR-STATEMENT

The objective of this test is to verify that upon the

program, which contains a NEXT-statement but no matching

implementation will report a diagnosed error. The test

constructed without a matching FOR-statement for the

statement 260 of Program File 37. On output, there

implementation-specific diagnostic, but it should point to

NEXT-statement has no associated FOR-statement.

execution of a FOR-statement, the

is specifically

NEXT-statement in

should be an the fact that the

*******************

* PROGRAM FILE 37 * *******************

0 0 10 PRINT

0 0 60 PRINT

0 0 70 PRINT

0 080 PRINT

0 090 PRINT

0 1 00 PRINT

0 1 10 PRINT

0 1 20 PRINT

0 1 30 PRINT

0 1 40 PRINT

0 1 50 PRINT

0 1 60 PRINT

0 1 70 PRINT

0 1 80 PRINT

0 2 10 PRINT

0 2 20 PRINT

0 2 30 PRINT

0 240 PRINT

0 250 PRINT

0 260 NEXT

0 2 70 PRINT

0 280 PRINT

0 290 PRINT

0 300 PRINT

0 3 10 PRINT

0 3 20 END

"PROGRAM FILE 3 1

SECTION 37.0"

A NEXT-STATEMENT WITHOUT A MATCHING FOR-STATEMENT."

" THE OBJECTIVE OF THIS SECTION IS TO USE A NEXT-STATE-"

"MENT WITHOUT ANY OCCURRING OR MATCHING FOR-STATEMENT IN THE"

"SEQUENTIALLY FOLLOWING PROGRAM LINES. IF THE SYSTEM RECOG-"

"NIZE3 THIS AS A SYNTAX ERROR THE TEST PASSED"

BEGIN TEST."

" TEST FAILS, THE SYSTEM DID NOT RECOGNIZE THE EXCLUSION"

"OF A MATCHING FOR-STATEMENT."

END TEST.

*****************

* SAMPLE OUTPUT *

17
*****************

A fatal

diagnostic i error diagnostic is required as output,

implementation specific, but a possible

Again, the exact

message might be

? NEXT WITHOUT FOR IN LINE 260

18
38.0 SEMANTIC ERROR - THE INTERLEAVING OF TWO FOR-BLOCKS

The objective of this test is to verify that upon the execution of a program which contains two FOR-blocks that are i nter 1 eaved--i . e . , a NEXT-statement is matched with a FOR-statement with a different control

variable — the implementation will diagnose and report an error. The test

contains two FOR-blocks that are interleaved by associating FOR-statements at

lines 270 and 280 with NEXT-statements at lines 300 and 310 respectively in

Program File 38. On output, there should be an implementation-specific

diagnostic.

*******************

* PROGRAM FILE 38 * *******************

0010

0060

0070

0080

0090

0100

0110

0120

0130

0140

0150

0160

0170

0180

0210

0220

0230

0240

0250

0260

0270

0280

0290

0300

0310

0320

0330

0340

0350

0360

0370

0380

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

LET N = FOR 1 = FOR J = LET N = NEXT I NEXT J PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

END

"PROGRAM FILE 38"

SECTION 38.0"

THE INTERLEAVING OF TWO FOR-BLOCKS."

" THE OBJECTIVE OF THIS SECTION IS TO MATCH A NEXT-STATE-"

"MENT WITH A FOR-STATEMENT WHICH HAS A DIFFERENT CONTROL"

"VARIABLE. IF THE SYSTEM RECOGNIZES THIS AS A SEMANTIC ERROR"

"THE TEST PASSED"

BEGIN TEST."

0

1 TO 50

1 TO 100

N + l

SYSTEM FAILED TO RECOGNIZE FOR-NEXT STATEMENTS BEING'

INTERLEAVED, THEREFORE, SYSTEM FAILED TEST."

END TEST."

19
******** * ********

* SAMPLE OUTPUT * *****************

Again, as in the past two error tests, the system fails if there is no diagnostic given. The following two diagnostic messages are

not necessarily ideal, but as a combination do indicate the problem

source

:

7NEXT WITHOUT FOR IN LINE 300

?FOR WITHOUT NEXT IN LINE 270

The point of these messages is that the system is not looking for an associated FOR-statement in a higher level block or for a NEXT-statement

in a lower level block.

20
39.0

INTRODUCING THE DIMENSION STATEMENT

The tests in the next several sections are for the dimension-statement

which reserves space for arrays, that can be either one or two dimensional.

If a dimension-statement is not used to allocate storage, then a default

space allocation is made. In section 39.1 this default will be tested. The

default means that unless declared otherwise in a dimension-statement, all

array subscripts have a lower bound of zero and a upper bound of ten.

Therefore, under default there should be space reserved for 11 elements in

one-dimensional arrays and 121 elements in two-dimensional arrays. But, by use of a dimension-statement, the subscript(s) of an array may be declared to

have an upper bound other than ten, and by use of the OPTION-statement , the

subscripts of all arrays may be declared to have a lower bound of either one

or zero. The reader is referred to section 15 on array declaration in BSR

X3.60 for the specification.

39.1

Implicit Dimensioning

The object here is to verify that implementations recognize default

space allocations for arrays.

39.1.1

One-Dimensional Arrays

The object is to test the default space allocation for one-dimensional

arrays. In this case, space should be reserved for 11 elements. In the

first part of the test, the subscripted variables A(0), A(l), A(2), ...,

A ( 1 0 ) of the implicit dimensional array A(I) are assigned the values 0, 1, 2, ..., 10 respectively. In the second part, there is a check made on the

assignment of the eleven elements to the array A ( I ) . This is done by the use

of a counter, C, and the total sum, Al, of the eleven elements. There should

be a count of eleven array elements and the sum of the elements should be 55.

On output there should be a message to the following effect, if the test

failed: IMPLICIT SINGLE DIMENSIONING TEST, FAILED. If the test passed, then

the following message should be printed: IMPLICIT SINGLE DIMENSIONING TEST,

PASSED. Another failure of the test could occur if a system diagnostic

indicated that an array element could not be accessed. If in fact tne system

indicates failure to dimension an array, then the system entirely fails

implicit single dimensioning.

39.1.2

Two-Dimensional Arrays

The object is to test the default space allocation for two-dimensional

arrays. Space should be reserved for 121 elements. In the first part of

this test the subscripted variables B(0,0), B(0,1), B(0,2), ..., B(10,10) of

the implicit dimensioned array B(I,J) are assigned the sum I + J . In the

second part of the test, a check is made on whether space was reserved for

the 121 elements of array B(I,J). This is accomplished through the use of a counter, C. The counter keeps track of the number of loops performed by a FOR-block, while the sum of all elements stored in array B(I,J) is computed.

The final count for this test should be 121 and the sum of the elements

should be 1210.

On output, there should be one of two messages

fails, then the following message should be pr

DIMENSIONING TEST, FAILED. If the test passes then

should be printed: IMPLICIT DOUBLE DIMENSIONING TEST

printed. If the test

inted: IMPLICIT DOUBLE

the following message

, PASSED.

21
39.2 The Dimension-Statement Without the OPTION-Statement

The object of this test is to verify that the implementation recognizes

array declarations by the dimension-statement for both one- and

two-dimensional arrays.

39.2.1 Used With One-Dimensional Arrays

The object of this test is to verify that, by use of the

dimension-statement, an array can be declared to have an upper bound greater

than 10. It would still retain its lower bound of zero. In the first part

of the test, the subscripted variables D(0), D(l), D(2), ..., D(20) of array

D ( I ) are assigned the values of 1, 2, 3, ..., 21, respectively. In the

second part of this test, the array allocation of 21 elements for D ( I ) is

accessed in order to verify the previous assignment. This is accomplished by use of a loop counter, C and a total sum variable, Dl. The number of loop

counts for this test should be 21, and the sum of the array elements should

be 231.

If the test fails, then the following message should be printed: USE OF

DIM FOR SINGLE DIMENSIONING, FAILED TEST. If the test passes, then the

following message should be printed: USE OF DIM FOR SINGLE DIMENSIONING,

PASSED TEST.

39.2.2 Used With Two-Dimensional Arrays

The object of this test is to verify that, by use of the

dimension-statement, two-dimensional arrays can be declared to have upper

bounds greater than 10 for each dimension. This is accomplished in three

steps. In step one, the first subscript upper bound dimensioned greater than

10 for array N(I,J) while the second subscript remains less than 10. The

subscripted variable N ( 1 , 1 ) is assigned the value 1 + 1. The subscripted

variables N(0,2), N(l,2), N(2,2), ...» N (20, 2 ) are each assigned the negative

value of the first integer of their respective pair of subscripted integers.

Finally N(I,0) is assigned the value 1. As a check on the space allocation

for each element of array N(20,2), all members of the array are added and the

value should be 42. In the second step, an array P(2,20) is dimensioned.

The first subscript of the array P(I,J) remains less than 10 while the second

subscript is allowed to be greater than 10. The subscripted variables

P(1,0), P(l,l), P ( 1 , 2 ) , ..., P(2,20) are each assigned a value equal to the

product of the subscripts. As a verification of the space allocation, all

members of the array P(2,20) are added to each other and their sum should be

630. In the third dimensioning, both the first and second subscripts of the

array R(I,J) are simultaneously allowed to have upper bounds greater than 10.

For this part of the test, each array element R ( I , J ) is assigned the sum I + J

.

The total sum of all the array elements R(I,J) should be 8820.

If the test

DIM FOR DOUBLE

message should

A******************

On output, there should be one of two possible messages,

fails then the following message should be printed:

DIMENSIONING, FAILED TEST. If the test passes the following

be printed: DIM FOR DOUBLE DIMENSIONING, PASSED TEST.

22
* PROGRAM FILE 39 * *******************

0010

0020

0030

0040

0070

0080

0090

0100

0110

0120

0130

0140

0150

0160

0170

0180

0185

0190

0200

0210

0220

0230

0240

0250

0260

0270

0280

0290

0300

0310

0320

0330

0340

0350

0355

0360

0 370

0380

0390

0400

0410

0420

0425

0430

0440

0450

0460

0470

0480

0490

PRINT "PROGRAM FILE 39"

PRINT

PRINT

PRINT

PRINT " SECTION 39.1: IMPLICIT DIMENSIONING.

PRINT

PRINT " SECTION 39.1.1: ONE-DIMENSIONAL ARRAYS

PRINT

PRINT " BEGIN TEST."

PRINT

FOR 1=0 TO 10

LET A ( I ) =1

NEXT I LET A 1 = 0 LET C=0

FOR 1=10 TO 0 STEP -1

LET Y=A ( I

)

LET Al=Al+Y

LET C=C+1

NEXT I IF COll THEN 240

IF Al=55 THEN 260

PRINT " GOTO 280

PRINT " PRINT

PRINT ” PRINT

PRINT " PRINT

PRINT " PRINT

FOR 1=0 TO 10

FOR J = 0 TO 10

LET Z=I+J

LET B (I , J ) =Z

NEXT J NEXT I LET B 1 =0

LET C =0

FOR 1=10 TO 0 STEP -1

FOR J = 1 0 TO 0 STEP -1

LET W=B ( I , J

)

LET Bl=Bl+W

LET C=C+1

NEXT J NEXT I IF C 0 1 2 1 THEN 490

IF B 1 =1 2 1 0 THEN 510

PRINT "

IMPLICIT SINGLE DIMENSIONING TEST, FAILED.

IMPLICIT SINGLE DIMENSIONING TEST, PASSED.

END TEST."

SECTION 39.1.2: TWO-DIMENSIONAL ARRAYS.

BEGIN TEST."

IMPLICIT DOUBLE DIMENSIONING TEST, FAILED
0500

0510

0520

0530

0540

0550

0560

0570

0580

0590

0600

0610

0620

0625

0630

0640

0650

0660

0670

0675

0680

0690

0700

0710

0720

GOTO 530

PRINT " IMPLICIT DOUBLE DIMENSIONING TEST, PASSED."

PRINT

PRINT " END TEST.”

PRINT

PRINT "SECTION 39.2: THE DIM-STATEMENT WITHOUT OPTION-STATEMENT."

PRINT

PRINT " SECTION 39.2.1: USED WITH ONE-DIMENSIONAL ARRAYS."

PRINT

PRINT " BEGIN TEST."

PRINT

DIM D ( 2 0

)

FOR 1=0 TO 20

LET H=I +1

LET D ( I

) =H

NEXT I LET Dl =0

LET C=0

FOR 1=0 TO 20

LET M=D (I

)

LET Dl=Dl+M

LET C=C+1

NEXT I IF C<>21 THEN 730

IF Dl=231 THEN 750

0730

0"»40

0750

0760

0770

0780

0790

0800

0810

0820

0830

0840

0850

0855

0860

0870

0880

0890

0895

0900

0910

0920

0930

0940

0945

0950

0960

0970

0980

0990

1000

1010

PRINT " GOTO 770

PRINT " PRINT

PRINT " PRINT

PRINT

PRINT " PRINT

PRINT " PRINT

DIM N (20, 2) ,P (2, 20) ,R(20, 20)

FOR 1=0 TO 20

LET 11=1+1

LET N (1 , 1) =11

LET N (I , 2) =-I

LET N (I , 0) =1

FOR J=2 TO 0 STEP -1

LET J1=I*J

LET P(J,I)=J1

NEXT J NEXT I FOR K=0 TO 20

FOR L=0 TO 20

USE OF DIM FOR SINGLE DIMENSIONING, FAILED TEST."

USE OF DIM FOR SINGLE DIMENSIONING, PASSED TEST."

END TEST."

SECTION 39.2.2: USED WITH TWO-DIMENSIONAL ARRAYS."

BEGIN TEST."

LET K1=K+L

LET R ( K , L) =K

1

NEXT L

NEXT K LET N 1=0

LET Pl=0

LET Rl=0

LET C=0

2b
1020 LET T=0

1030 FOR 1=0 TO 20

1040 FOR J=0 TO 2 1045 LET F 1=N (I , J)

1050 LET N 1=N 1+Fl

1055 LET G1=P (J,I)

1060 LET P1=P1+G1

1070 LET C=C+1

1080 NEXT J

1090 NEXT I 1100 IF C<>63 THEN 1210

1110 IF Nl<>42 THEN 1210

1120 IF P1O630 THEN 1210

1130 FOR K=20 TO 0 STEP -1

1140 FOR L=0 TO 20

1145 LET Q1=R (K , L

)

1150 LET Rl=Rl +Q1

1160 LET T=T+1

1170 NEXT L

1180 NEXT K 1190 IF T<>441 THEN 1210

1200 IF Rl=8820 THEN 1230

1210 PRINT " 1220 GOTO 1260

1230 PRINT " 1240 PRINT

1250 PRINT " 1260 PRINT

1270 PRINT

1280 END

DIM FOR DOUBLE

DIM FOR DOUBLE

DIMENSIONING,

DIMENSIONING,

END TEST."

FAILED TEST."

PASSED TEST."

*****************

* SAMPLE OUTPUT * *****************

PROGRAM FILE 39

SECTION 39.1: IMPLICIT DIMENSIONING.

SECTION 39.1.1: ONE-DIMENSIONAL ARRAYS.

BEGIN TEST.

IMPLICIT SINGLE DIMENSIONING TEST, PASSED.

END TEST.

25
SECTION 39.1.2: TWO-DIMENSIONAL ARRAYS

BEGIN TEST.

IMPLICIT DOUBLE DIMENSIONING TEST, PASSED.

END TEST.

SECTION 39.2: THE DIM-STATEMENT WITHOUT AN OPT I ON -STATEMENT.

SECTION 39.2.1: USED WITH ONE-DIMENSIONAL ARRAYS.

BEGIN TEST.

USE OF DIM FOR SINGLE DIMENSIONING, PASSED TEST.

END TEST.

SECTION 39.2.2: USED WITH TWO-DIMENSIONAL ARRAYS.

BEGIN TEST.

DIM FOR DOUBLE DIMENSIONING, PASSED TEST.

END TEST.

26
40.0 EXTENDING IF-THEN CAPABILITIES BY USING ONE-DIMENSIONAL

ARRAYS IN THE COMPARISON

Since subscripted variables have already been introduced in previous

tests, they are now added to the list of possible numeric expressions that can be compared in an IF-THEN-statement . The objectve of the next two test

programs is to extend the IF-THEN-statement capability by using subscripted

var iables

.

This section will concentrate on testing relation operations between

single dimensioned arrays, simple variables and constants. The first

comparisons made are between elements of the same array. Next, an array

element is compared with a variable on the left of the relational operator

and then the test is reversed. Finally, an element of the array is compared

against a constant. There is a two column output of which the first heading

is "Comparisons", and the second heading is "Results of IF-THEN Comparisons".

The first column of output lists the numerical values that are being

compared for each of the relations. The next six columns form a table

containing the six relation symbols =, <, >, <>, >=, and <=. This table

should appear blank (or empty), unless an error was made in a relation

comparison, in which case an asterisk should appear in the column of the

relational symbol for which the comparison was not evaluated properly. For

example, if two numbers are equal, then a < comparison should be correctly

evaluated as false and the correct transfer made. Otherwise, an asterisk

would appear in the table under the < column.

*******************

* PROGRAM FILE 40 * *******************

0010 PRINT

0060 PRINT

0070 PRINT

0080 PRINT

0090 PRINT

0100 PRINT

0110 PRINT

0120 PRINT

0130 PRINT

0140 PRINT

0150 PRINT

0160 PRINT

0170 PRINT

0180 PRINT

0190 PRINT

0200 PRINT

0210 PRINT

"PROGRAM FILE 40"

SECTION 40.0"

IF-THEN"

* * *US ING NUMERICAL CONSTANTS, ASSIGNED SIMPLE VARIABLES"

AND"

ASSIGNED SUBSCRIPTED VARIABLES, TOGETHER.***"

BEGIN TEST."

27
0220 PRINT " ALL INVALID IF-THEN EVALUATIONS WILL BE DESIGNATED BY"

0230 PRINT "AN ASTERISK IN THE COLUMNS OF THOSE RELATIONAL SYMBOLS FOR"

0240 PRINT "WHICH ERROR (S) OCCURRED FOR THAT COMPARATIVE ROW."

0250 PRINT

0260 PRINT TAB (43) ; "RESULTS"

0270 PRINT TAB (45); "OF"

0280 PRINT TAB (10) ; "COMPARISONS" ;TAB (39) ; "IF-THEN EVALUATIONS"

0290 PRINT

0300 LET A $ = " = " 0310 LET B $ = " <

0320 LET C$=">"

0330 LET D $ = " < >

0340 LET E$=">="

0350 LET F$=" <="

0360 PRINT TAB (34) ;A$;TAB (39) ;B$;TAB (44) ;C$;TAB (49) ;D$;TAB (55) ;E$;

0370 PRINT TAB (61) ;F$

0380 PRINT

0390 DIM A ( 5

)

0400 LET Al=l

0410 LET A ( 1

) =2

0420 LET A ( 2

) =3

0430 LET A ( 3

) =— 2 0440 LET A2=-3

0450 LET A ( 4

) =3

0460 LET A ( 5

) =0

0470 LET F=0

0475 REM COMPARING AN ARRAY ELEMENT WITH ANOTHER ELEMENT

0477 REM OF THE SAME ARRAY

0480 IF A ( 2

) =A ( 4 ) THEN 610

0490 LET A $ = " *

0500 LET F=1

0510 GOTO 620

0520 LET B $ = " *

0530 LET F=1

0540 GOTO 690

0550 LET C$="*"

0560 LET F=1

0570 GOTO 710

0580 LET D$= " *

0590 LET F=1

0600 GOTO 790

0610 LET A$=" " 0620 IF A ( 2 ) <=A ( 4 ) THEN 740

0630 LET F $ = " *

0640 LET F=1

0650 GOTO 750

0660 LET E $ = " " 0670 IF A ( 2 ) <A ( 4 ) THEN 520

0680 LET B $ = " " 0690 IF A ( 2 ) >A ( 4 ) THEN 550

0700 LET C$=" " 0710 IF A ( 2 ) <>A ( 4 ) THEN 580

0720 LET D$=" " 0730 GOTO 790

0740 LET F§=" " 0750 IF A { 2 ) > =A ( 4

)

THEN 660

0760 LET E $ = " *

28
0770 LET F = 1 0780 GOTO 670

0790 PRINT TAB (12) ; " 3 TO 3

" ; TAB ( 3 4 ) ; A $ ; TAB ( 39 ) ; B $ ; TAB ( 4 4 ) ; C $ ; TAB ( 4 9 ) ; D$

0800 PRINT TAB (55) ;E$;TAB (61) ;F$

0805 REM COMPARING AN ARRAY ELEMENT WITH A SIMPLE VARIABLE

0807 REM ON THE LEFT

0810 IF A1<A(1) THEN 940

0820 LET B $ = " *

0830 LET F=1

0840 GOTO 950

0850 LET a $ = " *

0860 LET F=1

0870 GOTO 1020

0880 LET C$="* n 0890 LET F=1

0900 GOTO 1040

0910 LET E $ = " *

0920 LET F=1

0930 GOTO 1120

0940 LET B $ = " ” 0950 IF AlOA(l) THEN 1070

0960 LET D$=" *

0970 LET F=1

0980 GOTO 1080

0990 LET F $ = " " 1000 IF Al=A ( 1 ) THEN 850

1010 LET A$=" " 1020 IF Al >A ( 1 ) THEN 880

1030 LET C$=" " 1040 IF Al >=A ( 1 ) THEN 910

1050 LET E$ = " " 1060 GOTO 1120

1070 LET D$= " " 1080 IF f 1<=A ( 1 ) THEN 990

1090 LET F$="*“

1100 LET F=1

1110 GOTO 1000

1120 PRINT TAB (12) ; " 1 TO 2" ; TAB ( 3 4 )

; A $ ;TAB ( 3 9 ) ; B $ ; TAB ( 4 4 )

; C $ ; TAB ( 4 9 ) ; D$

1130 PRINT TAB (55) ; E $ ; TAB (61) ; F

$

1135 REM COMPARING AN ARRAY ELEMENT WITH A SIMPLE VARIABLE

1137 REM ON THE RIGHT

1140 IF A ( 2 ) >A2 THEN 1270

1150 LET C$="*"

1160 LET F=1

1170 GOTO 1280

1180 LET A $ = " *

1190 LET F=1

1200 GOTO 1350

1210 LET B$= H *" 1220 LET F=1

1230 GOTO 1370

1240 LET F$=" *" 1250 LET F=1

1260 GOTO 1450

1270 LET C$= M " 1280 IF A ( 2 ) >=A2 THEN 1400

1290 LET E $ = " *

/ 29
1300 LET F=1

1310 GOTO 1410

1320 LET D$=" " 1330 IF A ( 2

) =A2 THEN 1180

1340 LET A$=" " 1350 IF A ( 2 ) <A2 THEN 1210

1360 LET B $ = " " 1370 IF A ( 2 ) <=A2 THEN 1240

1380 LET F$=" n 1390 GOTO 1450

1400 LET E $ = " " 1410 IF A ( 2 ) OA2 THEN 1320

1420 LET D $ = " *

1430 LET F=1

1440 GOTO 1330

1450 PRINT TAB (12) ; "3 TO -3 " ; TAB ( 34 ) ; A $ ; TAB ( 3 9 ) ; B $ ; TAB ( 4 4 ) ;C $ ; TAB ( 4 9 )

;

1460 PRINT D$;TAB (55) ;E$;TAB (61) ;F$

1465 REM COMPARING AN ARRAY ELEMENT WITH A CONSTANT ON THE LEFT

1470 IF 2>=A ( 5 ) THEN 1600

1480 LET E $ = " *

1490 LET F=1

1500 GOTO 1610

1510 LET A $ = " *

1520 LET F=1

1530 GOTO 1680

1540 LET B $ = " *

1550 LET F=1

1560 GOTO 1700

1570 LET F $ = " *

1580 LET F=1

1590 GOTO 1780

1600 LET E$=" " 1610 IF 2>A ( 5 ) THEN 1730

1620 LET C$="*"

1630 LET F=1

1640 GOTO 1740

1650 LET D$=" " 1660 IF 2=A ( 5 ) THEN 1510

1670 LET A$=" " 1680 IF 2<A ( 5 ) THEN 1540

1690 LET B$=" " 1700 IF 2<=A ( 5 ) THEN 1570

1710 LET F$=" " 1720 GOTO 1780

1730 LET C$=" " 1740 IF 2<>A ( 5 ) THEN 1650

1750 LET D $ = " *

1760 LET F=1

1770 GOTO 1660

1780 PRINT TAB (12) ; "2 TO 0

" ; TAB (34) ; A $ ; TAB (39) ; B $ ; TAB (44) ; C $ ; TAB (49) ; D$

1790 PRINT TAB (55) ;E$;TAB (61) ;F$

1795 REM COMPARING AN ARRAY ELEMENT WITH A CONSTANT ON THE RIGHT

1800 IF A ( 5

) =0 THEN 1930

1810 LET A $ = " * H 1820 LET F=1

1830 GOTO 1940

1840 LET B $ = " *

30
1850 LET F=1

1860 GOTO 2010

1870 LET C$="* M 1880 LET F=1

1890 GOTO 2030

1900 LET D $ = " *

1910 LET F=1

1920 GOTO 2110

1930 GOTO 2110

1940 IF A ( 5 ) >=0 THEN 2060

1950 LET E$=" *

1960 LET F=1

1970 GOTO 2070

1980 LET F $ = " " 1990 IF A ( 5 ) > 0 THEN 1840

2000 LET B $ = " " 2010 IF A (5) <0 THEN 1870

2020 LET C$=" " 2030 IF A ( 5 ) <>0 THEN 1900

2040 LET D$=" " 2050 GOTO 2110

2060 LET E $ = " " 2070 IF A ( 5 ) <=0 THEN 1980

2080 LET F$=" *

2090 LET F=1

2100 GOTO 1990

2110 PRINT TAB (12) ; " 0 TO 0

" ; TAB ( 3 4 ) ; A $ ; TAB ( 3 9 ) ; B $ ;TAB ( 4 4 ) ;C $ ; TAB ( 4 9 ) ; D$

2120 PRINT TAB (55) ;E$;TAB (61) ;F$

2130 PRINT

2140 IF FOB THEN 2190

2150 PRINT TAB (31); "NO ASTERISKS"

2160 PRINT TAB (32) ; "THEREFORE"

2170 PRINT TAB (31)

;

"TEST PASSED."

2180 GOTO 2220

2190 PRINT TAB (30)

;

"SOME ASTERISKS"

2200 PRINT TAB (32) ; "THEREFORE"

2210 PRINT TAB(31) ; "TEST FAILED."

2220 PRINT

2230 PRINT " END TEST."

2240 PRINT

2250 PRINT

2260 END

*****************

* SAMPLE OUTPUT * *****************

PROGRAM FILE 40

31
SECTION 40.0

IF-THEN

***USING NUMERICAL CONSTANTS, ASSIGNED SIMPLE VARIABLES

AND

ASSIGNED SUBSCRIPTED VARIABLES, TOGETHER. * * *

BEGIN TEST.

ALL INVALID IF-THEN EVALUATIONS WILL BE DESIGNATED BY

AN ASTERISK IN THE COLUMNS OF THOSE RELATIONAL SYMBOLS FOR

WHICH ERROR (S) OCCURRED FOR THAT COMPARATIVE ROW.

RESULTS

OF

COMPARISONS =<><>>=< IF-THEN EVALUATIONS

3 TO 3

1 TO 2

3 TO -3

2 TO 0

0 TO 0 NO ASTERISKS

THEREFORE

TEST PASSED.

END TEST.

32
41.0 EXTENDING IF-THEN CAPABILITIES BY USING

TWO-DIMENSIONAL ARRAYS IN THE COMPARISON

The program below is nearly parallel in structure to that in section

40.0. The output format is also much the same. This test program, however,

exercises the use of a two dimensioned array in the comparison expression.

It begins by comparing a two-dimensional array element with itself, then with

a constant, thirdly with array elements from another doubly dimensioned

array, fourthly with simple variables, and finally with array elements from a singly dimensioned array.

*******************

* PROGRAM FILE 41 * *******************

0010

0050

0060

0070

0080

0090

0100

0110

0120

0130

0140

0150

0160

0170

0180

0190

0200

0210

0220

0230

0240

0250

0260

0270

0280

0290

0300

0310

0320

0330

0340

0350

0360

PRINT "PROGRAM FILE 41"

PRINT " SECTION 41.0"

PRINT

PRINT " IF-THEN"

PRINT

PRINT

PRINT " ***USING NUMERICAL CONSTANTS, ASSIGNED SIMPLE VARIABLES"

PRINT " AND"

PRINT " ASSIGNED SUBSCRIPTED VARIABLES, TOGETHER.***"

PRINT

PRINT

PRINT

PRINT " BEGIN TEST."

PRINT

PRINT " ALL INVALID IF-THEN EVALUATIONS WILL BE DESIGNATED BY"

PRINT "AN ASTERISK IN THE COLUMNS OF THOSE RELATIONAL SYMBOLS FOR"

PRINT "WHICH ERROR (S) OCCURRED FOR THAT COMPARATIVE ROW."

PRINT

PRINT

PRINT TAB (43) ; "RESULTS"

PRINT TAB (45) ; "OF"

PRINT TAB (10) ; "COMPARISONS" ,-TAB (39) ; "IF-THEN EVALUATIONS"

PRINT

LET A$="=

LET B$=" <

LET C$=">"

LET D $ = " < >

LET E$=">="

LET F $ = " < = " PRINT TAB (34) ;A$;TAB(39) ;B$;TAB(44) ;C$;TAB(49) ;D$;TAB(55) ;E$;

PRINT TAB (61) ;F$

PRINT

DIM B (5, 5) , C (5, 5)

33
0370 LET Al = 2 0380 LET B (1, 1)=-1

0390 LET B (2, 2) =-2

0400 LET B (3,3) =-3

0410 LET B ( 4 , 4

) =-2

0415 LET C (4 , 4) =-2

0420 LET A2=3

0430 LET B (5, 5) =0

0440 LET F=0

0445 REM COMPARING TWO-DIMENSIONAL ARRAY ELEMENT WITH ANOTHER

0447 REM ELEMENT OF THE SAME ARRAY

0450 IF B (2, 2) =B (4 , 4) THEN 580

0460 LET A $ = " * M 0470 LET F=1

0480 GOTO 590

0490 LET B $ = " *

0500 LET F=1

0510 GOTO 660

0520 LET C$="*"

0530 LET F=1

0540 GOTO 680

0550 LET 0$="*"

0560 LET F = 1 0570 GOTO 760

0580 LET A$=" " 0590 IF B (2, 2) >=B (4 , 4) THEN 710

0600 LET E$=" *

0610 LET F=1

0620 GOTO 720

0630 LET F$=" " 0640 IF B (2, 2) <B (4 , 4) THEN 490

0650 LET B $ = " " 0660 IF B (2, 2) >B (4 , 4) THEN 520

0670 LET C$=" " 0680 IF B (2, 2) OB (4 , 4) THEN 550

0690 LET D$= " " 0700 GOTO 760

0710 LET E$=" " 0720 IF B (2, 2) <=B (4 , 4) THEN 630

0730 LET F$= M * M 0740 LET F=1

0750 GOTO 640

0760 PRINT TAB (10) ; " -2 TO -2 “ ; TAB ( 3 4 ) ; A $ ; TAB ( 3 9 ) ; B $ ; TAB ( 4 4 ) ; C $ ; TAB ( 4 9

)

0770 PRINT D$;TAB (55) ;E$;TAB (61) ;F$

0775 REM COMPARING A CONSTANT WITH A TWO-DIMENSIONAL ARRAY ELEMENT

0780 IF -3<B(1,1) THEN 910

0790 LET B$=" *

0800 LET F=1

0810 GOTO 920

0820 LET A$=" *

0830 LET F = 1 0840 GOTO 990

0850 LET C$="*"

0860 LET F=1

0870 GOTO 1010

0880 LET E $ = " *

0890 LET F=1

3l*
0900 GOTO 1090

0910 LET B $ = " " 0920 IF -3 < >B ( 1 , 1 ) THEN 1040

0930 LET D $ = " *

0940 LET F=1

0950 GOTO 1050

0960 LET F$=" " 0970 IF -3=B ( 1 , 1 ) THEN 820

0980 LET A$=" " 0990 IF -3>B ( 1 , 1 ) THEN 850

1000 LET C$=" " 1010 IF -3 >=B (1,1) THEN 880

1020 LET E$ = " " 1030 GOTO 1090

1040 LET D$=" " 1050 IF -3<=8 ( 1 , 1 ) THEN 960

1060 LET F$="* H 1070 LET F=1

1080 GOTO 970

1090 PRINT TAB (10) ; "-3 TO -1 " ; TAB ( 3 4 ) ; A $ ; TAB ( 3 9 ) ; B $ ; TAB ( 4 4 ) ; C $ ; TAB ( 4 9

)

1100 PRINT D$;TAB (55) ;E$;TAB (61) ;F$

1105 REM COMPARING A TWO-DIMENSIONAL ARRAY ELEMENT WITH AN ELEMENT

1107 REM OF ANOTHER TWO-DIMENSIONAL ARRAY

1110 IF B (5, 5) >B (4 , 4) THEN 1240

1120 LET C$="*"

1130 LET F=1

1140 GOTO 1250

1150 LET A$= " *

1160 LET F=1

1170 GOTO 1320

1180 LET B $ = " *

1190 LET F=1

1200 GOTO 1340

1210 LET F $ = " *

1220 LET F=1

1230 GOTO 1420

1240 LET C$=" " 1250 IF B (5, 5) <>C (4 , 4) THEN 1370

1260 LET D $ = " * " 1270 LET F=1

1280 GOTO 1380

1290 LET E$ = " " 1300 IF B(5,5)=C(4,4) THEN 1150

1310 LET A$=" " 1320 IF B (5, 5) <C (4 , 4) THEN 1180

1330 LET B$=" " 1340 IF B (5, 5) <=C (4 , 4) THEN 1210

1350 LET F$=" " 1360 GOTO 1420

1370 LET D$=" " 1380 IF B ( 5 , 5 ) >=C ( 4 r 4 ) THEN 1290

1390 LET E $ = " *

1400 LET F=1

1410 GOTO 1300

1420 PRINT TAB (11) ; " 0 TO -2 " ; TAB ( 3 4 ) ; A $ ; TAB ( 3 9 ) ; B $ ; TAB ( 4 4 ) ; C $ ;TAB ( 4 9 )

;

1430 PRINT D$;TAB (55) ;E$;TAB (61) ;F$

1435 REM COMPARING A SIMPLE VARIABLE WITH AN ELEMENTARY

35
1437 REM PARENTHESIZED EXPRESSION ENCLOSING AN ARRAY ELEMENT

1440 IF A2= (-B ( 3 , 3 ) ) THEN 1570

1450 LET A$=" *

1460 LET F=1

1470 GOTO 1580

1480 LET

1490 LET F=1

1500 GOTO 1650

1510 LET C$="*"

1520 LET F=1

1530 GOTO 1670

1540 LET D$ = H *

1550 LET F=1

1560 GOTO 1750

1570 LET A$=” " 1580 IF A 2>= (-B (3,3) ) THEN 1700

1590 LET E $ = " *

1600 LET F=1

1610 GOTO 1710

1620 LET F $ = " " 1630 IF A 2< ( -B ( 3 , 3 ) ) THEN 1480

1640 LET B $ = " ” 1650 IF A2> (-B ( 3 , 3 ) ) THEN 1510

1660 LET C$=" " 1670 IF A2<> (-B (3,3) ) THEN 1540

1680 LET D$=” " 1690 GOTO 1750

1700 LET E$=“ " 1710 IF A2<= (-B (3, 3) ) THEN 1620

1720 LET F $ = " *

1730 LET F=1

1740 GOTO 1630

1750 PRINT TAB ( 11 ) ; " 3 TO - ( - 3

) " ; TAB ( 34 ) ; A $ ; TAB ( 3 9 ) ; B $ ;TAB ( 4 4 ) ;C $

;

1760 PRINT TAB (49) ; D$ ; TAB (55) ; E $ ; TAB (61) ; F

$

1765 REM COMPARING AN ARRAY ELEMENT WITH A SIMPLE PARENTHESIZED

1767 REM EXPRESSION INVOLVING A SIMPLE VARIABLE

1770 IF B ( 2 , 2 ) = (-A1 ) THEN 1900

1780 LET A § = " *

1790 LET F=1

1800 GOTO 1910

1810 LET B$="* B 1820 LET F=1

1830 GOTO 1980

1840 LET C$= H *" 1850 LET F=1

1860 GOTO 2000

1870 LET D $ = B *

1880 LET F=1

1890 GOTO 2080

1900 LET A$ = " " 1910 IF B (2, 2) >= (-A1) THEN 2030

1920 LET £$="*”

1930 LET F = 1 1940 GOTO 2040

1950 LET F$= B " 1960 IF B ( 2 , 2 ) < (-A1 ) THEN 1810

1970 LET B $ = “ B

36
1980

1990

2000

2010

2020

2030

2040

2050

2060

2070

2080

2090

2100

2105

2110

2115

2120

2125

2130

2135

2140

2145

2150

2155

2160

2165

2170

2175

2180

2185

2190

2195

2200

2210

2215

2220

2225

2230

2235

2240

2245

2250

2255

2260

2265

2270

2275

2280

2285

2290

2295

2300

2305

IF B ( 2 , 2 ) > (-A1 ) THEN 1840

LET C$=" " IF B (2, 2) <> (-A1) THEN 1870

LET D$ = " " GOTO 2080

LET E$ = " " IF B (2, 2) <= (-A1) THEN 1950

LET F $ = " *

LET F=1

GOTO 1960

PRINT TAB (10 ) ; "-2 TO - ( 2

) " ; TAB ( 3 4 ) ; A $ ; TAB ( 3 9 ) ; B $ ; TAB ( 4 4 ) ; C

$

PRINT TAB (49) ;D$;TAB (55) ;E$;TAB (61) ;F$

LET A$ = " " LET B $ = " " LET C$ = " " LET D$=" " LET E$=" " LET F$ = " M LET F=0

DIM A ( 5

)

LET B ( 5 , 5) =-5

LET A ( 5

) =-5

IF B ( 5 , 5

) =A ( 5 ) THEN 2165

LET A $ = " *

LET F=1

IF B ( 5 , 5 ) >=A ( 5 ) THEN 2180

LET E $ = *' * " LET F=1

IF B ( 5 , 5 ) <=A ( 5 ) THEN 2195

LET F $ = " *

LET F=1

IF B (5, 5) <A (5) THEN 2215

IF B ( 5 , 5 ) >A ( 5 ) THEN 2230

GO TO 2237

LET B $ = " *

LET F=1

GO TO 2200

LET C$="*"

LET F=1

PRINT

IF FO0 THEN 2270

PRINT TAB (31); "NO ASTERISKS"

PRINT TAB (32) ; "THEREFORE"

PRINT TAB (31) ; "TEST PASSED."

GOTO 2285

PRINT TAB (30) ; "SOME ASTERISKS"

PRINT TAB (32) ; "THEREFORE"

PRINT TAB (31) ; "TEST FAILED."

PRINT

PRINT " END TEST.

PRINT

PRINT

END

37
*****************

* SAMPLE OUTPUT * *****************

PROGRAM FILE 41

SECTION 41.0

IF-THEN

* * *US I NG NUMERICAL CONSTANTS, ASSIGNED SIMPLE VARIABLES

AND

ASSIGNED SUBSCRIPTED VARIABLES, TOGETHER. * * *

BEGIN TEST.

ALL INVALID IF-THEN EVALUATIONS WILL BE DESIGNATED BY

AN ASTERISK IN THE COLUMNS OF THOSE RELATIONAL SYMBOLS FOR

WHICH ERROR (S) OCCURRED FOR THAT COMPARATIVE ROW.

COMPARISONS

RESULTS

OF

IF-THEN EVALUATIONS

-2 TO -2

-3 TO -1

0 TO -2

3 TO -(-3)

-2 TO “(2)

-5 TO -5

NO ASTERISKS

THEREFORE

TEST PASSED.

END TEST.

38
42.0 THE ABS FUNCTION WITH SUBSCRIPTED VARIABLES

FOR ARGUMENTS

Thi

vat i able

constant

constant

used as

s test verifies that the absolute value function allows subscripted

s as arguments. In this test, both negative and positive numerical

s are assigned to one and two dimensioned variables. The assigned

s are of NRl , NR2, and NR3 form. The subscripted variables are then

the arguments of the ABS function.

The output has three columns. The first column is labeled "Value of

Argument", the second is labeled "True Evaluation", and the third is labeled

"System Evaluation". The first column lists the constants that were assigned

to the subscripted variable, the second column lists the implementation

output expected, and the third column lists the test system evaluation. If

any value in the third column is inaccurate, then an asterisk should appear

beside it.

*******************

* PROGRAM FILE 42 * *******************

0010

0060

0070

0080

0090

0100

0110

0120

0130

0140

0150

0160

0170

0180

0190

0200

0210

0220

0230

0240

0250

0260

0270

0280

0290

0300

0310

PRINT "PROGRAM FILE 42"

PRINT

PRINT

PRINT

PRINT " SECTION 42.0"

PRINT

PRINT " THE ABS FUNCTION."

PRINT

PRINT

PRINT " "USING NUMERICALLY ASSIGNED SUBSCRIPTED

PRINT " FOR"

PRINT " ARGUMENTS.*"

PRINT

PRINT

PRINT " BEGIN TEST."

PRINT

DIM A ( 6 ) , B ( 2 , 3

)

LET A ( 1

) =- 1

0

LET B (1, 1) =15

LET B (1, 2) =-.

5

LET A ( 2

) = . 1 2 5 LET A (3) =-62. 5E-3

LET B (1 , 3) =312. 5E-4

LET A ( 4

) =ABS ( A ( 1 )

)

IF A (4 ) <>10 THEN 320

LET A $ = " " GOTO 330

VARIABLES"

39
0320

0330

0340

0350

0360

0370

0380

0390

0400

0410

0420

0430

0440

0450

0460

0470

0480

0490

0500

0510

0520

0530

0540

0550

0560

0570

0580

0590

0600

0610

0630

0640

0650

0660

0670

0680

0690

0700

0710

0720

0730

0740

0750

0760

0770

0780

LET A $ = " *

LET B ( 2 , 1

) =ABS (B ( 1 , 1 )

)

IF B (2, 1) 015 THEN 370

LET B$=" " GOTO 380

LET B $ = " *

LET A ( 5

) =ABS (B(l,2)

)

IF A ( 5 ) <>. 5 THEN 420

LET C$=" " GOTO 430

LET C $ = " *

LET B (2, 2) =ABS (A (2)

)

IF B (2 , 2) O . 125 THEN 470

LET D$=" " GOTO 480

LET D$=" *

LET A ( 6

) =ABS ( A ( 3 )

)

IF A ( 6 ) 062. 5E-3 THEN 520

LET E$=" " GOTO 530

LET E $ = " *

LET B (2, 3) =ABS (B (1, 3)

)

IF B (2, 3) 0312. 5E-4 THEN 570

LET F $ = " " GOTO 580

LET F $ = " * " PRINT

PRINT " EACH EVALUATED FAILURE OF THE ABS FUNCTION WILL BE DE-"

PRINT "NOTED BY AN ASTERISK BEING PRINTED ON THAT COMPARATIVE ROW"

PRINT "OF OUTPUT. TEST PASSED IF THERE ARE NOT ANY ASTERISKS."

PRINT

PRINT

PRINT "VALUE OF"," TRUE SYSTEM " PRINT "ARGUMENT" , " EVALUATION" , "EVALUATION"

PRINT

PRINT "-10 "," 10 " , A ( 4 ) ; A $

PRINT " 15 15 "

, B ( 2 , 1 )

; B $

PRINT "-.5 "," .5 " , A ( 5 ) ;C$

PRINT " .125 .125 ",B(2 f 2);D$

PRINT "-62.5E-3 "

, " .0625 ",A(6);E$

PRINT " 312.5E-4 .03125 ",B(2,3);F$

PRINT

PRINT " END TEST.

PRINT

PRINT

END

*****************

* SAMPLE OUTPUT * *****************

1*0
PROGRAM FILE 42

SECTION 42.0

THE ABS FUNCTION.

*US ING NUMERICALLY ASSIGNED SUBSCRIPTED VARIABLES

FOR

ARGUMENTS.

BEGIN TEST.

EACH EVALUATED FAILURE OF THE ABS FUNCTION WILL BE DENOTED BY AN ASTERISK BEING PRINTED ON THAT COMPARATIVE ROW

OF OUTPUT. TEST PASSED IF THERE ARE NOT ANY ASTERISKS.

VALUE OF

ARGUMENT

-10

15

-.5

. 125

-62. 5E-3

312. 5E-4

TRUE

EVALUATION

10

15

. 5

. 125

. 0625

. 03125

SYSTEM

EVALUATION

10

15

. 5

. 125

. 0625

.03125

END TEST.

Ul
43.0 USING ELEMENTARY OPERATIONS ON SUBSCRIPTED VARIABLES

ASSIGNED SAME TYPE CONSTANTS

The next several tests verify that the implementation will continue to

maintain six digits of precision for the operations addition, subtraction,

multiplication, division, and involution when subscripted variables are used

as terms or factors of numerical expressions. The first test below uses arrays assigned constants of the same type. This isolates any error to that

associated with operating on array elements and not to the constants assigned

to them.

43.1 Addition

The objective of this test is the same as for section 22.1, except in

this case the numerical constants have been assigned to subscripted variables

rather than simple variables. There are four different addition exercises

performed, one for each of the type constants NRl , NR2 , and NR3 , and implicit

point scaled. Each exercise adds a double- and a single-dimensional array

element. This test has the same output format described in section 22.1.

43.2 Subtraction

The objective here is the same as section 22.2, except in this test the

numerical constants have been assigned to subscripted variables instead of

simple variables. The four different subtraction exercises have been

constructed so that the output format is similar to that in section 22.2.

*******************

* PROGRAM FILE 43 * *******************

0010 PRINT "PROGRAM FILE 43"

0140 PRINT

0150 PRINT

0160 PRINT

0170 PRINT n SECTION 43.0"

0180 PRINT

0190 PRINT ii (NON-MIXED MODES. )

0200 PRINT

0210 PRINT

0220 PRINT ii BEGIN TEST.

0230 PRINT

0240 PRINT

0250 PRINT M SECTION 43.1"

0260 PRINT

0270 PRINT ii « i » i i i II

k 2
0280

0290

0300

0310

0320

0330

0340

0350

0360

0370

0380

0390

0400

0410

0420

0430

0440

0450

0460

0470

0480

0490

0500

0510

0520

0530

0540

0550

0560

0570

0580

0590

0600

0610

0620

0630

0640

0650

0660

0670

0680

0690

0700

0710

0720

0730

0740

0750

0760

0770

0780

0790

0800

0810

0820

0830

0840

PRINT " + ADDITION +

" PRINT " ++++++++++++"

PRINT

PRINT M IF NO ASTERISK FOLLOWS ANY VALUE IN THE ABSOLUTE ERROR"

PRINT "COLUMN, TEST PASSED. HOWEVER, IF AN ASTERISK FOLLOWS"

PRINT "A VALUE IN THE ABSOLUTE ERROR COLUMN, TEST FAILED BE-"

PRINT "CAUSE SYSTEM WOULD HAVE FAILED THE ERROR BOUND ROUND-OFF OF"

PRINT "SIX PLACE ACCURACY."

PRINT

PRINT

PRINT "ASSIGNMENT 1"

PRINT " + " ," REQUIRED" , " SUM OF" , "ABSOLUTE"

PRINT "ASSIGNMENT 2"," SUM ", "SYSTEM"," ERROR " PRINT

PRINT

DIM A ( 4 ) ,B (2 , 2) ,C(2,4) ,D(4)

LET A$ = " " LET A ( 1

) =2

LET B ( 1 , 1

) =-12

LET D ( 1

) =10

LET C ( 1 , 1 ) =A ( 1 ) +B ( 1 , 1

)

LET C(1,2)=C(1,1)+D(1)

IF ABS (C (1, 2) ) <=lE-4 THEN 520

LET A$=" *

PRINT " 2 PRINT " + =","-10 ",C(1,1),C(1,2);A?

PRINT "-12

PRINT

LET A$=" " LET A (2) =10.

5

LET B (1 , 2) =-32.

5

LET D (2 ) =22 .

0

LET C ( 1 , 3

) =A ( 2 ) +B ( 1 , 2

)

LET C ( 1 , 4 ) =C ( 1 , 3 ) +D ( 2 ) IF ABS (C (1, 4) ) <=lE-4 THEN 640

LET A $ = " *

PRINT " 10.5 " PRINT " + =","-22 " ,C ( 1 , 3) ,C(1,4) ;A$

PRINT "-32.5

PRINT

LET A$=" " LET A ( 3 ) =2 . 5E 20

LET B (2, 1

) =3 . 5E21

LET D ( 3

) =-3 . 75E21

LET C ( 2 , 1 ) =A ( 3 ) +B ( 2 , 1

)

LET C ( 2 , 2

) =C ( 2 , 1 ) +D ( 3

)

IF ABS (C (2, 2) ) < = 1E16 THEN ’’60 LET A $ = " *

PRINT " 2.5E20 " PRINT " + ="," 3.75000E21 " , C ( 2 , 1 ) , C ( 2 , 2 ) ; A

$

PRINT " 3.5E21 " PRINT

LET A $ = " " LET A ( 4

) =3E 20

LET B ( 2 , 2 ) =4E 20

LET D(4)=-7E20

LET C ( 2 , 3 ) =A ( 4 ) +B ( 2 , 2

)

i+3
0850

0860

0870

0880

0890

0900

0910

0920

0930

0940

0950

0960

0970

0980

0990

1000

1010

1020

1030

1040

1050

1060

1070

1080

1090

1100

1110

1120

1130

1140

1150

1160

1170

1180

1190

1200

1210

1220

1230

1240

1250

1260

1270

1280

1290

1300

1310

1320

1330

1340

1350

1360

1370

1380

1390

1400

1410

LET C ( 2 , 4 ) =C ( 2 , 3 ) +D ( 4 ) IF ABS (C (2, 4) ) <=1E15 THEN 880

LET A$=" *

PRINT " 3E20

PRINT " + 7. 0000 0E 20 " ,C ( 2 , 3 ) ,C ( 2 , 4 ) ; A?

PRINT " 4E20

PRINT

PRINT " END TEST."

PRINT

PRINT

PRINT

PRINT " BEGIN TEST."

PRINT

PRINT

PRINT " SECTION 43.2"

PRINT

PRINT " " PRINT " - SUBTRACTION -" PRINT " " PRINT

PRINT " IF NO ASTERISK FOLLOWS ANY VALUE IN THE ABSOLUTE ERROR"

PRINT “COLUMN, TEST PASSED. HOWEVER, IF AN ASTERISK FOLLOWS"

PRINT "A VALUE IN THE ABSOLUTE ERROR COLUMN, TEST FAILED BE-"

PRINT "CAUSE SYSTEM WOULD HAVE FAILED THE ERROR BOUND ROUND-OFF OF"

PRINT "SIX PLACE ACCURACY."

PRINT

PRINT

PRINT "ASSIGNMENT 1"," "

, "DIFFERENCE"

PRINT " - "," REQUIRED "," OF ", "ABSOLUTE"

PRINT "ASSIGNMENT 2" , "DIFFERENCE" , " SYSTEM "," ERROR " PRINT

PRINT

DIM E(12) , F ( 4 , 2

)

LET A$ = " " LET E (1) =156

LET E (2) =6

LET E (3) =150

LET F(1,1)=E(1)-E(2)

LET F (1, 2)=F (1, 1)— E (3)

IF ABS (F (1 , 2) ) < = lE-3 THEN 1260

LET A $ = " *

PRINT " 156

PRINT “ - ="," 156 ",F(1,1) ,F(1,2) ;A$

PRINT "6

PRINT

LET A$ = " " LET E (4 ) =2 . 55

LET E (5) =-12. 55

LET E (6 ) =-15 .

1

LET F (2,1)=E (5)— E (4)

LET F(2,2)=F(2,1)-E(6)

IF ABS (F (2, 2) ) <=lE-4 THEN 1380

LET A $ = " *

PRINT "-12.55

PRINT " - =","-15.1 " , F ( 2 , 1 ) , F (2 , 2) ;A$

PRINT " 2.55

PRINT

L U
1420 LET A$ = " " 1430 LET E (7 ) =2 . 55E20

1440 LET E (8 ) =-2 . 55E20

1450 LET E ( 9

) =5 . 1E20

1460 LET F ( 3 , 1

) =E (7 ) -E (8

)

1470 LET F(3,2)=F(3,1)-E(9)

1480 IF ABS (F ( 3 , 2) ) <=1E15 THEN 1500

1490 LET A $ = " *

1500 PRINT " 2.55E20 " 1510 PRINT - = H ," 5 . 100 00E 20 - , F (

3

r 1 ) , F ( 3 , 2 ) ; A$

1520 PRINT "-2.55E20 " 1530 PRINT

1540 LET A$ = " " 1550 LET E (10 ) =1E30

1560 LET E (11) =19E30

1570 LET E (12) =18E30

1580 LET F (4, 1)=E (ll)-E (10)

1590 LET F(4,2)=F(4,1)-E(12)

1600 IF ABS (F (4 , 2) ) <=1E26 THEN 1620

1610 LET A$= M *

1613 PRINT " 19E30

1630 PRINT " - 1 . 80000E 31 M

, F ( 4 , 1 ) , F ( 4 , 2 ) ; AS

1640 PRINT " IE 30

1650 PRINT

1660 PRINT " END TEST."

1670 PRINT

1680 PRINT

1690 END

*****************

* SAMPLE OUTPUT * *****************

PROGRAM FILE 43

SECTION 43.0

(NON-MIXED MODES.

)

BEGIN TEST.

SECTION 43.1

+ ADDITION +

^5
IF NO ASTERISK FOLLOWS ANY VALUE IN THE ABSOLUTE ERROR

COLUMN, TEST PASSED. HOWEVER, IF AN ASTERISK FOLLOWS

A VALUE IN THE ABSOLUTE ERROR COLUMN, TEST FAILED BECAUSE SYSTEM WOULD HAVE FAILED THE ERROR BOUND ROUND-OFF OF

SIX PLACE ACCURACY.

ASSIGNMENT 1 + REQUIRED SUM OF

ASSIGNMENT 2 SUM SYSTEM

ABSOLUTE

ERROR

2+ = -10 -10 0 -12

10.5

+ = -22 -22 0 -32.5

2. 5E20

+ = 3.75000E21 3 . 7 500 0E+2 1 0 3. 5E21

3E20

+ = 7.00000E20 1 . 00000E+20 0 4E20

END TEST.

BEGIN TEST.

SECTION 43.2

- SUBTRACTION -

IF NO ASTERISK FOLLOWS ANY VALUE IN THE ABSOLUTE ERROR

COLUMN, TEST PASSED. HOWEVER, IF AN ASTERISK FOLLOWS

A VALUE IN THE ABSOLUTE ERROR COLUMN, TEST FAILED BECAUSE SYSTEM WOULD HAVE FAILED THE ERROR BOUND ROUND-OFF OF

SIX PLACE ACCURACY.

ASSIGNMENT 1 DIFFERENCE

- REQUIRED OF ABSOLUTE

ASSIGNMENT 2 DIFFERENCE SYSTEM ERROR

156

6 156 150 0

U6
2. 55E20

-2. 55E20

19E30

1E30

5. 10000E20

1. 80000E31

5. 10000E+20

1 . 80000E+31

END TEST
44.0 USING ELEMENTARY OPERATIONS ON SUBSCRIPTED VARIABLES

ASSIGNED SAME TYPE CONSTANTS (CONTINUED)

44.1 Multiplication

This test is similar to section

constants have been assigned to

variables. The four cases exercised

output to section 23.1.

23.1, except in this test the

subscripted variables instead

in 43.1 and 43.2 are used with

numerical

of simple

a similar

44.2 Division

tes

i ns the

The objective of

t the numerical

tead of simple var output is similar

this test is similar to section 23.2, except in this

constants have been assigned to subscripted variables

iables. Again, the four separate exercises are used and

to section 23.2.

44.3 Involution

The objective of this test is similar to test 23 . 3 , except in

the numerical constants have been assigned to subscripted variables

simple variables. The four separate exercises are used and the

similar to section 23.3.

this test

instead of

output is

*******************

* PROGRAM FILE 44 * *******************

0010 PRINT

0060 PRINT

0070 PRINT

0080 PRINT

0090 PRINT

0100 PRINT

0110 PRINT

0120 PRINT

0130 PRINT

0140 PRINT

0150 PRINT

0160 PRINT

0170 PRINT

0180 PRINT

0190 PRINT

0200 PRINT

0210 PRINT

"PROGRAM FILE 44"

BEGIN TEST."

" SECTION 44.1"

XXXXXXXXXXXXXXXXXX"

X MULTIPLICATION X"

" XXXXXXXXXXXXXXXXXX"

IF NO ASTERISK FOLLOWS ANY VALUE IN THE ABSOLUTE ERROR"

"COLUMN, TEST PASSED. HOWEVER, IF AN ASTERISK FOLLOWS"

"A VALUE IN THE ABSOLUTE ERROR COLUMN, TEST FAILED BE-"

"CAUSE SYSTEM WOULD HAVE FAILED THE ERROR BOUND ROUND-OFF OF"

H8
0220 PRINT "SIX PLACE ACCURACY."

0230 PRINT

0240 PRINT

0250 PRINT "ASSIGNMENT 1"

0260 PRINT " X "

, "REQUIRED" , "PRODUCT OF" f "ABSOLUTE"

0270 PRINT "ASSIGNMENT 2", "PRODUCT "," SYSTEM ERROR " 0280 PRINT

0290 PRINT

0300 DIM L (4 ) ,M ( 2 , 6) ,N(4)

0310 LET A$ = " ” 0320 LET L ( 1

) =15

0330 LET M ( 1 , 1

) =20

0340 LET N (1) =300

0350 LET M(1,2)=L(1)*M(1,1)

0360 LET M(1,3)=M(1,2)-N (1)

0370 IF ABS (M(l,3))<=lE-3 THEN 390

0380 LET A$=" *

0390 PRINT "15

0400 PRINT " * ="," 300 "

, M ( 1 , 2 ) , M ( 1 , 3 ) ; A $

0410 PRINT " 20

0420 PRINT

0430 LET A$=" " 0440 LET L ( 2

) =3 .

6

0450 LET M ( 1 , 4

) =4 .

2

0460 LET N (2) =15. 12

0470 LET M ( 1 , 5) =L ( 2

) *M ( 1 , 4

)

0480 LET M ( 1 , 6 ) =M ( 1 , 5 ) -N (2)

0490 IF ABS (M(l,6))<=lE-4 THEN 510

0500 LET A $ = " *

0510 PRINT "3.6

0520 PRINT " * ="," 15.12 " , M ( 1 , 5 ) , M ( 1 , 6 ); A

$

0530 PRINT "4.2

0540 PRINT

0550 LET A$=" " 0560 LET L (3 ) =3 . 6E15

0570 LET M ( 2 , 1

) =1 . 2E3

0580 LET N (3) =4 . 32E18

0590 LET M(2, 2)=L (3) *M(2, 1)

0600 LET M (2, 3) =M (2, 2) -N (3)

0610 IF ABS (M (2, 3) ) <=1E13 THEN 630

0620 LET A$= " " 0630 PRINT " 3.6E15 " 0640 PRINT " * = "," 4 . 32000E18 " , M ( 2 , 2 ) , M ( 2 , 3 ) ; A $

0650 PRINT " 1.2E3

0660 PRINT

0670 LET A$= " " 0680 LET L (4 ) =3E18

0690 LET M ( 2 , 4

) =2E-3

0700 LET N (4) =6E15

0710 LET M(2,5)=L(4)*M(2,4)

0720 LET M(2,6)=M(2,5)-N (4)

0730 IF ABS (M(2,6) ) < = 1E10 THEN 750

0740 LET A $ = " *

0750 PRINT " 3E18

0760 PRINT " * = "," 6. 00000E15 " , M ( 2 , 5) , M ( 2 , 6) ; A$

0770 PRINT " 2E-3

0780 PRINT

49
0790 PRINT

0800 PRINT

0810 PRINT

0820 PRINT

0830 PRINT

0840 PRINT

0850 PRINT

0860 PRINT

0870 PRINT

0880 PRINT

0890 PRINT

0900 PRINT

0910 PRINT

0920 PRINT

0930 PRINT

0940 PRINT

0950 PRINT

0960 PRINT

0970 PRINT

0980 PRINT

0990 PRINT

1000 PRINT

1010 PRINT

1020 PRINT

1030 PRINT

1040 DIM X ( 2 , 2 ) , Y (12) , Z ( 2 , 2

)

1050 LET A$=" " 1060 LET X ( 1 , 1

) =1

5

1070 LET Y ( 1

) =5

1080 LET Z (1, 1) =3

1090 LET Y ( 2

) =X ( 1 , 1 ) /Y ( 1

)

1100 LET Y ( 3

) =Y ( 2

) -Z (1,1)

1110 IF ABS (Y (3) ) < = lE-5 THEN 1130

1120 LET A $ = " *

1130 PRINT "15

1140 PRINT " / ="," 3

"

, Y ( 2 ) , Y ( 3 ) ; A $

1150 PRINT "5

1160 PRINT

1170 LET A$=" " 1180 LET X(l,2)=14.2

1190 LET Y ( 4

) =7 .

1

1200 LET Z (1,2) =2 .

0

1210 LET Y ( 5

) =X (1,2) /Y ( 4

)

1220 LET Y(6)=Y(5)-Z(1,2)

1230 IF ABS (Y (6) ) <=lE-5 THEN 1250

1240 LET A $ = " * " 1250 PRINT " 14.2

1260 PRINT " / =","2 " ,Y (5) , Y (6) ; A $

1270 PRINT " 7.1

1280 PRINT

1290 LET A$=" " 1300 LET X(2,1)=3.5E30

1310 LET Y (7 ) =7 . 0E10

1320 LET Z (2, 1) =5. 0E19

1330 LET Y (8) =X (2, 1) /Y (7)

1340 LET Y(9)=Y ( 8

) -Z (2,1)

1350 IF ABS (Y (9) ) <=1E14 THEN 1370

END TEST."

BEGIN TEST."

" SECTION 44.2"

M ////////////"

" / DIVISION /"

H ////////////"

" IF NO ASTERISK FOLLOWS ANY VALUE IN THE ABSOLUTE ERROR

"COLUMN, TEST PASSED. HOWEVER, IF AN ASTERISK FOLLOWS"

"A VALUE IN THE ABSOLUTE ERROR COLUMN, TEST FAILED BE-"

"CAUSE SYSTEM WOULD HAVE FAILED THE ERROR BOUND ROUND-OFF OF

"SIX PLACE ACCURACY."

"ASSIGNMENT 1"

" / ","REQUIRED","QUOTIENT OF", "ABSOLUTE"

"ASSIGNMENT 2

"

, " QUOTI ENT" , " SYSTEM "," ERROR "
1360

1370

1380

1390

1400

1410

1420

1430

1440

1450

1460

1470

1480

1490

1500

1510

1520

1530

1540

1550

1560

1570

1580

1590

1600

1610

1620

1630

1640

1650

1660

1670

1680

1690

1700

1710

1720

1730

1740

1750

1760

1770

1780

1790

1800

1810

1820

1830

1840

1850

1860

1870

1880

1890

1900

1910

1920

LET A $ = " *

PRINT " 3.5E30 " PRINT " / 5. 00000E19 ",Y (8) ,Y(9) ;A$

PRINT " 7.0E10 " PRINT

LET A$ = " " LET X (2 , 2) =1 8E20

LET Y (10) =9E-2

LET Z (2, 2) =2E22

LET Y ( 1 1

) =X ( 2 , 2 ) /Y (10)

LET Y ( 1 2

) =Y (ll)-Z (2,2)

IF ABS (Y (12) ) < = 1E17 THEN 1490

LET A$=" *

PRINT " 18E20

PRINT " / = 2. 00000E22 ",Y(11),Y(12);A$

PRINT " 9E-2

PRINT

PRINT " END TEST.

PRINT

PRINT

PRINT

PRINT " BEGIN TEST."

PRINT

PRINT

PRINT " SECTION 44.3"

PRINT

PRINT " PRINT " * INVOLUTION A " PRINT " " PRINT

PRINT

PRINT " IF NO ASTERISK FOLLOWS ANY VALUE IN THE ABSOLUTE ERROR"

PRINT "COLUMN, TEST PASSED. HOWEVER, IF AN ASTERISK FOLLOWS"

PRINT "A VALUE IN THE ABSOLUTE ERROR COLUMN, TEST FAILED BE-"

PRINT "CAUSE SYSTEM WOULD HAVE FAILED THE ERROR BOUND ROUND-OFF OF"

PRINT "SIX PLACE ACCURACY."

PRINT

PRINT

PRINT "ASSIGNMENT 1"

PRINT " ~ ", "REQUIRED" , "POWER OF" , "ABSOLUTE"

PRINT "ASSIGNMENT 2"," POWER "," SYSTEM "," ERROR " PRINT

PRINT

DIM F ( 6 , 2 ) ,G (4 ) ,H(4)

LET A$=" " LET F (1, 1) =-5

LET G ( 1

) =4

LET F (1, 2) =625

LET H (1)=F(1,1) a G(1)

LET F ( 2 , 1 ) =H ( 1 ) — F (1, 2)

IF ABS (F(2,l))<=lE-3 THEN 1880

LET A $ = " *

PRINT "-5

PRINT " ="," 625 ",H(1) ,F(2,1) ;A$

PRINT "4

PRINT

LET A$=" "

51
1930

1940

1950

1960

1970

1980

1990

2000

2010

2020

2030

2040

2050

2060

2070

2080

2090

2100

2110

2120

2130

2140

2150

2160

2170

2180

2190

2200

2210

2220

2230

2240

2250

2260

2270

2280

2290

2300

2310

LET F (2, 2) =. 625

LET G ( 2

) =0 .

0

LET F ( 3 , 1

) =1 .

0

LET H(2)=F(2,2)~G(2)

LET F ( 3 , 2

) =H ( 2

) -F ( 3 , 1

)

IF AB S ( F ( 3 , 2 ) )<=lE-5 THEN 2000

LET A$ = " * M PRINT n .625

PRINT " = 1 " ,H (2) ,F (3, 2) ;A$

PRINT "0.0

PRINT

LET A$=" " LET F (4 , 1) =-. 005E3

LET G (3 ) =-200 . E-2

LET F(4,2)=4.0E-2

LET H(3)=F(4,1)G(3)

LET F ( 5 , 1

) =H ( 3

) -F ( 4 , 2

)

IF ABS (F(5,l))<=lE-7 THEN 2120

LET A $ = " *

PRINT 005E3

PRINT " .04 " ,H (3) ,F (5, 1) ;A$

PRINT “-200. E-2 " PRINT

LET A$=" " LET F (5 , 2) =400E-2

LET G ( 4

) =5E-1

LET F ( 6 , 1

) =200E-2

LET H(4)=F(5,2)G(4)

LET F(6,2)=H(4)-F(6,1)

IF ABS (F (6 , 2) ) <=lE-5 THEN 2240

LET A $ = " *

PRINT " 400E-2

PRINT " = H ," 2 ",H(4),F(6,2);A$

PRINT “ 5E-1

PRINT

PRINT " END TEST.

PRINT

PRINT

END

* SAMPLE OUTPUT *

PROGRAM FILE 44

BEGIN TEST.

52
SECTION 44.1 xxxxxxxxxxxxxxxxxx

X MULTIPLICATION X XXXXXXXXXXXXXXXXXX

IF NO ASTERISK FOLLOWS ANY VALUE IN THE ABSOLUTE ERROR

COLUMN, TEST PASSED. HOWEVER, IF AN ASTERISK FOLLOWS

A VALUE IN THE ABSOLUTE ERROR COLUMN, TEST FAILED BECAUSE SYSTEM WOULD HAVE FAILED THE ERROR BOUND ROUND-OFF OF

SIX PLACE ACCURACY.

ASSIGNMENT 1 X REQUIRED

ASSIGNMENT 2 PRODUCT

PRODUCT OF

SYSTEM

ABSOLUTE

ERROR

15

*20

3.6

* 4.2

3.6E15

* 1.2E3

3E18

* 2E-3

300 300 0

15.12 15.12 0

4. 32000E18 4 . 32000E+18 0

6. 0000 0E 15 6 . 00000E+15 0

END TEST.

BEGIN TEST.

SECTION 44.2

////////////

/ DIVISION /

////////////

IF NO ASTERISK FOLLOWS ANY VALUE IN THE ABSOLUTE ERROR

COLUMN, TEST PASSED. HOWEVER, IF AN ASTERISK FOLLOWS

A VALUE IN THE ABSOLUTE ERROR COLUMN, TEST FAILED BECAUSE SYSTEM WOULD HAVE FAILED THE ERROR BOUND ROUND-OFF OF

SIX PLACE ACCURACY.

ASSIGNMENT 1 / REQUIRED QUOTIENT OF ABSOLUTE

ASSIGNMENT 2 QUOTIENT SYSTEM ERROR

53
15

/ = 3 3 0 5

14,2

/

7,1

3. 5E30

/

7.0E10

18E20

/

9E-2

END TEST.

2 2 0

5.00000E19 5. 00000E+19 0

2.00000E22 2 . 00000E+22 0

BEGIN TEST.

SECTION 44.3

* INVOLUTION ~

IF NO ASTERISK FOLLOWS ANY VALUE IN THE ABSOLUTE ERROR

COLUMN, TEST PASSED. HOWEVER, IF AN ASTERISK FOLLOWS

A VALUE IN THE ABSOLUTE ERROR COLUMN, TEST FAILED BECAUSE SYSTEM WOULD HAVE FAILED THE ERROR BOUND ROUND-OFF OF

SIX PLACE ACCURACY.

ASSIGNMENT 1 REQUIRED

ASSIGNMENT 2 POWER

. 625

0.0

-. 005E3

-200. E-2

1

. 04

POWER OF

SYSTEM

625

. 04

ABSOLUTE

ERROR

0

0

0

400E-2

5E-1

2 2 0

5 ^
END TEST.
45.0 USING ELEMENTARY OPERATIONS ON SUBSCRIPTED VARIABLES

ASSIGNED MIXED TYPE CONSTANTS

Addition

The objective of this test is similar to section 24.1, except in this

test the numerical constants have been assigned to subscripted variables

instead of simple variables. There are six separate exercises performed in

this routine. First, NRl and NR2 assigned constants are added. Second, NRl

and NR3 assigned constants are added. Third, NRl and implicit point scaled

constants are assigned, added, then followed by the addition of an NR2

number. Fourth, NR2 and NR3 are combined. Fifth, NR2 and implicit point

scaled are combined and, finally, NR3 and implicit point scaled are combined.

The output is similar in format to section 24.1.

*******************

* PROGRAM FILE 45 * *******************

0010 PRINT

0060 PRINT

0070 PRINT

0080 PRINT

0090 PRINT

0100 PRINT

0110 PRINT

0120 PRINT

0130 PRINT

0140 PRINT

0150 PRINT

0160 PRINT

0190 PRINT

0200 PRINT

0210 PRINT

0220 PRINT

0230 PRINT

0240 PRINT

0250 PRINT

0260 PRINT

0270 PRINT

0280 PRINT

0290 PRINT

0300 PRINT

0310 PRINT

0320 PRINT

0330 PRINT

0340 PRINT

"PROGRAM FILE 45"

SECTION 45.0"

(MIXED MODES. )

BEGIN TEST."

+ ADDITION +'

IF NO ASTERISK FOLLOWS ANY VALUE IN THE ABSOLUTE ERROR"

"COLUMN, TEST PASSED. HOWEVER, IF AN ASTERISK FOLLOWS"

"A VALUE IN THE ABSOLUTE ERROR COLUMN, TEST FAILED BE-"

"CAUSE SYSTEM WOULD HAVE FAILED THE ERROR BOUND ROUND-OFF OF"

"SIX PLACE ACCURACY."

"ASSIGNMENT 1"

H tl "ASSIGNMENT 2"

"REQUIRED"

" SUM

"SUM OF" , "ABSOLUTE"

"SYSTEM"," ERROR "

56
0350

0360

0370

0380

0390

0400

0410

0420

0430

0440

0450

0460

0470

0480

0490

0500

0510

0520

0530

0540

0550

0560

0570

0580

0590

0600

0610

0620

0630

0640

0650

0660

0670

0680

0690

0700

0710

0720

0730

0740

0750

0760

0770

0780

0790

0800

0810

0820

0830

0840

0850

0860

0870

0880

0890

0900

0910

DIM A (12, 2) ,B (6)

LET A$=" " LET A ( 1 , 1

) =1

2

LET A (1 , 2) =2 .

5

LET A (2, 1) =-14.

5

LET B ( 1

) =A ( 1 , 1

) +A ( 1 , 2

)

LET A ( 2 , 2

) =B ( 1

) +A ( 2 , 1

)

IF ABS (A(2, 2) ) <=lE-4 THEN 440

LET A$=" *

PRINT "12

PRINT " + 14.5 ",B(1) ,A(2,2) ;A$

PRINT "2.5

PRINT

LET A$ = " " LET A ( 3 , 1

) =1

4

LET A (3, 2) =12. 5E-3

LET A(4,1)=-.140125E2

LET B ( 2 ) =A ( 3 , 1 ) +A ( 3 , 2

)

LET A ( 4 , 2

) =B ( 2 ) +A ( 4 , 1

)

IF ABS (A(4, 2) ) <=lE-4 THEN 560

LET A $ = " *

PRINT " 14

PRINT " + ="," 14.0125 " ,B(2) ,A(4, 2) ;A$

PRINT " 12 , 5E-3

PRINT

LET A$=" " LET A ( 5 , 1

) =-9

LET A (5 , 2) =-15E-4

LET A (6, 1) =9. 0015

LET B ( 3

) =A ( 5 , 1 ) +A ( 5 , 2

)

LET A ( 6 , 2

) =B ( 3 ) +A ( 6 , 1

)

IF ABS (A(6, 2) ) <=lE-5 THEN 680

LET A $ = " *

PRINT " -9

PRINT " + =","-9.0015 " ,B(3) , A ( 6 , 2 ) ;A$

PRINT "-15E-4

PRINT

LET A$=" " LET A ( 7 , 1

) = . 625

LET A (7, 2) =-. 00005E7

LET A (8 , 1) =499. 375

LET B ( 4

) =A ( 7 , 1 ) +A (7,2)

LET A ( 8 , 2

) =B ( 4 ) +A ( 8 , 1

)

IF ABS (A(8, 2) ) <=lE-3 THEN 800

LET A $ = " *

PRINT " .625

PRINT " + =","-499.375 " ,B (4 ) , A (8 , 2) ; A$

PRINT " — . 0 00 5E 7 PRINT

LET A$ = " " LET A(9,l)=1234.2

LET A (9 , 2) =36000E-5

LET A ( 10 , 1

) =-1234 . 56

LET B ( 5

) =A (9,1) +A (9,2)

LET A ( 1 0 , 2

) =B ( 5 ) +A ( 1 0 , 1

)

IF ABS (A(10, 2) ) <=lE-2 THEN 910

PRINT " 1234.2

57
0920

0930

0940

0950

0960

0970

0980

0990

1000

1010

1020

1030

1040

1050

1060

1070

1080

1090

1100

PRINT " + 1234.56 "

, B ( 5 ) , A ( 1 0 , 2 ) ; A $

PRINT " 36000E-5 " PRINT

LET A$=" " LET A(11,1)=65.4321E21

LET A (Ilf 2) =12345E17

LET A(12,1)=-6.66666E22

LET B(6)=A(11,1)+A(11,2)

LET A ( 1 2 , 2 ) =B ( 6 ) +A ( 1 2 , 1

)

IF ABS ( A ( 1 2 , 2) ) <=1E 1 7 THEN 1030

LET A$=" *

PRINT " 65. 432 IE 21 " PRINT " + = "," 6.66666E22 "

, B (6 ) , A ( 1 2 , 2) ; A$

PRINT " 12345E17

PRINT

PRINT H END TEST."

PRINT

PRINT

END

***********

* SAMPLE OUTPUT * *****************

PROGRAM FILE 45

SECTION 45.0

(MIXED MODES.

)

BEGIN TEST.

++++++++++++

+ ADDITION + ++++++++++++

IF NO ASTERISK FOLLOWS ANY VALUE IN THE ABSOLUTE ERROR

COLUMN, TEST PASSED. HOWEVER, IF AN ASTERISK FOLLOWS

A VALUE IN THE ABSOLUTE ERROR COLUMN, TEST FAILED BECAUSE SYSTEM WOULD HAVE FAILED THE ERROR BOUND ROUND-OFF OF

SIX PLACE ACCURACY.

ASSIGNMENT 1

58
+ ASSIGNMENT 2 REQUIRED

SUM

SUM OF

SYSTEM

ABSOLUTE

ERROR

12

+ = 2.5

14.5 14.5 0

14

+

12, 5E-3

14.0125 14.0125 0

-9

+ -15E-4

-9.0015 -9.0015 0

. 625

+ =

- . 0005E7

-499.375 -499.375 0

1234.2

+ = 36000E-5

1234.56 1234.56 0

65. 4321E21

+ = 12345E17

6 . 66666E22 6. 66666E + 22 0

END TEST.

59
46.0 USING ELEMENTARY OPERATIONS ON SUBSCRIPTED VARIABLES

ASSIGNED MIXED TYPE CONSTANTS (CONTINUED)

The objective of this subtraction test

except in this test the numerical constants

variables

discussed

to section

instead of

in section

24.2.

simple variables. S

45.0 are used with the

is the same as for

have been assigned

ix similar exerci

output being simil

section 24.2,

to subscripted

ses to those

arly formatted

*******************

* PROGRAM FILE 46 * *******************

0010

0060

0070

0080

0090

0100

0110

0120

0130

0140

0150

0160

0170

0180

0185

0190

0200

0210

0220

0230

0240

0250

0260

0 2 7 0 0280

0290

0300

0310

0320

0330

0340

0350

0360

0370

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

DIM C ( LET

LET

LET

LET

LET

LET

IF

"PROGRAM FILE 46"

BEGIN TEST."

SECTION 46.0"

- SUBTRACTION -"

IF NO ASTERISK FOLLOWS ANY VALUE IN THE ABSOLUTE ERROR"

"COLUMN, TEST PASSED. HOWEVER, IF AN ASTERISK FOLLOWS"

"A VALUE IN THE ABSOLUTE ERROR COLUMN, TEST FAILED BE-"

"CAUSE SYSTEM WOULD HAVE FAILED THE ERROR BOUND ROUND-OFF OF"

"SIX PLACE ACCURACY."

A $

C ( C ( c ( D ( E ( ABS

LET A$

"ASSIGNMENT 1","

" - "," REQUIRED

"ASSIGNMENT 2" , "DIFFERENCE

3,6) , D (6 )

, E (6

)

_ || ||

1 , 1)=2

1 .

2)

=. 76544

1.3)

=1.23456

1 ) =C ( 1 , 1) -C ( 1 , 2)

1 ) =D (1 ) -C (1 , 3)

(E (1) ) < = lE-5 THEN 380

= »*'

II II f

II II

DIFFERENCE"

OF "

, "ABSOLUTE"

SYSTEM ERROR "

60
0 380 PRINT " 2 0390 PRINT " - = "," 1.23456 "

, D ( 1 ) , E ( 1 ) ; A$

0400 PRINT " .76544

0410 PRINT

0420 LET A$ = " " 0430 LET C (1, 4) =15

0440 LET C (1, 5) =-. 00520E3

0450 LET C (1, 6) =. 202E2

0460 LET D ( 2 ) =C ( 1 , 4 ) -C ( 1 , 5

)

0470 LET E ( 2

) =D ( 2

) — C (1,6)

0480 IF ABS (E (2) ) <=lE-4 THEN 500

0490 LET A $ = " *

0500 PRINT " 15

0510 PRINT " - = ,, ,

,, 20.2 "

, D ( 2 ) , E ( 2 ) ; A $

0520 PRINT 00520E3

0530 PRINT

0540 LET A$= " " 0550 LET C ( 2 , 1

) =-9

0560 LET C (2, 2) =87600E-5

0570 LET C (2, 3) =-9876E-3

0580 LET D ( 3 ) =C ( 2 , 1 ) -C ( 2 , 2

)

0590 LET E (3) =D (3) -C (2, 3)

0600 IF ABS (E (3) ) <=lE-5 THEN 620

0610 LET A $ = " *

0620 PRINT " -9

0630 PRINT " - =","-9.876 " , D ( 3 ) , E ( 3 )

; A

$

0640 PRINT " 87600E-5 " 0650 PRINT

0660 LET A$=" " 0670 LET C ( 2 , 4

) =8 .

8

0680 LET C (2, 5) =. 000231E6

0690 LET C (2, 6) =-222.2

0700 LET D ( 4

) =C ( 2 , 4

) -C ( 2 , 5

)

0710 LET E (4 ) =D (4 ) -C (2 , 6)

0720 IF ABS (E (4) ) < = lE-3 THEN 740

0

7 3 0 LET A $ = " * " 0740 PRINT " 8.8

0750 PRINT " - =","-222.2 " ,D (4 ) ,E (4 ) ;A$

0760 PRINT " .000231E6

0770 PRINT

0780 LET A$ = " " 0790 LET C ( 3 , 1

) =177 . 177

0800 LET C (3, 2) =540540E-4

0810 LET C ( 3 , 3) =123 . 123

0820 LET D ( 5

) =C (3,1) —C (3,2)

0830 LET E ( 5

) =D ( 5

) -C ( 3 , 3

)

0840 IF ABS (E (5) ) <=lE-3 THEN 860

0850 LET A$=" *

0860 PRINT " 177.177

0870 PRINT " - ="," 123.123 " ,D (5) ,E (5) ;A$

0880 PRINT " 540540E-4

0890 PRINT

0900 LET A$=" " 0910 LET C(3,4)=-90.1233E20

0920 LET C (3, 5)=-12345El6

0930 LET C (3, 6) =-8. 88888E21

0940 LET D ( 6

) =C ( 3 , 4

) -C ( 3 , 5

)

6l
0950 LET E (

6

) =D (6 ) ~C ( 3 , 0960 IF ABS (E (6) ) <=1E16

0970 PRINT " -90. 1233E20

0980 PRINT " - 0990 PRINT " -12345E16

1000 PRINT

1010 PRINT " 1020 PRINT

1030 PRINT

1040 END

6 )THEN 970

II = " ,"-8.88888E21 "

, D ( 6 ) , E (6 ) ; A $

END TEST."

*****************

* SAMPLE OUTPUT * *****************

PROGRAM FILE 46

BEGIN TEST.

SECTION 46.0

- SUBTRACTION -

IF NO ASTERISK FOLLOWS ANY VALUE IN THE ABSOLUTE ERROR

COLUMN, TEST PASSED. HOWEVER, IF AN ASTERISK FOLLOWS

A VALUE IN THE ABSOLUTE ERROR COLUMN, TEST FAILED BECAUSE SYSTEM WOULD HAVE FAILED THE ERROR BOUND ROUND-OFF OF

SIX PLACE ACCURACY.

ASSIGNMENT 1 REQUIREDDIFFERENCE

OF ABSOLUTE

ASSIGNMENT 2 DIFFERENCE SYSTEM ERROR

2 1.23456 1.23456 0

. 76544

15

20.2 20.2 0 - . 00520E3

-9

-9.876 -9.876 0

62
87600E-5

8.8

. 000231E6

177.177

540540E-4

-90. 1233E20

-12345E16

- 222.2

123.123

-8. 88888E21

- 222.2

123.123

-8. 88888E+21

END TEST.

0

0

0

63
47.0

USING ELEMENTARY OPERATIONS ON SUBSCRIPTED VARIABLES

ASSIGNED MIXED TYPE CONSTANTS (CONTINUED)

47.1

Multiplication

The objective of this test is the same as in section 25.1, except in

this test the numerical constants have been assigned to subscripted variables

instead of simple variables. As in sections 45.0 and 46.0, this routine uses

six exercises to check the accuracy of simple mixed type multiplication. The

output is similar to section 25.1

47.2

Division

The objective of this test is the same as in section 25.2, except in

this test the numerical constants have been assigned to subscripted variables

instead of simple variables. Again, six exercises are used and the output is

similar to section 25.2.

47.3

Involution

The objective of this test

this test the numerical constant

instead of simple variables. Si

similar to section 25.3.

is the same as in section 25.3, except in

s have been assigned to subscripted variables

x exercises are used and the output is

*******************

* PROGRAM FILE 47 * *******************

0 010 PRINT

0 060 PRINT

0 070 PRINT

0 080 PRINT

0 090 PRINT

0 100 PRINT

0 110 PRINT

0 120 PRINT

0 130 PRINT

0 140 PRINT

0 150 PRINT

0 160 PRINT

0 170 PRINT

0 180 PRINT

0 190 PRINT

0 200 PRINT

"PROGRAM FILE 47"

BEGIN TEST."

" SECTION 4 ^ . 1

" XXXXXXXXXXXXXXXXXX"

" X MULTIPLICATION X"

" XXXXXXXXXXXXXXXXXX"

IF NO ASTERISK FOLLOWS ANY VALUE IN THE ABSOLUTE ERROR"

"COLUMN, TEST PASSED. HOWEVER, IF AN ASTERISK FOLLOWS"

"A VALUE IN THE ABSOLUTE ERROR COLUMN, TEST FAILED BE-"
13210 PRINT "CAUSE SYSTEM WOULD HAVE FAILED THE ERROR BOUND ROUND-OFF OF"

0220 PRINT "SIX PLACE ACCURACY."

0230 PRINT

0240 PRINT

0250 PRINT "ASSIGNMENT 1"

0260 PRINT " * ", "REQUIRED" , "PRODUCT OF" , "ABSOLUTE"

0270 PRINT "ASSIGNMENT 2", "PRODUCT "

, " SYSTEM "," ERROR " 0280 PRINT

0290 PRINT

0300 DIM A(6) ,B(3,2) ,C(6) ,D(2,3) ,E(6)

0310 LET A$ = " " 0320 LET A ( 1

) =5

0330 LET B ( 1 , 1

) =1 . 25

0340 LET C (1 ) =6. 25

0350 LET D ( 1 , 1

) =A ( 1

) *B ( 1 , 1

)

0360 LET E ( 1

) =D (1,1) -C ( 1

)

0370 IF ABS (E (1) ) <=lE-5 THEN 390

0380 LET A $ = " * " 0390 PRINT " 5 0400 PRINT " * ="," 6.25 " , D ( 1 , 1 ) , E ( 1 ) ; A

$

0410 PRINT " 1.25

0420 PRINT

0430 LET A$ = " " 0440 LET A ( 2

) =21

0450 LET B(1,2)=-.47619E5

0460 LET C (2) =-999999

0470 LET D (1, 2) =A (2) *B (1 , 2)

0 480 LET E (2) =D (1, 2)-C (2)

0490 IF ABS (E (2) ) <=1E0 THEN 510

0500 LET A $ = " *

0510 PRINT " 21

0520 PRINT " * =","-999999 " , D ( 1 , 2 )

, E ( 2 ) ; A$

0530 PRINT "-.47619E5

0540 PRINT

0550 LET A$=" " 0560 LET A ( 3

) =-9 9 0570 LET B (2, 1) =-919100E-2

0580 LET C (3) =909909

0590 LET D ( 1 , 3

) =A ( 3

) * B ( 2 , 1

)

0600 LET E ( 3

) =D (1,3) — C ( 3

)

0610 IF ABS (E (3) ) <=1E0 THEN 630

0620 LET A $ = " *

0630 PRINT " -99

0640 PRINT " * =",“ 909909 " , D ( 1 , 3 )

, E ( 3 ) ; A

$

0650 PRINT " -919100E-2 " 0660 PRINT

0670 LET A$=" " 0680 LET A(4)=. 0015

0690 LET B ( 2 , 2) =6 . 25E4

0700 LET C (4 ) =93.75

0 7 10 LET D ( 2 , 1 =A ( 4

) *B ( 2 , 2

)

0 7 20 LET E ( 4

) =D ( 2 , 1

) -C ( 4

)

0730 IF ABS (E (4 ) ) < = lE-4 THEN 750

0 7 4 0 LET A $ = " *

0 7 50 PRINT " .0015

0760 PRINT " * ="," 93.75 " , D ( 2 , 1 ) , E ( 4 ) ; A

$

0 7

7

0 PRINT " 6.25E4

65
0780

0790

0800

0810

0820

0830

0840

0850

0860

0870

0880

0890

0900

0910

0920

0930

0940

0950

0960

0970

0980

0990

1000

1010

1020

1030

104 0 1050

1060

1070

1080

1090

1100

1110

1120

1130

1140

1150

1160

1170

1180

1190

1200

1210

1220

1230

1240

1250

1260

1270

1280

1290

1300

1310

1320

1330

1340

PRINT

LET A$ = " " LET A (5) =1 . 92

LET B (3, l)=6430E-4

LET C (5) =1. 23456

LET D ( 2 , 2 ) =A ( 5 ) * B ( 3 , 1

)

LET E ( 5 ) =D ( 2 , 2 ) -C ( 5 ) IF ABS (E (5) ) <=lE-5 THEN 870

LET A$=" *

PRINT " 1.92

PRINT " * = 1.23456 " ,D (2 , 2) , E (5 ) ;A$

PRINT " 6430E-4 " PRINT

LET A$ = " " LET A ( 6

) =10 . 631E27

LET B (3, 2) =-72000E5

LET C(6)=-7.65432E37

LET D ( 2 , 3

) =A ( 6

) *B ( 3 , 2

)

LET E ( 6 ) =D ( 2 , 3

) -C ( 6 ) IF ABS (E (6) ) <=1E32 THEN 990

LET A $ = " * " PRINT " 10.631E27

PRINT " * =" ,"- 7 .65432E37 " , D ( 2 , 3 )

, E (6 ) ; AS

PRINT "- 7 2000E5

PRINT

PRINT " END TEST."

PRINT

PRINT

PRINT

PRINT " PRINT

PRINT

PRINT " PRINT

PRINT " PRINT " PRINT " PRINT

PRINT " IF NO ASTERISK FOLLOWS ANY VALUE IN THE ABSOLUTE ERROR"

PRINT "COLUMN, TEST PASSED. HOWEVER, IF AN ASTERISK FOLLOWS"

PRINT "A VALUE IN THE ABSOLUTE ERROR COLUMN, TEST FAILED BE-"

PRINT "CAUSE SYSTEM WOULD HAVE FAILED THE ERROR BOUND ROUND-OFF OF"

PRINT "SIX PLACE ACCURACY."

PRINT

PRINT

PRINT "ASSIGNMENT 1"

PRINT " /

"

, "REQUIRED" , "QUOTIENT OF" , "ABSOLUTE"

PRINT "ASSIGNMENT 2

"

, "QUOTIENT" , " SYSTEM "," ERROR " PRINT

PRINT

DIM L ( 6 )

, M ( 2 , 9 ) ,N(6)

LET A$ = " " LET L ( 1

) =6 2

5

LET

- M (1 , 1) =1. 25

LET M (1 , 2) =500

LET M ( 1 , 3

) =L ( 1 ) /M (1,1)

LET N ( 1

) =M (1,3) —M (1,2)

BEGIN TEST."

SECTION 4

7 . 2

////////////"

/ DIVISION /"

////////////"

66
1350 IF ABS (N (1) ) < = lE-3 THEN 1370

1360 LET A$=" *

1370 PRINT " 625

1380 PRINT " / = 500 "

, M ( 1 , 3 ) ,N(1) ; A $

1390 PRINT " 1.25

1400 PRINT

1410 LET A$=" " 1420 LET L ( 2

) =8 4 . 87 6E

7

1430 LET M(l,4)=-6875

1440 LET M (1, 5) =-123456

1450 LET M(1,6)=L(2)/M(1,4)

1460 LET N ( 2

) =M ( 1 , 6

) -M ( 1 , 5

)

1470 IF ABS (N (2) ) <=1E0 THEN 1490

1480 LET A $ = " *

1490 PRINT " 84.876E7 " 1500 PRINT " /

=" , "-123456 " ,M ( 1 , 6) ,N (2 ) ;A$

1510 PRINT " -6875

1520 PRINT

1530 LET A $ = " " 1540 LET L(3) =-198765

1550 LET M ( 1 , 7

) =- 5E-20

1560 LET M(1,8)=39753E20

1570 LET M(1,9)=L(3)/M(1,7)

1580 LET N ( 3

) =M (1,9) -M (1,8)

1590 IF ABS (N (3) ) <=1E19 THEN 1610

1600 LET A $ = " *

1610 PRINT "-198765

1620 PRINT " /

= "," 3 . 9753E24 "

, M ( 1 , 9 ) , N ( 3 ) ; A $

1630 PRINT "-5E-20

1640 PRINT

1650 LET A $ = " " 1660 LET L ( 4

) =6 . 25

16"70 LET M (2, 1) =2. 5E-4

1680 LET M ( 2 , 2) =25000 .

0

1690 LET M (2, 3)=L(4)/M(2, 1)

1700 LET N (4) =M (2, 3) -M (2, 2)

1710 IF ABS (N (4 )

) <=1E-1 THEN 1730

1720 LET A$=" *

1730 PRINT " 6.25

1740 PRINT " / ="," 25000 " ,M(2, 3) ,N (4) ;A$

1750 PRINT " 2.5E-4

1760 PRINT

1770 LET A $ = " " 1780 LET L ( 5

) = . 1 728

1790 LET M (2, 4) =12E12

1800 LET M (2, 5) =144000E~19

1810 LET M (2, 6) =L (5) /M (2, 4)

1820 LET N (5) =M (2, 6) -M (2, 5)

1830 IF ABS (N (5) )

<

= 1E-19 THEN 1850

1840 LET A$=" *

1850 PRINT " .1728

1860 PRINT " /

= "," 1.44000E-14 " , M ( 2 , 6 ) , N ( 5 ) ; A$

1870 PRINT " 12E12

1880 PRINT

189 0 LET A

$= " " 1900 LET L (6 ) =-l . 25E-10

67
1910

1920

1930

1940

1950

1960

1970

1980

1990

2000

2010

2020

2030

2040

2050

2060

2070

2080

2090

2100

2110

2120

2130

2140

2150

2160

2170

2180

2190

2200

2210

2220

2230

2240

2250

2260

2270

2280

2290

2300

2310

2320

2330

2340

2350

2360

2370

2380

2390

2400

2410

2420

2430

2440

2450

2460

2470

LET M ( 2 , 7) =625E16

LET M (2, 8) =-2. 00000E-29

LET M(2,9)=L(6)/M(2,7)

LET N (6) =M (2, 9) -M (2, 8)

IF ABS (N (6) ) <=lE-34 THEN 1970

LET A$=" *

PRINT "-1.25E-10 " PRINT " /

=" , "-2. 00000E-29 "

# M(2,9) ,N (6) ;A$

PRINT " 625E16

PRINT

PRINT " END TEST."

PRINT

PRINT

PRINT

PRINT " BEGIN TEST."

PRINT

PRINT

PRINT " SECTION 47.3"

PRINT

PRINT " " PRINT " * INVOLUTION

PRINT " " PRINT

PRINT

PRINT

PRINT " IF NO ASTERISK FOLLOWS ANY VALUE IN THE ABSOLUTE ERROR"

PRINT "COLUMN, TEST PASSED. HOWEVER, IF AN ASTERISK FOLLOWS"

PRINT "A VALUE IN THE ABSOLUTE ERROR COLUMN, TEST FAILED BE-"

PRINT "CAUSE SYSTEM WOULD HAVE FAILED THE ERROR BOUND ROUND-OFF OF"

PRINT "SIX PLACE ACCURACY."

PRINT

PRINT

PRINT "ASSIGNMENT 1"

PRINT " * ", "REQUIRED" , "POWER OF" , "ABSOLUTE"

PRINT "ASSIGNMENT 2"," POWER "," SYSTEM "

, " ERROR " PRINT

PRINT

DIM I (6) , J (2, 9) ,K (6)

LET A$ = " " LET I (1 ) =144

LET J (1 , 1) = . 5 LET J (1 , 2) =12

LET J (1 , 3) =1 (1 ) (1,1)

LET K ( 1

) =J (1 , 3) -J (1,2)

IF ABS (K (1 )) < = lE-4 THEN 2370

LET a $ = " * " PRINT "144

PRINT " “ =" ," 12 " ,J(1,3) ,K(1) ;A$

PRINT " .5

PRINT

LET A

$= " " LET I (2) =5

LET J (1 , 4) =-. 004E3

LET J (1 , 5) =1. 6E-3

LET J (1 , 6) =1 (2) (1 , 4)

LET K ( 2

) =J ( 1 , 6

) -J (1,5)

IF ABS (K (2) ) <=lE-8 THEN 2490

68
2480

2490

2500

2510

2520

2530

2540

2550

2560

2570

2580

2590

2600

2610

2620

2630

2640

2650

2660

2670

2680

2690

2700

2710

2720

2730

2740

2750

2760

2770

2780

2790

2800

2810

2820

2830

2840

2850

2860

2870

2880

2890

2900

2910

2920

2930

2940

2950

2960

2970

2980

2990

3000

3010

3020

3030

3040

LET A$=" *

PRINT " 5 PRINT " ~ = "," .0016 " ,J (1, 6) ,K (2) ;A$

PRINT " - . 004E

3

PRINT

LET A $ = " " LET I (3) =65536

LET J (1,7) =-625E-4

LET J ( 1 , 8

) =5E-1

LET J ( 1 , 9

) =1 ( 3 ) ~ J (1,7)

LET K (3 ) =J (1 , 9

) -J (1,8)

IF ABS (K (3) ) <=lE-6 THEN 2610

LET A $ = " *

PRINT " 65536

PRINT " * ="," .5 ",J (1,9) ,K(3) ;A$

PRINT "-625E-4

PRINT

LET A$ = " " LET I (4) =. 03125

LET J (2 , 1) =-. 0002E3

LET J (2, 2) =2

LET J (2 , 3) =1 (4 ) ~ J (2,1)

LET K(4)=J (2,3)-J (2,2)

IF ABS (K (4) ) <=lE-5 THEN 2730

LET A$=" *

PRINT " .03125

PRINT " “ = "," 2 ",J (2,3) ,K(4) ;A$

PRINT 0002E3

PRINT

LET A$=" " LET I (5) =1.

2

LET J (2,4)=5000E-3

LET J (2, 5) =2.48832

LET J (2 , 6

) =1 ( 5 ) ~ J (2,4)

LET K (5 ) =J (2 , 6) -J (2,5)

IF ABS (K (5) ) < = lE-5 THEN 2850

LET A$ = " * ° PRINT "1.2

PRINT " “ ="," 2.48832 ",J (2,6) ,K(5) ;A$

PRINT " 5000E-3

PRINT

LET A $ = " " LET I (6) =1 . 024E13

LET J (2,7) =-10E-2

LET J (2, 8) =5E-2

LET J ( 2 , 9

) =1 (6) ~ J (2,7)

LET K ( 6

) =J (2 , 9

) -J (2,8)

IF ABS (K (6) )

<

= lE-7 THEN 2970

LET A $ = " *

PRINT " 1.024E13 " PRINT " * ="," .05 " , J ( 2 , 9 )

, K ( 6 ) ; A $

PRINT " -10E-2

PRINT

PRINT " END TEST."

PRINT

PRINT

END

69
*****************

* SAMPLE OUTPUT * *****************

PROGRAM FILE 47

BEGIN TEST.

SECTION 47.1

XXXXXXXXXXXXXXXXXX

X MULTIPLICATION X XXXXXXXXXXXXXXXXXX

IF NO ASTERISK FOLLOWS ANY VALUE IN THE ABSOLUTE ERROR

COLUMN, TEST PASSED. HOWEVER, IF AN ASTERISK FOLLOWS

A VALUE IN THE ABSOLUTE ERROR COLUMN, TEST FAILED BECAUSE SYSTEM WOULD HAVE FAILED THE ERROR BOUND ROUND-OFF OF

SIX PLACE ACCURACY.

ASSIGNMENT 1

* REQUIRED

ASSIGNMENT 2 PRODUCT

PRODUCT OF ABSOLUTE

SYSTEM ERROR

5

* 1.25

21

* - . 47619E5

6.25

-999999

6.25

-999999

0

0

-99

* -91 9100E-2

. 0015

* 6. 25E4

1.92

* 6430E-4

10. 631E27

* -72000E5

909909 „ 909909 0

93.75 93.75 0

1.23456 1.23456 0

-7.65432E37 -7.65432E+37 0

70
END TEST

BEGIN TEST.

SECTION 47.2

////////////

/ DIVISION /

////////////

IF NO ASTERISK FOLLOWS ANY VALUE IN THE ABSOLUTE ERROR

COLUMN, TEST PASSED. HOWEVER, IF AN ASTERISK FOLLOWS

A VALUE IN THE ABSOLUTE ERROR COLUMN, TEST FAILED BECAUSE SYSTEM WOULD HAVE FAILED THE ERROR BOUND ROUND-OFF OF

SIX PLACE ACCURACY.

ASSIGNMENT 1 / REQUIRED

ASSIGNMENT 2 QUOTIENT

QUOTIENT OF ABSOLUTE

SYSTEM ERROR

625

/ = 500 500 0 1.25

84.876E7

/

= -123456 -123456 0 -6875

-198765

/ = 3 . 9753E24 3.97530E+24 0 -5E-20

6.25

/ = 25000 25000 0 2. 5E-4

.1728

/ = 1 . 44000E-14 1 . 44000E-14 0 12E12

-1. 25E-10

/

= -2 . 00000E-29 -2 . 00000E-29 0 625E16

END TEST.

BEGIN TEST.

SECTION 47.3

71
INVOLUTION

IF NO ASTERISK FOLLOWS ANY VALUE IN THE ABSOLUTE ERROR

COLUMN, TEST PASSED. HOWEVER, IF AN ASTERISK FOLLOWS

A VALUE IN THE ABSOLUTE ERROR COLUMN, TEST FAILED BECAUSE SYSTEM WOULD HAVE FAILED THE ERROR BOUND ROUND-OFF OF

SIX PLACE ACCURACY.

ASSIGNMENT 1 REQUIRED POWER OF

ASSIGNMENT 2 POWER SYSTEM

ABSOLUTE

ERROR

144

. 5

5

. 004E3

65536

625E-4

. 03125

. 0002E3

1.2

5000E-3

1. 024E13

-10E-2

12

. 0016

. 5

2

2.48832

. 05

12

. 0016

.5

2

2.48832

. 05

0

0

0

0

0

0

END TEST.

72
48.0

ADDITION OF MORE THAN TWO TERMS CONTAINING

ARRAY ELEMENTS

The objective of this section is to continue the testing of standard

conforming numerical expressions. In particular, in this case we exercise

the addition of several terms involving array elements. From previous tests

we can have confidence in the addition operation on two terms. Here we are extending the capability one more step.

48.1

Using Subscripted Variables

The objective of this test is the same as in section 28.2, except in

this test the numerical constants have been assigned to subscripted variables

instead of simple variables. In this section two expressions are computed,

one with five and the other with six terms. They combine single- and

double-dimensional arrays. The output is similar to section 28.2.

48.2

Mixing Constants, and Variables

The objective of this test is the same as in section 28.3, except in

this test subscripted variables are used along with the numerical constants

and simple variables to construct numerical expressions. Two expressions are computed, one with seven and the other with eight terms. Constants, simple

variables and arrays are combined to form the expressions.

*******************

* PROGRAM FILE 48 * *******************

0010 PRINT

0060 PRINT

0070 PRINT

0080 PRINT

0090 PRINT

0100 PRINT

0110 PRINT

0120 PRINT

0130 PRINT

0140 PRINT

0150 PRINT

0160 PRINT

0170 PRINT

0180 PRINT

0190 PRINT

0200 PRINT

0210 PRINT

"PROGRAM FILE 48"

SECTION 48.0"

ADDITION OF MORE THAN TWO TERMS."

" BEGIN TEST."

" IF NO ASTERISK FOLLOWS ANY VALUE IN THE ABSOLUTE ERROR"

"COLUMN, TEST PASSED. HOWEVER, IF AN ASTERISK FOLLOWS"

"A VALUE IN THE ABSOLUTE ERROR COLUMN, TEST FAILED BE-"

"CAUSE SYSTEM WOULD HAVE FAILED THE ERROR BOUND ROUND-OFF OF"

"SIX PLACE ACCURACY."

73
0220

0230

0240

0250

0260

0270

0280

0290

0300

0310

0320

0330

0340

0350

0360

0370

0380

0390

0400

0410

0420

0430

0440

0450

0460

0470

0480

0490

0500

0510

0520

0530

0540

0550

0560

0570

0580

0590

0 6 0 0 0610

0620

0630

0640

0650

0660

0670

0680

0690

0700

0710

0720

0730

0740

0750

0760

0770

0780

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

DIM 0(6,2) , P (10

)

LET A$= " " LET P (1) = 2 .4

LET 0 (1, 1) =23.05

LET P (2) =230.004

LET 0 (1, 2) =432.1

LET P (3) =300.1

LET 0 (2, 1) = 314

LET P (4) = 8 4E-2

LET 0 (2, 2) =. 5E-2

LET 0 (3, 1) =-987.654

LET P (5) =P (1)+0(1,1 ) +P ( 2

)

+0(1

LET 0 (3, 2) =P (5 ) +0 (

3

,1)

IF ABS (0 (3 ,2) )<=1E- 3 THEN 510

LET A $ = " *

PRINT " 5 "," 987.654 " ,P(5) ,0(3,2) ; A $

LET A$=" " LET 0(4,1) =-999 . 999

LET 0 ( 4 , 2 ) =0 ( 1 , 1 ) +P ( 2 ) +0 ( 1 , 2 ) +0 ( 2 , 1 ) +P ( 4 ) +0 ( 2 , 2

)

LET P (6) =0(4, 2) +0(4,1)

IF ABS (P (6 )) <= IE-3 THEN 580

LET A $ = " *

PRINT H 6 "," 999.999 " ,0 (4 , 2) ,P (6) ;A$

PRINT

PRINT

PRINT 11 • PRINT '* ***************"

PRINT

PRINT

PRINT " SECTION 48.2"

PRINT

PRINT " MIXING"

PRINT "NUMERICAL CONS/NUMERICALLY ASSIGNED SIMPLE/SUBSCRIPTED VARS"

PRINT " TOGETHER."

PRINT

PRINT

LET A$=" " LET Ql=110000

LET P (7 ) =10 . 1E7

LET Q2=7.4E8

LET O (5 , 1

) =8E9

LET Q3=1.6E32

LET P ( 8

) =1 . 2E 34

"NUMBER OF" , "REQUIRED” , "SUM OF" , "ABSOLUTE"

" TERMS "," SUM ", "SYSTEM"," ERROR " "**************************************************".

"A*********************"

SECTION 48.1"

USING"

NUMERICALLY ASSIGNED SUBSCRIPTED VARIABLES."

7 •+
0790

0800

0810

0820

0830

0840

0850

0860

0870

0880

0890

0900

0910

0920

0930

0940

0950

0960

0970

0980

LET 0 (5, 2)=1. 0E36

LET P ( 9

) =Q 3+1 . 3E33+P (8 ) +10 0 . IE 33 + 100 . 0E33+O (5, 2) +2, 1E34

LET 0(6,l)=P(9)+(-1.23456E36)

IF ABS (0 (6, 1) ) < = 1E31 THEN 840

LET A$=" *

PRINT " 7 1. 23456E36 " , P ( 9 ) , 0 ( 6 , 1 ) ; A$

LET A$=" " LET 0(6,2) =80000. 0+Q1+58E5+P (7 ) +5 . 3E 7+Q2 + 1 . IE 9+0 ( 5 , 1

)

LET P(10)=O(6,2) + (-9.99999E9)

IF ABS (P (10) ) < = 1E4 THEN 900

LET A$= " *

PRINT " 8 9 . 99999E9 " ,0 (6 , 2) ,P (10) ;A§

PRINT

PRINT

PRINT W ************************************************** M • PRINT "** * ******* * ** * * ****** •• PRINT

PRINT " END TEST."

PRINT

END

*****************

* SAMPLE OUTPUT * *****************

PROGRAM FILE 48

SECTION 48.0

ADDITION OF MORE THAN TWO TERMS.

BEGIN TEST.

IF NO ASTERISK FOLLOWS ANY VALUE IN THE ABSOLUTE ERROR

COLUMN, TEST PASSED. HOWEVER, IF AN ASTERISK FOLLOWS

A VALUE IN THE ABSOLUTE ERROR COLUMN, TEST FAILED BECAUSE SYSTEM WOULD HAVE FAILED THE ERROR BOUND ROUND-OFF OF

SIX PLACE ACCURACY.

NUMBER OF REQUIRED SUM OF ABSOLUTE

TERMS SUM SYSTEM ERROR ************************************************************************

75
SECTION 48.1

USING

NUMERICALLY ASSIGNED SUBSCRIPTED VARIABLES.

5 987.654 987.654 0 6 999.999 999.999 0

************************************************************************

SECTION 48.2

MIXING

NUMERICAL CONS/NUMERICALLY ASSIGNED SIMPLE/SUBSCRIPTED VARS

TOGETHER.

7 1. 23456E36 1.23456E+36 0

8 9 . 99999E9 9.99999E + 9 0

****************** a*****************************************************

END TEST.

76
49.0

MULTIPLICATION OF MORE THAN TWO TERMS

This section continues the testing of standard conforming numerical

expressions

.

49.1

Using Subscripted Variables

The objective of this test is the same as in section 29.2, except in

this test the numerical constants have been assigned to subscripted variables

instead of simple variables. Two expressions of five and six factors each

are computed. The output is similar to that of section 29.2.

49.2

Mixing Constants and Variables

The objective of this test is the same as in section 29.3, except in

this test subscripted variables along with numerical constants and simple

variables are used in the construction of numerical expressions. Two

expressions of seven and eight terms respectively are computed. The output

is similar to that of section 29.3.

ft******************

* PROGRAM FILE 49 *

0010 PRINT

0060 PRINT

0070 PRINT

0080 PRINT

0090 PRINT

0100 PRINT

0110 PRINT

0120 PRINT

0130 PRINT

0140 PRINT

0150 PRINT

0160 PRINT

0170 PRINT

0180 PRINT

0190 PRINT

0200 PRINT

0210 PRINT

0220 PRINT

0230 PRINT

0240 PRINT

0250 PRINT

0260 PRINT

"PROGRAM FILE 49"

SECTION 49.0"

MULTIPLICATION OF MORE THAN TWO TERMS."

" BEGIN TEST."

" IF NO ASTERISK FOLLOWS ANY VALUE IN THE ABSOLUTE ERROR"

"COLUMN, TEST PASSED. HOWEVER, IF AN ASTERISK FOLLOWS"

"A VALUE IN THE ABSOLUTE ERROR COLUMN, TEST FAILED BE-"

"CAUSE SYSTEM WOULD HAVE FAILED THE ERROR BOUND ROUND-OFF OF"

"SIX PLACE ACCURACY."

"NUMBER OF" , "REQUIRED" , "PRODUCT OF" , "ABSOLUTE"

" TERMS "/'PRODUCT "," SYSTEM " , " ERROR " -

77
0270

0280

0290

0300

0310

0320

0330

0340

0350

0360

0370

0380

0390

0400

0410

0420

0430

0440

0450

0460

0470

0480

0490

0500

0510

0520

0530

0540

0550

0560

0570

0580

0590

0600

0610

0620

0630

0640

0650

0660

0670

0680

0690

0700

0710

0720

0730

0740

0750

0760

0770

0780

0790

0800

0810

0820

0830

PRINT "**********************”

PRINT

PRINT

PRINT " SECTION 49.1"

PRINT

PRINT ” USING"

PRINT " NUMERICALLY ASSIGNED SUBSCRIPTED VARIABLES."

PRINT

PRINT

DIM Q (13) , R ( 3 , 4

)

LET A

$= " " LET Q (1 ) =1 .

5

LET R( 1,1) =0.2

LET Q ( 2

) =3 .

7

LET R(l,2)=2.0

LET Q ( 3

) =2 . 557

LET R (1 , 3) =3367

LET Q (4 ) =3E-11

LET R (1 , 4) =. 14

LET Q (5) =. 35E34

LET R (2 , 1

) =2E-11

LET Q ( 6 ) = .

1

LET R(2,2)=-5. 67654

LET Q(7)=-9.89898E13

LET R (2 , 3) =Q (1 ) *R (1 , 1) *Q (2) *R (1 , 2) *Q (3

)

LET Q (8 ) =R (2,3) +R (2,2)

IF ABS (Q (8) ) < = lE-5 THEN 550

LET a $ = " *

PRINT " 5 ", " 5.67654 " , R ( 2 , 3 ) , Q ( 8 ) ; A

$

LET A

$= " " LET Q (9) =R (1 , 3) *Q (4 ) *R (1 , 4) *Q (5) *R (2, 1 ) *Q (6)

LET R (2, 4) =Q (9) +Q (7)

IF ABS (R(2, 4) ) <=1E8 THEN 610

LET A $ = " * " PRINT " 6 "," 9 . 89898E13 "

, Q ( 9 ) , R ( 2 , 4 ) ; A

§

PRINT

PRINT

PRINT "**************************************************" • PRINT M ********************** M PRINT

PRINT

PRINT " SECTION 49.2"

PRINT

PRINT " MIXING"

PRINT "NUMERICAL CONS/NUMERICALLY ASSIGNED SIMPLE/SUBSCRIPTED VARS"

PRINT " TOGETHER."

PRINT

PRINT

LET A $ = “ " LET S 1=1 . 5E-5

LET Q(10)=0.8E20

LET S 2 = 64 . 3E8

LET R ( 3 , 1

) =2 . 0E-6

LET S 3 = 3 LET Q ( 11 ) =6 . 25

LET S4=10101

LET R(3,2)=l.l

78
0840

0850

0860

0870

0880

0890

0900

0910

0920

0930

0940

0950

0960

0970

0980

0990

1000

1010

1020

1030

LET Q (12)=S1*.2E8*Q (10) *.4E-10*S2*. 1E-5*R(3, 1)

LET R(3/3)=Q(12)+(-1.23456El0)

IF ABS (R(3, 3) ) <=1E5 THEN 880

LET A $ = " *

PRINT " 7 1 . 23456E10 " ,Q (12) , R (3 , 3) ;A$

LET A?=" " LET R (3, 4) =37 5E10*S3*1. 6E-12*Q ( 1 1

) *4E 21 *S 4 * . 2E-1 0 *R ( 3 , 2

)

LET Q(13)=R(3,4)+(-9.99999El6)

IF ABS (Q (13) ) < = 1E11 THEN 940

LET A$= " *

PRINT " 8 9.99999E16 " , R ( 3 , 4 ) , Q (1 3 ) ; A$

PRINT

PRINT

PRINT "^^t************************************************** • PRINT " ***********************

PRINT

PRINT " END TEST."

PRINT

PRINT

END

*****************

* SAMPLE OUTPUT * *****************

PROGRAM FILE 49

SECTION 49.0

MULTIPLICATION OF MORE THAN TWO TERMS.

BEGIN TEST.

IF NO ASTERISK FOLLOWS ANY VALUE IN THE ABSOLUTE ERROR

COLUMN, TEST PASSED. HOWEVER, IF AN ASTERISK FOLLOWS

A VALUE IN THE ABSOLUTE ERROR COLUMN, TEST FAILED BECAUSE SYSTEM WOULD HAVE FAILED THE ERROR BOUND ROUND-OFF OF

SIX PLACE ACCURACY.

NUMBER OF REQUIRED PRODUCT OF ABSOLUTE

TERMS PRODUCT SYSTEM ERROR ************************************************************************

79
SECTION 49.1

USING

NUMERICALLY ASSIGNED SUBSCRIPTED VARIABLES.

5 5.67654 5.67654 0

6 9.89898E13 9.89898E+13 0

************************************************************************

SECTION 49.2

MIXING

NUMERICAL CONS/NUMERICALLY ASSIGNED SIMPLE/SUBSCRIPTED VARS

TOGETHER.

7 1.23456E10 1.23456E+10 0

8 9.99999E16 9.99999E+16 0

************************************************************************

END TEST.

80
50.0

HIERARCHY OF OPERATORS AND PARENTHESES

The objective of this section is to reconstruct test section 30.0 with

subscripted variables. This continues the testing of standard conforming

numerical expressions.

50.1

Operators of Equal Priority

The objective of this test is the same as in section 30.1, except in

this test the constants have been assigned to subscripted variables. There

are five exercises in this test: lef t-to-r ight division, lef t-to-r ight

subtraction, lef t-to-r ight involution, lef t-to-r ight subtraction and

addition, and finally lef t-to-r ight division and multiplication. The output

is similar to section 30.1.

50.2

Operators of Different Priorities without Parentheses

The objective of this test is the same as in test section 30.2, except

in this test all numerical constants have been assigned to subscripted

variables. In this part of the program there are three exercises to first

test multiplication over addition or subtraction, division over addition or subtraction, and finally to test that involution takes precedence over all

other operators. The output is similar to section 30.2.

50.3

Operators of Different Priorities with Parentheses

The objective of this test is the same as in section 30.3, except in

this test all numerical constants have been assigned to subscripted

variables. In this test, there are two sets of exercises. The first employs

simple expressions that use parentheses and finally there is an exercise

using more complex expressions. The output is similar to section 30.3.

*******************

* PROGRAM FILE 50 * *******************

0010 PRINT

0060 PRINT

0070 PRINT

0080 PRINT

0090 PRINT

0100 PRINT

0110 PRINT

0120 PRINT

0130 PRINT

"PROGRAM FILE 50"

" SECTION 50.0: HIERARCHY OF OPERATORS AND PARENTHESES."

" SINCE THIS TEST IS ONLY CONCERNED WITH THE ORDER OF"

"OPERATIONS, THE SELECTED NUMBERS USED FOR THIS TEST ARE IN"

81
0140 PRINT

0150 PRINT

0160 PRINT

0170 PRINT

0180 PRINT

0190 PRINT

0200 PRINT

0210 PRINT

0220 PRINT

0230 PRINT

0240 PRINT

0250 PRINT

0260 PRINT

0270 PRINT

0280 PRINT

0290 PRINT

0300 PRINT

0310 PRINT

0320 PRINT

0330 PRINT

0340 PRINT

0350 PRINT

0360 PRINT

0370 PRINT

0380 PRINT

0390 PRINT

0400 DIM S (28) ,T (11, 3)

0410 LET A$="PASSED"

0420 LET S (1) =81

0430 LET T (1, 1) =9

0440 LET S (2) =3

0450 LET T (1, 2) =23

0460 LET S (3) =13

0470 LET T ( 1 , 3

) =2

0480 LET S ( 4

) =S ( 1 ) /T ( 1 , 1 ) /S ( 2

)

0490 LET S (5 ) =S (4)-3

0500 IF ABS (S (5) ) <=lE-5 THEN 520

0510 LET A$=" FAILED"

0520 PRINT TAB (18) , "DIVISION" ;TAB (40) ,A$

0530 PRINT

0540 LET A$="PASSED"

0550 LET T(2,1)=T(1,2)-S(3)-T(1,3)

0560 LET T (2, 2) =T (2, 1) -8

0570 IF ABS (T (2, 2) ) < = lE-5 THEN 590

0580 LET A$="FAILED"

0590 PRINT TAB (18) , "SUBTRACTION" ;TAB (40) ,A$

0600 PRINT

0610 LET A$="PASSED"

0620 LET T(2,3)=T(1,1)~S(2)T(1,3)

0630 LET T (3, 1) =T (2, 3) -531441

0640 IF ABS (T(3,1))<=1E0 THEN 660

0650 LET A$="FAILED"

0660 PRINT TAB (18) , "EXPONENTIATION" ;TAB (40) ,A$

0670 PRINT

0680 LET A$="PASSED"

0690 LET S ( 6

) =T ( 1 , 2

) -S ( 3 ) +T ( 1 , 3

)

0700 LET S (7) =S (6) -12

"INTEGER FORM ONLY."

" SECTION 50.1"

LEFT TO RIGHT EVALUATION FOR EXPRESSIONS WITH OPERA-"

"TORS OF EQUAL PRIORITY, USING ASSIGNED SUBSCRIPTED VARIA-"

"BLES.

" * * * * *NOTE : LEFT TO RIGHT EVALUATION FOR EXPRESSIONS WITH"

"OPERATORS OF ONLY ADDITION OR MULTIPLICATION DOES NOT NEC-"

"ESSARILY APPLY, THEREFORE, SUCH EXPRESSIONS ARE NOT TESTED"

"IN THIS TEST.*****"

" BEGIN TEST."

TAB (18) , "OPERATOR (S ) ";TAB(40) , " EVALUATION

TAB (18)," OF " ;TAB (40) , " OF

TAB (18) , "EXPRESSION ";TAB(40)," SYSTEM " •I***************************************************.

§

82
0710

0720

0730

0740

0750

0760

0770

0780

0790

0800

0810

0820

0830

0840

0850

0860

0870

0880

0890

0900

0910

0920

0930

0940

0950

0960

0970

0980

0990

1000

1010

1020

1030

1040

1050

1060

1070

1080

1090

1100

1110

1120

1130

1140

1150

1160

1170

1180

1190

1200

1210

1220

1230

1240

1250

1260

1270

IF ABS (S (7) ) <=lE-4 THEN 730

LET A$=" FAILED"

PRINT TAB (18) , " SUBTRACTION

PRINT TAB (18) , " AND " ; TAB ( 4 0 ) , A$

PRINT TAB (18)," ADDITION " PRINT

LET A$ = " PASSED"

LET T (3 , 2) =S (1 ) /T (1 , 1 ) *S (2 ) LET T (3, 3) =T (3, 2)-27

IF ABS(T(3,3) ) <=lE-4 THEN 820

LET A$="FAILED"

PRINT TAB (18) , " DIVISION

PRINT TAB (18) , " AND ",TAB(40),A$

PRINT TAB (18) , "MULTIPLICATION"

PRINT

PRINT " END TEST."

PRINT

PRINT

PRINT " SECTION 50.2"

PRINT

PRINT " EVALUATION OF THE PRECEDENCE OF OPERATORS FOR EXPRES-"

PRINT " SIONS WHICH CONTAIN OPERATORS OF DIFFERENT PRIORITIES IN"

PRINT "THE ABSENCE OF PARENTHESES, USING ASSIGNED SUBSCRIPTED VAR-"

PRINT " IABLES .

PRINT

PRINT

PRINT " BEGIN TEST."

PRINT

PRINT TAB (21) , "PRIORITY" ; TAB ( 5 1 ) /’EVALUATION"

PRINT TAB ( 24 ) , "OF " ; TAB ( 5 5 ) ,"OF"

PRINT TAB (21) , "OPERATOR" ; TAB ( 5 3 ) , "SYSTEM"

PRINT **************************************************** *' • PRINT 11 **********************”

PRINT

PRINT

LET A$="PASSED"

LET T (4 , 1

) =7

LET S ( 8

) =20

LET T (4 , 2) =100

LET S ( 9

) =72

LET T (4 , 3) =6

LET S (10) =10

LET T(5,l)=ll

LET S (11)=S (1)+T (1, 3) *S (2)-T (4,1)+S (8)

LET S (12 ) =S (11) -100

IF ABS (S (12) ) < = lE-3 THEN 1180

LET A$=" FAILED"

PRINT TAB (18) /’MULTIPLICATION"

PRINT TAB ( 22 ) /' BEFORE " ; TAB ( 5 3 ) ,A$

PRINT TAB (11) , "ADDITION OR SUBTRACTION"

PRINT

LET A

$= " PASSED"

LET T ( 5 , 2

) =T ( 4 , 2 ) +S ( 9 ) /T ( 1 , 1

) -S ( 2) -T ( 4 , 3

)

LET T ( 5 , 3 ) =T ( 5 , 2 ) - 9 9 IF ABS (T (5, 3) ) <=lE-4 THEN 1270

LET A$=" FAILED"

PRINT TAB (21) , "DIVISION"

83
1280

1290

1300

1310

1320

1330

1340

1350

1360

1370

1380

1385

1390

1400

1410

1420

1430

1440

1450

1460

1470

1480

1490

1500

1510

1520

1530

1540

1550

1560

1570

1580

1590

1600

1610

1620

1630

1640

1650

1660

1670

1680

1690

1700

1710

1720

1730

1740

1750

1760

1770

1780

1790

1800

1810

1820

1830

PRINT TAB (22) /’BEFORE" ;TAB (53) ,A$

PRINT TAB (11) , "ADDITION OR SUBTRACTION"

PRINT

LET A$="PASSED"

LET F = 0 LET T(6,3)=S (10)+T(4,2) *T (1, 3)-T(5,l)

LET T(7,l)=T(6,3)-9999

IF ABS (T (7, 1) ) < = lE-2 THEN 1380

LET F=1

PRINT "EXPONENTIATION BEFORE ADDITION OR SUBTRACTION FAILED."

LET S (13) =T (4, 1) *S (2 ) *T (1 , 3) /T (1 , 1

)

LET S (14) = S (13) - 7 IF ABS (S (14) ) < = lE-5 THEN 1420

LET F=1

PRINT "EXPONENTIATION BEFORE MULTIPLICATION OR DIVISION FAILED."

LET T(7,2)=-S(1)~T(1,3)

LET T(7,3)=T(7,2)-(-6561)

IF ABS (T(7,3))< = lE-2 THEN 1470

LET F =1

PRINT "EXPONENTIATION BEFORE UNARY FAILED."

IF F=0 THEN 1490

GOTO 1520

PRINT TAB (18) /’EXPONENTIATION"

PRINT TAB (19) /'AS FIRST OF " ; TAB ( 5 3 )

, A$

PRINT TAB (20) /’OPERATIONS"

PRINT

PRINT " END TEST."

PRINT

PRINT

PRINT " SECTION 50.3"

PRINT

PRINT " EVALUATION OF THE PRECEDENCE OF OPERATIONS FOR THOSE"

PRINT "EXPRESSIONS WHICH CONTAIN OPERATORS OF DIFFERENT PRIORITIES"

PRINT "BUT ARE INFLUENCED BY THE USE OF PARENTHESES, USING AS-"

PRINT "SIGNED SUBSCRIPTED VARIABLES."

PRINT

PRINT

PRINT ’’ BEGIN TEST."

PRINT

PRINT TAB (14) , "ALTERATION OF PRIORITY TAB ( 5 1 )," EVALUATION"

PRINT TAB (24) , " B

Y

" ; TAB (55) , " OF

PRINT TAB (19) , "PARENTHESES" ;TAB (53) , "SYSTEM"

PRINT "**************************************************"•

PRINT " **********************"

PRINT

PRINT

LET F=0

LET S (15) =4

LET T (8 , 1) =92

LET S (16) =725

LET T ( 8 , 2

) =27

4

LET S (17) =1998

LET T (8 , 3) =27

LET T(9,1)=S(1)/(T(1, 1)/S(2) ) LET T ( 9 , 2

) =T ( 9 , 1

) -2?

IF ABS (T (9, 2) ) <=lE-4 THEN 1840

LET F=1

81*
1840 LET S(18)=T(1,2)-(S(3)-T(1,3) ) 1850 LET S (19) =S (1 8

) -12

1860 IF ABS (S (19) ) <=lE-4 THEN 1880

1870 LET F = 1 1880 LET S (20) =S (15) " (S (2)T (1 , 3)

)

1890 LET S (21)=S (20)-262144

1900 IF ABS (S (21) ) <=1E0 THEN 1920

1910 LET F=1

1920 LET T(9,3)=T(1,2)-(S(3)+T(1,3))

1930 LET T ( 1 0 , 1

) =T (9,3) — 8 1940 IF ABS (T (10, 1) ) <=lE-5 THEN 1960

1950 LET F=1

1960 LET S(22)=S(1)/(T(1,1)*S(2) ) 1970 LET S (23) =S (22) -3

1980 IF ABS (S (23) ) < = lE-5 THEN 2000

1990 LET F=1

2000 IF F=0 THEN 2030

2010 LET A $=" UNSUCCESSFUL"

2020 GOTO 2040

2030 LET A $=" SUCCESSFUL"

2040 PRINT TAB (18) EXPRESSIONS OF"

2050 PRINT TAB (18) , "LEFT TO RIGHT" ; TAB ( 5 1 )

, A$

2060 PRINT TAB (20) , "EVALUATION"

2070 PRINT

2080 LET F=0

2090 LET T (10,2) = (S (1)+T (1, 3) ) * (S (2)-T (4, 1) ) 4-S (8)

2100 LET T(10,3)=T(10,2)-(-312)

2110 IF ABS (T (10, 3) ) <=lE-3 THEN 2130

2120 LET F=1

2130 LET S (24) = (T(4,2)+T(8,1) ) / (T (1 , 1 ) -S (2) ) -T (4 , 3

)

2140 LET S (25) =S (24) -26

2150 IF ABS (S (25) ) <=lE-4 THEN 2170

2160 LET F=1

2170 LET S (26) = (S (16)+T(8, 2) ) ~ (S (15)-T (1, 3) ) +S (17)

2180 LET S (27)=S (26)-999999

2190 IF ABS (S (27) ) <=1E0 THEN 2210

2200 LET F=1

2210 LET T(11,1) = (T(5,1)*S(2))~(T(1,1)/S(2))/T(8,3)

2220 LET T (11, 2) =T (11, 1) -1331

2230 IF ABS (T (11, 2) ) <=lE-2 THEN 2250

2240 LET F=1

2250 LET T (11, 3) = (-S (1)

) ~T (1, 3)

2260 LET S (28)=T(11,3)-6561

2270 IF ABS (S (28) ) <=lE-2 THEN 2290

2280 LET F=1

2290 IF F=0 THEN 2320

2300 LET A $=" UNSUCCESSFUL"

2310 GOTO 2330

2320 LET A $= "SUCCESSFUL"

2330 PRINT TAB (14) , "EXPRESSIONS EVALUATED"

2340 PRINT TAB (18) , " BY PRIORITY OF" ; TAB ( 5 1 ) , A$

2350 PRINT TAB (19) , "THE OPERATOR"

2360 PRINT

2370 PRINT " END TEST."

2380 PRINT

2390 PRINT

2400 END

85
*****************

* SAMPLE OUTPUT * *****************

PROGRAM FILE 50

SECTION 50.0: HIERARCHY OF OPERATORS AND PARENTHESES.

SINCE THIS TEST IS ONLY CONCERNED WITH THE ORDER OF

OPERATIONS, THE SELECTED NUMBERS USED FOR THIS TEST ARE IN

INTEGER FORM ONLY.

SECTION 50.1

LEFT TO RIGHT EVALUATION FOR EXPRESSIONS WITH OPERATORS OF EQUAL PRIORITY, USING ASSIGNED SUBSCRIPTED VARIABLES .

* * * * *NOTE : LEFT TO RIGHT EVALUATION FOR EXPRESSIONS WITH

OPERATORS OF ONLY ADDITION OR MULTIPLICATION DOES NOT NECESSARILY APPLY, THEREFORE, SUCH EXPRESSIONS ARE NOT TESTED

IN THIS TEST.*****

BEGIN TEST.

OPERATOR (S) EVALUATION

OF OF

EXPRESSION SYSTEM ************************************************************************

DIVISION PASSED

SUBTRACTION PASSED

EXPONENTIATION PASSED

SUBTRACTION

AND PASSED

ADDITION

DIVISION

AND PASSED

MULTIPLICATION

86
END TEST

SECTION 50.2

EVALUATION OF THE PRECEDENCE OF OPERATORS FOR EXPRESSIONS WHICH CONTAIN OPERATORS OF DIFFERENT PRIORITIES IN

THE ABSENCE OF PARENTHESES, USING ASSIGNED SUBSCRIPTED VARIABLES.

BEGIN TEST.

PRIORITY

OF

OPERATOR

EVALUATION

OF

SYSTEM

kicicisie-k-k'kicic’k'k'kicic'kic'k

MULTIPLICATION

BEFORE PASSED

ADDITION OR SUBTRACTION

DIVISION

BEFORE PASSED

ADDITION OR SUBTRACTION

EXPONENTIATION

AS FIRST OF PASSED

OPERATIONS

END TEST.

SECTION 50.3

EVALUATION OF THE PRECEDENCE OF OPERATIONS FOR THOSE

EXPRESSIONS WHICH CONTAIN OPERATORS OF DIFFERENT PRIORITIES

BUT ARE INFLUENCED BY THE USE OF PARENTHESES, USING ASSIGNED SUBSCRIPTED VARIABLES.

BEGIN TEST.

ALTERATION OF PRIORITY EVALUATION

BY OF

PARENTHESES SYSTEM ************************************************************************

EXPRESSIONS OF

LEFT TO RIGHT SUCCESSFUL

87
EVALUATION

EXPRESSIONS EVALUATED

BY PRIORITY OF

THE OPERATOR

SUCCESSFUL

END TEST
51.0 EVALUATION OF EXPRESSIONS THAT HAVE A VARIETY

OF OPERATORS

In this test expressions are formed

numerically assigned simple and assigned

expression is characterized by either the abs

non-nested parentheses, or nested parentheses,

the same as in test section 32.0, except in th are included along with the numerical constan

construction of the numeric expressions. Th

Each exercise includes the evaluation of e exercise, no parentheses are used in order to

In the second exercise, parentheses are used

test that evaluation within parentheses takes

lef t-to-r ight precedence is observed. Fin

parentheses are evaluated. Output is similar

from numerical constants,

subscripted variables. Each

ence of parentheses, use of

The objective of this test is

is test subscripted variables

ts and simple variables for the

ree exercises are performed,

ight expressions. In the first

test lef t-to-r ight precedence,

but are not nested in order to

place first and then that

ally, expressions with nested

to section 32.0.

*******************

* PROGRAM -FILE 51 * *******************

0010

0 0 60

0070

0080

0090

0100

0110

0120

0130

0140

0150

0160

0170

0180

0190

0200

0210

0220

0230

0240

0250

0260

0270

0280

0290

0300

0310

PRINT "PROGRAM FILE 51"

PRINT

PRINT

PRINT

PRINT " SECTION 51.0"

PRINT

PRINT " EVALUATION OF EXPRESSIONS WHICH HAVE A VARIETY OF OP-"

PRINT "ERATORS AND ARE OF ONE OF THREE CATEGORIES:"

PRINT

PRINT " (1) NO PARENTHESES,"

PRINT " (2) NON-NESTED PARENTHESES, AND"

PRINT " (3) NESTED PARENTHESES."

PRINT

PRINT "ALSO, THESE EXPRESSIONS ARE FORMED FROM THE USE OF NUMERI-"

PRINT "CAL CONSTANTS, NUMERICALLY ASSIGNED SIMPLE VARIABLES, AND"

PRINT "NUMERICALLY ASSIGNED SUBSCRIPTED VARIABLES."

PRINT

PRINT

PRINT TA B ( 1 8 ) , " CATEGORY TAB ( 3 6 )," EVALUATION

PRINT TAB (18) , " OF ";TAB(36)," OF

PRINT TAB (18) , "EXPRESSION" ;TAB (36) , " SYSTEM " PRINT "**************************************************" • PRINT "**********************"

PRINT

PRINT

PRINT " BEGIN TEST."

PRINT

89
0320 PRINT

0330 DIM Z (3) , M ( 2 , 8

)

0340 LET F=0

0350 LET X=3

0360 LET Y=2

0370 LET Z (1) =5

0380 LET Z (2) =-60

0390 LET Z (3) =92

0400 LET M(l,l)=X+Y*Z(l)-Z(2)/5-Z(2)/5/6+18

0410 LET M(l,2)=M(l,l)-45

0420 IF ABS (M(l, 2) ) <=lE-4 THEN 440

0430 LET F-l

0440 LET M (1, 3) =Y~3*4+216/3Y*2+Z (3) -82

0450 LET M(l,4)=M(l,3)-90

0460 IF ABS (M(l,4) ) <=lE-4 THEN 480

0470 LET F=1

0480 LET M (1 , 5) =Y*X+Y*Z (2) -Y+170

0490 LET M(l,6)=M(l,5)-54

0500 IF ABS (M(l, 6) ) < = lE-4 THEN 520

0510 LET F=1

0520 LET M ( 1 , 7

) =Z ( 2 ) /Y + 10 5/Z (1) *Y~2+3-24

0530 LET M(l,8)=M(l,7)-33

0540 IF ABS (M(l, 8) ) < = lE-4 THEN 560

0550 LET F=1

0560 LET M (2, 1) =Y*Y + Z (2) *Y + 167*X+Y-124

0570 LET M (2, 2) =M (2, 1) -263

0580 IF ABS (M ( 2 , 2) ) < = lE-3 THEN 600

0590 LET F=1

0600 LET M(2,3)=Y*Y+Y*Y+Y*Y+Y*Y+Y-3*Z(1)

0610 LET M (2, 4) =M (2, 3) -3

0620 IF ABS (M(2, 4) ) <=lE-5 THEN 640

0630 LET F=1

0640 LET M (2, 5) =Z (2) +Z (1 ) +X+Y+Y-X-9

0650 LET M (2, 6) =M (2, 5) - (-60)

0660 IF ABS (M(2, 6) ) <=lE-4 THEN 680

0670 LET F=1

0680 LET M(2,7)=Z ( 2 ) /Z ( 1

) +X+Y *Y ~ Y-X+l

0

0690 LET M (2, 8) =M (2, 7) -6

0700 IF ABS (M (2 , 8) ) <=lE-5 THEN 720

0710 LET F=1

0720 IF FO0 THEN 750

0730 LET A$="PASSED"

0740 GOTO 760

0750 LET A$="FAILED"

0760 LET F = 0 0 7 7 0 LET M (1, 1) = (X+Y) * (Z ( 1

) — Z (2) ) /5-Z (2) /5/6+1

8

0780 LET M (1 , 2) =M (1 , 1) -85

0790 IF ABS (M ( 1 , 2 ) )< = lE-4 THEN 810

0800 LET F=1

0810 LET M (1 , 3) =Y~ (3*4 ) + (216/3) Y*2+ (Z (3) -82)

0820 LET M(1,4)=M(1,3)-144 7 4 0830 IF ABS (M (1 , 4) ) <=1E-1 THEN 850

0840 LET F=1

0850 LET M (1 , 5) =Y* (X+Y) * (Z (2) -Y) +170

0860 LET M(l,6)=M(l,5)-(-450)

0870 IF ABS (M (1 , 6) ) <=lE-3 THEN 890

0880 LET F=1

90
0890 LET M ( 1 , 7

) =Z ( 2 ) /Y+l 0 5/Z ( 1

) *Y ~ ( 2 + 3

) -24

0900 LET M(1,8)=M(1,7)-618

0910 IF ABS (M (1, 8) ) <=lE-3 THEN 930

0920 LET F=1

0930 LET M (2, 1) =Y* (Y+Z (2) )* (Y+167) *X+ (Y-124

)

0940 LET M(2,2)=M(2,l)-(-58934)

0950 IF ABS CEl) <=1E-1 THEN 970

0960 LET F=1

0970 LET M (2, 3) =Y* (Y+Y) *Y+ (Y*Y+Y) *Y+ (Y-3*Z (1)

)

0980 LET M (2, 4) =M (2, 3) -15

0990 IF ABS (M (2, 4) ) <=lE-4 THEN 1010

1000 LET F=1

1010 LET M(2,5) = (Z(2)+Z(1) +X+Y +Y ) - (X-9

)

1020 LET M(2,6)=M(2,5)-(-42)

1030 IF ABS (M ( 2 , 6 ) ) <=lE-4 THEN 1050

1040 LET F=1

1050 LET M (2, 7) =Z (2) / ( Z (1) +X) +Y*Y~ (Y-X) +10

1060 LET M (2, 8) =M (2, 7) -3.

5

1070 IF ABS (M(2, 8) ) < = lE-4 THEN 1090

1080 LET F=1

1090 IF FO0 THEN 1120

1100 LET B $ = " PASSED"

1110 GOTO 1130

1120 LET B $ = " FAILED"

1130 LET F=0

1140 LET M ( 1 , 1

) =Y/ (184/ (Z (3)/ (30/ (Z (2)/ (1 2/X ) ) ) )

)

1150 LET M(l,2)=M(l,l)-(-.5)

1160 IF ABS (M(l, 2) ) <=lE-6 THEN 1180

1170 LET F=1

1180 LET M(l,3)=Y~3*4+405/(3 (Y*2 ) )+Z ( 3

) -82

1190 LET M(l, 4) =M (1, 3) -47

1200 IF ABS (M(l, 4) ) <=lE-4 THEN 1220

1210 LET F=1

1220 LET M(1,5)=Y*(X+Y*(Z(2)-Y) ) +1 70

1230 LET M(l,6)=M(l,5)-(-72)

1240 IF ABS (M (1 , 6) ) < = lE-4 THEN 1260

1250 LET F=1

1260 LET M (1, 7) =Z (2)/Y+121/(Z (1) * (Y~2+3)-24)

1270 LET M ( 1 , 8 ) =M ( 1 r 7 ) - ( - 1 9 ) 1280 IF ABS(M(1,8) ) <=lE-4 THEN 1300

1290 LET F=1

1300 LET M (2, 1) =Y* (Y+Z (2) * (Y+167* (X+Y) )

) -124

1310 LET M (2, 2) =M (2, 1) - (-100560)

1320 IF ABS (M(2, 2) ) <=1E0 THEN 1340

1330 LET F=1

1340 LET M (2, 3) =Y* (Y + Y* (Y+Y* (Y+Y* (Y + Y) ) )

) -3*Z (1)

1350 LET M (2, 4) =M (2, 3) -77

1360 IF ABS (M (2, 4) ) <=lE-4 THEN 1380

1 3"7 0 LET F = 1 1380 LET M (2, 5) =Z (2) + (Z (1 ) + (X+ (Y+ (Y- (X-9) ) ) )

)

1390 LET M(2,6)=M(2,5)-(-42)

1400 IF ABS (M (2 , 6) ) <=lE-4 THEN 1420

1410 LET F =1

1420 LET M (2, 7) =Z (2)/(Z (1) +4+ (Y* (Y~ (Y-X) ) +10)

)

1430 LET M (2, 8) =M (2, 7) - (-3)

1440 IF ABS (M (2 , 8) ) <=lE-5 THEN 1460

1450 LET F=1

91
1460

1470

1480

1490

1500

1510

1520

1530

1540

1550

1560

1570

1580

1590

1600

1610

1620

1630

IF F< > 0 THEN 1490

LET C $ = " PASSED"

GOTO 1500

LET C $ = " FAILED"

PRINT TAB (18) , " NO

PRINT TAB (18) , "PARENTHESES" ;TAB (38) ,A$

PRINT

PRINT TAB (18) , "PARENTHESES"

PRINT TAB (18)," BUT ";TAB(38),B$

PRINT TAB (18) , "NON-NESTED " PRINT

PRINT TAB (18) , " NESTED " PRINT TAB (18) ," PARENTHESES" ; TAB ( 3 8 ) ,C$

PRINT

PRINT " PRINT

PRINT

END

END TEST n

*****************

* SAMPLE OUTPUT * *****************

PROGRAM FILE 51

SECTION 51.0

EVALUATION OF EXPRESSIONS WHICH HAVE A VARIETY OF OPERATORS AND ARE OF ONE OF THREE CATEGORIES:

(1) NO PARENTHESES,

(2) NON-NESTED PARENTHESES, AND

(3) NESTED PARENTHESES.

ALSO, THESE EXPRESSIONS ARE FORMED FROM THE USE OF NUMERICAL CONSTANTS, NUMERICALLY ASSIGNED SIMPLE VARIABLES, AND

NUMERICALLY ASSIGNED SUBSCRIPTED VARIABLES.

CATEGORY EVALUATION

OF OF

EXPRESSION SYSTEM ************************************************************************

BEGIN TEST.

92
NO

PARENTHESES

PARENTHESES

BUT

NON-NESTED

NESTED

PARENTHESES

END TEST.

PASSED

PASSED

PASSED

93
52.0 EXCEPTION TEST - ZERO RAISED TO A NEGATIVE POWER

The objective of this test is to verify that the implementation

recognizes zero raised to a negative power as an exception with a specified

recovery procedure. In this case it means that upon recognition of this

error, the implementation should supply machine infinity and continue program

execution. The test has a statement at line 290 which allows zero to be

raised to a negative power. Some systems may generate diagnostics that refer

to this line number. On the other hand, this test prints a statement that

informs the user on what he should expect so that the user can for himself

determine whether the implementation has performed according to the standard.

In particular, the user must look for the machine infinity for his particular

system.

*******************

* PROGRAM FILE 52 * *******************

0010

0100

0110

0120

0130

0140

0150

0160

0170

0180

0190

0200

0210

0220

0230

0240

0250

0260

0270

0280

0290

0300

0310

0320

0330

0340

0350

0360

0370

0380

PRINT "PROGRAM FILE 52"

PRINT

PRINT

PRINT

PRINT " SECTION 52.0“

PRINT

PRINT " (ZERO RAISED TO A NEGATIVE POWER.)"

PRINT

PRINT

PRINT

PRINT " THE OBJECTIVE OF THIS SECTION IS TO DETERMINE WHETHER " PRINT "IMPLEMENTATION WILL CONSIDER ZERO BEING RAISED TO A NEGA-"

PRINT "TIVE POWER AS A NONFATAL ERROR; THAT IS, UPON RECOGNITION"

PRINT "OF SUCH AN ERROR, IMPLEMENTATION SHOULD SUPPLY ITS MACHINE"

PRINT "INFINITY AND CONTINUE PROGRAM EXECUTION."

PRINT

PRINT

PRINT

PRINT " BEGIN TEST."

PRINT

LET A-0 5 PRINT " IF THE NUMERICAL VALUE, WHICH SHOULD BE PRINTED FOLLOW-"

PRINT "ING THIS MESSAGE, IS RECOGNIZED BY THE USER AS THE MACHINE " PRINT "INFINITY FOR THE SYSTEM BEING TESTED, THEN IMPLEMENTATION " PRINT "WILL HAVE PASSED THE TEST."

PRINT

PRINT A

PRINT

PRINT " END TEST.

PRINT
0390 END

*****************

* SAMPLE OUTPUT * *****************

PROGRAM FILE 52

SECTION 52.0

(ZERO RAISED TO A NEGATIVE POWER.)

THE OBJECTIVE OF THIS SECTION IS TO DETERMINE WHETHER

IMPLEMENTATION WILL CONSIDER ZERO BEING RAISED TO A NEGATIVE POWER AS A NONFATAL ERROR; THAT IS, UPON RECOGNITION

OF SUCH AN ERROR, IMPLEMENTATION SHOULD SUPPLY ITS MACHINE

INFINITY AND CONTINUE PROGRAM EXECUTION.

BEGIN TEST.

? ZERO TO A NEGATIVE POWER IN LINE 290

IF THE NUMERICAL VALUE, WHICH SHOULD BE PRINTED FOLLOWING THIS MESSAGE, IS RECOGNIZED BY THE USER AS THE MACHINE

INFINITY FOR THE SYSTEM BEING TESTED, THEN IMPLEMENTATION

WILL HAVE PASSED THE TEST.

1.70141E+38

END TEST.

95
53.0 EXCEPTI ON TES T - A NEGATIVE NUMBER RAISED TO A NON-INTEGRAL POWER

The objective of this test is to verify that the implementation

recognizes a negative power raised to a non-integral power as an exception

with no recovery procedure. This means that the error should be reported and

program execution should be suspended pending user-directed restart

procedures. In this test, there is a statement at line 270 that has a negative number raised to a non-integral power. A diagnostic should be the

only output unless a translator is used that executes line by line. In that

case, a fatal diagnostic should appear after the statement BEGIN TEST.

* PROGRAM FILE 53 * *

0010 PRINT

0 0 6 0 PRINT

0070 PRINT

0 0 8 0 PRINT

0090 PRINT

0100 PRINT

0110 PRINT

0120 PRINT

0130 PRINT

0140 PRINT

0150 PRINT

0160 PRINT

0170 PRINT

0180 PRINT

0190 PRINT

0200 PRINT

0210 PRINT

0220 PRINT

0230 PRINT

0240 PRINT

0250 PRINT

0260 PRINT

0270 LET A

0280 PRINT

0290 PRINT

0300 PRINT

0310 PRINT

0320 PRINT

0330 PRINT

0340 END

"PROGRAM FILE 53"

SECTION 53.0"

(A NEGATIVE NUMBER RAISED TO A NON-INTEGRAL POWER.)"

" THE OBJECTIVE OF THIS SECTION IS TO DETERMINE WHETHER"

"UPON EVALUATION OF THE OPERATION OF INVOLUTION RESULTING IN

"A NEGATIVE NUMBER BEING RAISED TO A NON-INTEGRAL POWER WILL

"THE SYSTEM CONSIDER THIS AS A FATAL ERROR. THAT IS, WILL"

"THE SYSTEM SUSPEND PROGRAM EXECUTION IN SUCH A WAY THAT US-

" ER-DIRECTED RESTART PROCEDURES ARE REQUIRED? IF THIS PRO-"

"CEDURE IS TAKEN, THEN THE TEST WILL HAVE PASSED."

" BEGIN TEST."

: (-25)~.5

A; "HAS BEEN PRINTED, THEREFORE, TEST FAILS WHICH MEANS THE"

"SYSTEM DID NOT RECOGNIZE PROPERLY A NEGATIVE NUMBER BEING"

"RAISED TO A NON-INTEGRAL POWER."

END TEST.

II

II

96
*****************

* SAMPLE OUTPUT * *****************

PROGRAM FILE 53

SECTION 53.0

(A NEGATIVE NUMBER RAISED TO A NON-INTEGRAL POWER.)

THE OBJECTIVE OF THIS SECTION IS TO DETERMINE WHETHER

UPON EVALUATION OF THE OPERATION OF INVOLUTION RESULTING IN

A NEGATIVE NUMBER BEING RAISED TO A NON-INTEGRAL POWER WILL

THE SYSTEM CONSIDER THIS AS A FATAL ERROR. THAT IS, WILL

THE SYSTEM SUSPEND PROGRAM EXECUTION IN SUCH A WAY THAT USER-DIRECTED RESTART PROCEDURES ARE REQUIRED? IF THIS PROCEDURE IS TAKEN, THEN THE TEST WILL HAVE PASSED.

BEGIN TEST.

? ABSOLUTE VALUE RAISED TO POWER IN LINE 270

97
54.0 SEMANTIC ERROR - SUBSCRIPTED VARIABLE WITH

DIFFERENT NUMBERS OF SUBSCRIPTS

The objective of this test is to determine whether the implementation

recognizes an occurrence of the same subscripted variable with a different

number of subscripts as an error. The routine uses the array A as both a single and double dimensioned array. If an implementation recognizes this

error, the output of the test should be a diagnostic that indicates that in

lines 340 to 360 there is an array used with different sets of subscripts.

However, since this is a semantic rather than a syntactic error some systems

may

This

allow one and two - dimensioned arrays to use the same variable name,

test is meant to be informative to the user.

* PROGRAM FILE 54 *

0010

0120

0130

0140

0150

0160

0170

0180

0190

0200

0210

0220

0230

0240

0250

0260

0290

0300

0310

0320

0330

0340

0350

0360

0370

0380

0390

0400

0410

0420

PRINT "PROGRAM FILE 54"

PRINT

PRINT

PRINT

PRINT " SECTION 54.0"

PRINT

PRINT " (THE SAME SUBSCRIPTED VARIABLE WITH DIFFERENT NUMBERS OF"

PRINT " SUBSCRIPTS.)"

PRINT

PRINT

PRINT

PRINT " THE OBJECTIVE OF THIS SECTION IS TO DETERMINE WHETHER"

PRINT "THE USE OF THE SAME SUBSCRIPTED VARIABLE WITH BOTH ONE SUB-"

PRINT "SCRIPT AND TWO SUBSCRIPTS IN THE SAME PROGRAM IS ALLOWED"

PRINT "BY THE SYSTEM. IF THE SYSTEM RECOGNIZES THIS AS A FATAL"

PRINT "ERROR, THEN THE TEST WILL HAVE PASSED."

PRINT

PRINT

PRINT

PRINT " BEGIN TEST."

PRINT

LET A (

1

) =2

LET A (5, 5) =A (1) +64

PRINT A (5, 5); "HAS BEEN PRINTED, THEREFORE, TEST FAILS WHICH MEANS"

PRINT "THE SYSTEM DID NOT RECOGNIZE PROPERLY THE SAME SUBSCRIPTED"

PRINT "VARIABLE OCCURRING WITH DIFFERENT NUMBERS OF SUBSCRIPTS."

PRINT

PRINT " END TEST."

PRINT

END

98
*****************

* SAMPLE OUTPUT * *****************

If this program exec subscripted variable wi

system does not then a po

utes then

th one and

ssible error

the test system recogni

two - dimensional arrays,

diagnostic for this progr

zes the

However

am might

same

i f a be

? DIMENSION ERROR IN LINE 350

99
55.0 EXCEPTION TEST - A SUBSCRIPT IS NOT IN THE RANGE OF THE IMPLICIT

DIMENSIONING BOUNDS

The objective of this test is to verify that the implementation will

recognize when the values of a subscripted variable are not within the

appropriate range. In the present case we test whether the implementation

recognizes an exception when a subscript is assigned a value greater than 10

if that array has not been declared in a dimension-statement. There is a statement in which a subscripted variable has a subscript value greater than

10 yet that subscripted variable is not a declared array that might allow for

such a subscript value. On output, there should be a fatal diagnostic that

might indicate a dimensioning error in line 330.

* PROGRAM FILE 55 *

0010

0060

0070

0080

0090

0100

0110

0120

0130

0140

0150

0160

0170

0180

0190

0200

0210

0220

0230

0240

0250

0270

0290

0300

0310

0320

0330

0340

0350

0360

0370

PRINT "PROGRAM FILE 55"

PRINT

PRINT

PRINT

PRINT " SECTION 55.0"

PRINT

PRINT "(A SUBSCRIPT IS NOT IN THE RANGE OF THE IMPLICIT DIMENSION-"

PRINT " ING BOUNDS.)"

PRINT

PRINT

PRINT

PRINT " THE OBJECTIVE OF THIS SECTION IS TO DETERMINE WHETHER"

PRINT "THE USE OF A SUBSCRIPT WHICH IS NOT IN THE RANGE OF THE"

PRINT "IMPLICIT DIMENSIONING BOUNDS IS ALLOWED BY THE"

PRINT "SYSTEM. IF THE SYSTEM RECOGNIZES THIS AS A FATAL ERROR"

PRINT "(THAT IS, SUSPENDING PROGRAM EXECUTION SUCH THAT USER-DI-"

PRINT "RECTED RESTART PROCEDURES ARE REQUIRED) , THEN THE TEST WILL"

PRINT "HAVE PASSED."

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT " BEGIN TEST."

PRINT

LET A ( 1 5

) =2

PRINT A (15); "HAS BEEN PRINTED, THEREFORE, TEST FAILS WHICH MEANS"

PRINT "THE SYSTEM DID NOT RECOGNIZE PROPERLY THAT THE SUBSCRIPT"

PRINT "BEING USED WAS OUT OF THE RANGE OF THE IMPLICIT DIMENSION-"

PRINT "ING BOUND."

100
0380 PRINT

0390 PRINT " END TEST."

0400 PRINT

0410 END

*****************

* SAMPLE OUTPUT * *****************

PROGRAM FILE 55

SECTION 55.0

(A SUBSCRIPT IS NOT IN THE RANGE OF THE IMPLICIT DIMENSIONING BOUNDS.)

THE OBJECTIVE OF THIS SECTION IS TO DETERMINE WHETHER

THE USE OF A SUBSCRIPT WHICH IS NOT IN THE RANGE OF THE

IMPLICIT DIMENSIONING BOUNDS IS ALLOWED BY THE

SYSTEM. IF THE SYSTEM RECOGNIZES THIS AS A FATAL ERROR

(THAT IS, SUSPENDING PROGRAM EXECUTION SUCH THAT USER-DIRECTED RESTART PROCEDURES ARE REQUIRED), THEN THE TEST WILL

HAVE PASSED.

BEGIN TEST.

? DIMENSION ERROR IN LINE 330

101
56.0 EXCEPTION TEST - A SUBSCRIPT IS NOT IN THE RANGE OF AN EXPLICITLY

DIMENSIONED VARIABLE

The objective of this test is to ve recognizes the assignment of a value to a bound of the array declaration as an exception

which an assigned value to the subscript is

the array declaration. A fatal diagnostic on indicate that there is a dimension error in li

rify that the

location greater

. This test has

larger than the

output is requir

ne 170.

implementation

than the upper

a statement in

upper bound of

d. It might

*******************

* PROGRAM FILE 56 * *******************

0010

0 0 6 0 0070

0080

0090

0100

0110

0120

0130

0140

0150

0160

0170

0180

0190

0200

0210

0220

0230

0240

0250

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

DIM A

LET A

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

END

"PROGRAM FILE 56"

SECTION 56.0"

FATAL ERROR TEST ON DIMENSIONED VARIABLES"

(THE EXPLICIT CASE.)"

" BEGIN TEST."

( 100 ) (101) =64

A ( 1 0 1 )

; " HAS BEEN PRINTED, THEREFORE, TEST FAILS WHICH MEANS"

"THE SYSTEM DID NOT RECOGNIZE PROPERLY THAT THE SUBSCRIPT"

"BEING USED WAS OUT OF THE RANGE OF THE EXPLICIT DIMENSION-"

"ING BOUND."

" END TEST.

*****************

* SAMPLE OUTPUT * *****************

102
PROGRAM FILE 56

SECTION 56.0

FATAL ERROR TEST ON DIMENSIONED VARIABLES

(THE EXPLICIT CASE.

)

BEGIN TEST.

? DIMENSION ERROR IN LINE 170

103
57.0 ATTEMPTING STRING OVERFLOW BY VARIABLE ASSIGNMENT

The objective of this test is to generate a string overflow to determine

whether the implementation will recognize this as an error and provide an appropriate diagnostic. Since a string expression is either a string

constant or string variable, two cases must be considered. However, string

constants up to the maximum allowed line length have previously been tested.

This test, then, will only test string variable assignment. The standard

specifies that string variables can have assigned to them, during the

execution of a program, a character string from zero to 18 characters. This

test attempts to assign strings longer than 18 characters in length. This is an informative test since a portable standard conforming program should only

use string variables with assignments of 18 or fewer characters.

Implementations that accept the assignment of strings longer than 18

characters are not required to inform the user that this program contains

assigned strings, longer than 18 characters. The reader is referred to

section 6.4 of BSR X3.60 for the precise specifications.

The test has been constructed with several statements that allow strings

of various lengths greater than 18 characters to be assigned to string

variables. The lengths of the strings used are 19, 20, 30, 40, 50, and 58

characters in length.

If a diagnostic is generated, then it most likely will terminate the

program. Some systems, however, accept long assigned strings. Therefore,

since multi-line statements are not permitted, this error test may not

generate a diagnostic for systems allowing long strings. This is acceptable

since the implementation could not be made to overflow with respect to

str ings

.

*******************

* PROGRAM FILE 57 * *******************

0 0 10 PRI NT

0 0 60 PRINT

0 070 PRINT

0 080 PRI NT

0 090 PRI NT

0 1 00 PRINT

0 1 10 PRI NT

0 1 20 PRI NT

0 1 30 PRI NT

0 1 40 PRI NT

0 1 50 PRI NT

0 1 60 PRI NT

0 1 70 PRI NT

0 1 80 PRI NT

"PROGRAM FILE 57"

SECTION 57.0: ERROR TEST ON STRING EXPRESSIONS II

THE OBJECTIVE OF THIS SECTION IS TO DETERMINE WHETHER"

"THE ASSIGNING OF MORE THAN 18 CHARACTERS TO A STRING WOULD"

"BE RECOGNIZED BY THE SYSTEM AS A FATAL ERROR. THAT IS, UP-"

"ON SUCH AN ASSIGNMENT, PROGRAM EXECUTION WOULD BE SUSPENDED"

"PENDING USER-DIRECTED RESTART PROCEDURES. IF THE SYSTEM"

"RECOGNIZES SUCH ASSIGNMENTS AS FATAL ERRORS, THEN THE TEST"

10U
0190

0200

0210

0220

0230

0240

0250

0260

0270

0280

0290

0300

0310

0320

0330

0340

0350

0360

0370

0380

0390

04 00

0410

0420

0430

0440

0450

0460

PRINT "PASSES. HOWEVER, IF IT DOES NOT, THEN THE SYSTEM SATISFIES"

PRINT "MORE THAN WHAT IS REQUIRED BY MINIMAL BASIC."

PRINT

PRINT

PRINT

PRINT " BEGIN TEST."

PRINT

LET A$ = ,, *********19******** 11 LET B$= m *********20*********"

LET Q$=" ************** 3Q** ****** ******* LET £) $= 11 *******4 0 ******************* M LET E$ sl1 ************************50************************"

LET F $ = M *****************58****************************”

PRINT " IN THE OUTPUT BELOW, THE NUMBERS TOWARD THE CENTER OR"

PRINT "IN THE CENTER OF THE ASTERISKS SIGNIFIES THE LENGTH OF THE"

PRINT "CHARACTER STRINGS ASSOCIATED WITH EACH ASSIGNED STRING VAR-

PRINT " IABLE .

PRINT

PRINT A$

PRINT B

$

PRINT C$

PRINT D$

PRINT E

$

PRINT F PRINT

PRINT " END TEST."

PRINT

END

*****************

* SAMPLE OUTPUT * *****************

If a string overflow occurs then a diagnostic message such as:

7STRING TOO LONG IN LINE 260

might appear during execution. Otherwise, the user will get the following

printed output:

PROGRAM FILE 57

SECTION 57.0; ERROR TEST ON STRING EXPRESSIONS.

105
THE OBJECTIVE OF THIS SECTION IS TO DETERMINE WHETHER

THE ASSIGNING OF MORE THAN 18 CHARACTERS TO A STRING WOULD

BE RECOGNIZED BY THE SYSTEM AS A FATAL ERROR. THAT IS, UPON SUCH AN ASSIGNMENT, PROGRAM EXECUTION WOULD BE SUSPENDED

PENDING USER-DIRECTED RESTART PROCEDURES. IF THE SYSTEM

RECOGNIZES SUCH ASSIGNMENTS AS FATAL ERRORS, THEN THE TEST

PASSES. HOWEVER, IF IT DOES NOT, THEN THE SYSTEM SATISFIES

MORE THAN WHAT IS REQUIRED BY MINIMAL BASIC.

BEGIN TEST.

IN THE OUTPUT BELOW, THE NUMBERS TOWARD THE CENTER OR

IN THE CENTER OF THE ASTERISKS SIGNIFIES THE LENGTH OF THE

CHARACTER STRINGS ASSOCIATED WITH EACH ASSIGNED STRING VARIABLE. *

20 ********* *

20 **************

40 ******************* *50************************

 58** **************************

END TEST.

106
58.0 TEST FOR UNDEFINED VARIABLES

At initiation of a pr og r am ,var i ables may or may not be assigned a specific value. The objective of this test is to determine which of the

following three alternatives for associating implementation-defined initial

values with variables is used for the implementation tested. The three

alternatives are: (a) all variables receive unknown or arbitrary values

(i.e., the implementation takes no explicit action to initialize variables);

(b) all numeric variables are assigned the value zero and all string

variables the null string; or (c) all variables are r ecogn i zeabl y undefined

in the sense that an error will result from any attempt to access the value

of a variable before that variable is explicitly assigned a value. The

standard recommends that the alternative (c) be adopted in order that a program be much more transportable. The reader should consult section 6.6 of

BSR X3.60 for the specifications used here.

This test has numerical expressions that contain undefined variables,

that is, a variable which has not been explicitly defined. Which of the

above alternatives is practiced by the tested implementation will determine

what kind of output there will be. If alternative (a) or (b) is practiced,

then the value of the expression will be printed and this value should be

followed by a statement to the user regarding the practice of the host

implementation. Several runnings of the program would indicate (b) is used

if the values 2, 4, 6, 8 are printed consistently. If not then (a) is

followed. However, if alternative (c) --which is recommended by the ANSI

Minimal BASIC Standard —is practiced, then the output should consist of some

form of implementation-defined diagnostics.

a*****************

* PROGRAM FILE 58 *

0010 PRINT

0060 PRINT

0070 PRINT

0080 PRINT

0090 PRINT

0100 PRINT

0110 PRINT

0120 PRINT

0130 PRINT

0140 PRINT

0150 PRINT

0160 PRINT

0170 PRINT

0180 PRINT

0190 PRINT

0200 PRINT

" PROGRAM FILE 58"

SECTION 58.0: TEST FOR UNDEFINED VARIABLES."

" THE OBJECTIVE OF THIS SECTION IS TO DETERMINE WHETHER"

"THE SYSTEM WILL RECOGNIZE AN UNDEFINED VARIABLE AS A FATAL"

"ERROR, THAT IS, REQUIRING A VALUE TO HAVE BEEN ASSIGNED THE"

"VARIABLE BEFORE ANY EXPRESSION INVOLVING THAT VARIABLE IS"

"EXECUTED. IF THE SYSTEM SHOULD RECOGNIZE THE UNDEFINED"

"VARIABLE AS A FATAL ERROR (SUSPENDING PROGRAM EXECUTION"

"PENDING USER-DIRECTED RESTART PROCEDURES), THEN THE TEST"

"WILL HAVE PASSED; HOWEVER, IF THE SYSTEM DOES NOT MAKE THIS"

107
0210 PRINT "RECOGNITION, THEN THE SYSTEM IS SATISFYING MORE THAN IS"

0220 PRINT "REQUIRED BY MINIMAL BASIC."

0230 PRINT

0240 PRINT

0250 PRINT

0260 PRINT " BEGIN TEST."

0270 PRINT

0280 LET A=B+2

0290 PRINT A

0292 LET A=C+4

0293 PRINT A

0294 LET A=D+6

0295 PRINT A

0296 LET A=E+8

0297 PRINT A

0300 PRINT

0305 PRINT "IF THE SEQUENCE 2, 4, 6, 8 HAS BEEN PRINTED ABOVE THEN THE"

0306 PRINT "VARIABLES B, C, D, E WERE INITIALIZED TO 0 (ALTERNATIVE B ) .

0307 PRINT "IF ANOTHER SEQUENCE APPEARS THEN ALTERNATIVE A APPLIES."

0310 PRINT

0320 PRINT " END TEST."

0330 PRINT

0340 END

*****************

* SAMPLE OUTPUT * *****************

Since the standard suggests that alternative C be adopted, the followi

diagnostics might appear:

? UNINITIALIZED VARIABLE IN LINE 280

? UNINITIALIZED VARIABLE IN LINE 292

? UNINITIALIZED VARIABLE IN LINE 294

? UNINITIALIZED VARIABLE IN LINE 296

Otherwise, if alternative B applied the following output might appear

PROGRAM FILE 58

SECTION 58.0: TEST FOR UNDEFINED VARIABLES.

THE OBJECTIVE OF THIS SECTION IS TO DETERMINE WHETHER

108
THE SYSTEM WILL RECOGNIZE AN UNDEFINED VARIABLE AS A FATAL

ERROR, THAT IS, REQUIRING A VALUE TO HAVE BEEN ASSIGNED THE

VARIABLE BEFORE ANY EXPRESSION INVOLVING THAT VARIABLE IS

EXECUTED. IF THE SYSTEM SHOULD RECOGNIZE THE UNDEFINED

VARIABLE AS A FATAL ERROR (SUSPENDING PROGRAM EXECUTION

PENDING USER-DIRECTED RESTART PROCEDURES), THEN THE TEST

WILL HAVE PASSED; HOWEVER, IF THE SYSTEM DOES NOT MAKE THIS

RECOGNITION, THEN THE SYSTEM IS SATISFYING MORE THAN IS

REQUIRED BY MINIMAL BASIC.

BEGIN TEST.

2

4

6

8

IF THE SEQUENCE 2, 4, 6, 8 HAS BEEN PRINTED ABOVE THEN THE

VARIABLES B, C, D, F WERE INITIALIZED TO 0 (ALTERNATIVE B).

IF ANOTHER SEQUENCE APPEARS THEN ALTERNATIVE A APPLIES.

END TEST.

109
59.0

EXCEPTION TEST - ON DIVISION BY ZERO

The objective of this test is to verify that the implementation

recognizes a numerical expression involving division by zero as an exception

with a recovery procedure. When the implementation recognizes this

situation, it must supply the machine infinity with the sign of the numerator

and continue program execution. The reader is referred to section 7 .5 of BSR

X3.60 for the specifications.

59.1

Positive Numerator

The objective of this test is to determine, in the event that the

implementation does recognize division by zero as a recoverable error, that

it will also recognize the sign of the numerator (in this case positive) and

assign it to its machine infinity. This test has an expression at line 290

which, when evaluated, will involve division by zero. The numerator for the

expression is positive. On output, this test requires that the

implementation-supplied machine infinity printed and, preceding this value,

there should be a message informing the user to look for the positive case of

the machine infinity.

59.2

Negative Numerator

The objective of this test is the same as the stated objective for

section 59.1, except that this test uses a negative numerator. The

expression in this case is at line 470.

*******************

* PROGRAM FILE 59 * *******************

0010 PRINT

0060 PRINT

0070 PRINT

0080 PRINT

0090 PRINT

0100 PRINT

0110 PRINT

0120 PRINT

0130 PRINT

0140 PRINT

0150 PRINT

0160 PRINT

0170 PRINT

0180 PRINT

0190 PRINT

0200 PRINT

0210 PRINT

"PROGRAM FILE 59"

" SECTION 59.0: NON-FATAL ERROR TEST FOR DIVISION BY ZERO."

" THE OBJECTIVE OF THIS TEST IS TO DETEMINE WHETHER THE"

"EVALUATION OF THE SYSTEM ON A EXPRESSION WHICH RESULTED IN"

"DIVISION BY ZERO WILL CAUSE THE SYSTEM TO SUPPLY ITS"

"MACHINE INFINITY WITH THE SIGN OF THE NUMERATOR AND A"

"CONTINUATION OF PROGRAM."

SECTION 59.1"

110
0220

0230

0240

0250

0260

0270

0280

0290

0300

0310

0320

0330

0340

0350

0360

0370

0380

0390

0400

0410

0420

0430

0440

0450

0460

0470

0480

0490

0500

0510

0520

0530

0540

0550

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

LET A

LET X

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

LET A

LET X PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

END

(POSITIVE NUMERATOR.)"

BEGIN TEST."

= 2

= 32/ ( A-2

)

" IF THE NUMBER PRINTED AFTER THIS STATEMENT IS POSITIVE"

"AND THE MACHINE INFINITY FOR THE SYSTEM, THEN THE TEST"

"WILL HAVE PASSED."

X

" END TEST."

" SECTION 59.2"

" (NEGATIVE NUMERATOR.)"

" BEGIN TEST."

= 64

=(-32)/(A-64)

" IF THE NUMBER PRINTED AFTER THIS STATEMENT IS NEGATIVE"

"AND IS THE MACHINE INFINITY FOR THIS SYSTEM, THEN THE TEST"

"WILL HAVE PASSED."

X

" END TEST."

*****************

* SAMPLE OUTPUT * *****************

PROGRAM FILE 59

SECTION 59.0: NON-FATAL ERROR TEST FOR DIVISION BY ZERO.

THE OBJECTIVE OF THIS TEST IS TO DETEMINE WHETHER THE

EVALUATION OF THE SYSTEM ON A EXPRESSION WHICH RESULTED IN

DIVISION BY ZERO WILL CAUSE THE SYSTEM TO SUPPLY ITS

111
MACHINE INFINITY WITH THE SIGN OF THE NUMERATOR AND A

CONTINUATION OF PROGRAM.

SECTION 59.1

(POSITIVE NUMERATOR.)

BEGIN TEST.

?DI VIS ION BY ZERO IN LINE 290

IF THE NUMBER PRINTED AFTER THIS STATEMENT IS POSITIVE

AND THE MACHINE INFINITY FOR THE SYSTEM, THEN THE TEST

WILL HAVE PASSED.

1. 70141E + 38

END TEST.

SECTION 59.2

(NEGATIVE NUMERATOR.)

BEGIN TEST.

7DIVISION BY ZERO IN LINE 4'7 0

IF THE NUMBER PRINTED AFTER THIS STATEMENT IS NEGATIVE

AND IS THE MACHINE INFINITY FOR THIS SYSTEM, THEN THE TEST

WILL HAVE PASSED.

-1. 70141E+38

END TEST.

112
60.0

EXCEPTION TEST - ON EXPRESSION EVALUATION

RESULTING IN OVERFLOW

The objective of this test is to verify that the implementation, when

attempting to evaluate an expression causing an overflow, will recognize a recoverable exception. Following this overflow , the implementation should

supply machine infinity with the algebraically correct sign. The reader is

referred to section 7.5 of BSR X3.60 for the specifications.

60.1 Positive Machine Infinity

In this part of the test, we raise 999999 to the 99999 power, which, for

all practical purposes, on existing computer systems, is sufficiently large

to cause overflow. All of the numbers are kept within 6 digits so that

roundoff is not a factor. This test requires that the

implementation-supplied machine infinity be printed. Preceding the output of

the machine infinity, there should be a printed message informing the user what to look for, in order to verify that implementation passed or failed the

test. In this case, the user is instructed to look for positive machine

infinity. On the test system used machine infinity was 1.70141E+38.

60.2 Negative Machine Infinity

Two cases are considered here. First, the negative number -999999 is

raised to the odd power 99999 then, secondly, it is raised to the even power

88888. In the first case, the implementation should return machine infinity

with a negative sign and in the second case, with a positive sign. The

implementation supplied machine infinity is printed preceded by the

appropriate sign for each case. The user is informed by message what to look

for in terms of sign.

*******************

* PROGRAM FILE 60 * *******************

0010 PRINT "PROGRAM FILE 60"

0060 PRINT

0070 PRINT

0080 PRINT

0090 PRINT " SECTION 60.0: NON-FATAL ERROR TEST FOR EXPRESSION EVALU-"

0100 PRINT " ATION WHICH RESULTS IN OVERFLOW."

0110 PRINT

0120 PRINT

0130 PRINT

0140 PRINT " THE OBJECTIVE OF THIS TEST IS TO DETERMINE WHETHER UP-"

0150 PRINT "ON THE EVALUATION OF AN EXPRESSION WHICH CAUSES OVERFLOW"

0160 PRINT "THE SYSTEM WILL SUPPLY ITS MACHINE INFINITY, WHICH SHOULD BE"

0170 PRINT "ACCOMPANIED BY THE CORRECT ALGEBRAIC SIGN, AND IF PROGRAM"

113
0180

0190

0200

0210

0220

0230

0240

0250

0260

0270

0280

0290

0300

0310

0320

0330

0340

0350

0360

0370

0380

0390

0400

0410

0420

0430

0440

0450

0460

0470

0480

0490

0500

0510

0520

0530

0540

0542

0543

0545

0546

0547

0549

0550

0560

0570

PRINT "EXECUTION CONTINUES."

PRINT

PRINT

PRINT

PRINT " SECTION 60.1"

PRINT

PRINT " (MACHINE INFINITY, POSITIVE.)"

PRINT

PRINT

PRINT " BEGIN TEST."

PRINT

LET A = 9 9 9 99

LET X=999999~A

PRINT " IF THE NUMBER PRINTED AFTER THIS STATEMENT IS POSITIVE"

PRINT "AND THE MACHINE INFINITY FOR THIS SYSTEM, THEN THE TEST"

PRINT "WILL HAVE PASSED."

PRINT X PRINT

PRINT " END TEST."

PRINT

PRINT

PRINT

PRINT " SECTION 60.2"

PRINT

PRINT " (MACHINE INFINITY, NEGATIVE.)"

PRINT

PRINT

PRINT " BEGIN TEST."

PRINT

PRINT

LET A=99999

LET X= (-999999) "A

PRINT " IF THE NUMBER PRINTED AFTER THIS STATEMENT IS NEGATIVE"

PRINT "AND THE MACHINE INFINITY FOR THIS SYSTEM, THEN THE TEST"

PRINT "WILL HAVE PASSED."

PRINT X

PRINT

LET A=88888

LET X= (-99999) ~A* (-1) * (-5) +2

PRINT " IF THE NUMBER PRINTED AFTER THIS STATEMENT IS POSITIVE"

PRINT "AND THE MACHINE INFINITY FOR THIS SYSTEM, THEN THE TEST"

PRINT "WILL HAVE PASSED."

PRINT X

PRINT " END TEST.

PRINT

END

*****************

* SAMPLE OUTPUT * *****************

111*
PROGRAM FILE 60

SECTION 60.0: NON-FATAL ERROR TEST FOR EXPRESSION EVALUATION WHICH RESULTS IN OVERFLOW.

THE OBJECTIVE OF THIS TEST IS TO DETERMINE WHETHER UPON THE EVALUATION OF AN EXPRESSION WHICH CAUSES OVERFLOW

THE SYSTEM WILL SUPPLY ITS MACHINE INFINITY, WHICH SHOULD BE

ACCOMPANIED BY THE CORRECT ALGEBRAIC SIGN, AND IF PROGRAM

EXECUTION CONTINUES.

SECTION 60.1

(MACHINE INFINITY, POSITIVE.)

BEGIN TEST.

?OVERFLOW IN LINE 300

IF THE NUMBER PRINTED AFTER THIS STATEMENT IS POSITIVE

AND THE MACHINE INFINITY FOR THIS SYSTEM, THEN THE TEST

WILL HAVE PASSED.

1. 70141E+38

END TEST.

SECTION 60.2

(MACHINE INFINITY, NEGATIVE.)

BEGIN TEST.

70VERF LOW IN LINE 490

IF THE NUMBER PRINTED AFTER THIS STATEMENT IS NEGATIVE

AND THE MACHINE INFINITY FOR THIS SYSTEM, THEN THE TEST

WILL HAVE PASSED.

-1. 70141E+38

? OVERFLOW IN LINE 543

115
IF THE NUMBER PRINTED AFTER THIS STATEMENT IS POSITIVE

AND THE MACHINE INFINITY FOR THIS SYSTEM, THEN THE TEST

WILL HAVE PASSED.

1. 70141E+38

END TEST.

116
61.0 SEMANTIC TEST - ON THE MAGNITUDE OF A NONZERO

NUMERIC CONSTANT THAT IS TOO SMALL

The objective of this test is to verify that the implementation will

recognize a numerical constant, with a magnitude outside the

implementation-defined range, as a diagnosable error. Since numeric

constants are expressions ,their errors are handled in the same manner. If the

magnitude of the constant is too small then the implementation should supply

0 and continue. The ANSI Minimal BASIC standard does not require a diagnostic message in an underflow of this kind. If the magnitude is too

large then the implementation should supply machine infinity with the

appropriate sign. In the case of an overflow a diagnostic message is

required. The reader is referred to section 7.4 of BSR X3.60 for the

specifications.

This test will determine whether the implementation will supply a value

of zero for an extremely small value which most present implementations

cannot represent. For any value so close to zero that it is outside of the

implementation-defined range, a value of zero should be supplied by the

implementation and program execution continued.

This test uses a numerical constant, 10.0E-99999, which is too small to

be represented on most present day machines. The constant is assigned on line 310 and diagnostics might refer to this line. On encountering this

number, a processor should assign 0 to A and continue.

*******************

* PROGRAM FILE 61 * *******************

0010 PRINT

0060 PRINT

0070 PRINT

0080 PRINT

0090 PRINT

0100 PRINT

0110 PRINT

0120 PRINT

0130 PRINT

0140 PRINT

0150 PRINT

0160 PRINT

0170 PRINT

0200 PRINT

0210 PRINT

0220 PRINT

0280 PRINT

0290 PRINT

"PROGRAM FILE 61"

" SECTION 61.0: SEMANTIC TEST ON THE MAGNITUDE OF A"

" NONZERO NUMERIC CONSTANT."

" (THE MAGNITUDE IS TOO SMALL)"

" THE OBJECTIVE OF THIS SECTION IS TO DETERMINE WHETHER"

"UPON THE ASSIGNMENT OF A NONZERO CONSTANT WHICH IS TOO"

"SMALL FOR THE IMPLEMENTATION A ZERO WILL"

"BE SUPPLIED."

BEGIN TEST."

117
0310 LET A=10. 0E-99999

0320 PRINT " IF THE NUMBER PRINTED AFTER THIS STATEMENT IS ZERO,"

0330 PRINT "THEN THE TEST WILL HAVE PASSED."

0340 PRINT A

0350 PRINT

0360 PRINT " END TEST."

0370 PRINT

0380 END

*****************

* SAMPLE OUTPUT * *****************

PROGRAM FILE 61

SECTION 61.0: SEMANTIC TEST ON THE MAGNITUDE OF A

NONZERO NUMERIC CONSTANT.

(THE MAGNITUDE IS TOO SMALL)

THE OBJECTIVE OF THIS SECTION IS TO DETERMINE WHETHER

UPON THE ASSIGNMENT OF A NONZERO CONSTANT WHICH IS TOO

SMALL FOR THE IMPLEMENTATION A ZERO WILL

BE SUPPLIED.

BEGIN TEST.

IF THE NUMBER PRINTED AFTER THIS STATEMENT IS ZERO,

THEN THE TEST WILL HAVE PASSED.

0

118
62.0

EXCEPTION TEST - ON THE MAGNITUDE OF A NONZERO

NUMERIC CONSTANT THAT IS TOO LARGE

62.1

Positive Machine Infinity

This

var i able

.

pr inted

.

appear a the printed

X3. 60 .

test assigns

It requires

But, preceding

printed messag

constant

.

a numerical constant 9 . 99999E99999

the implementation-supplied machine

the output of the machine infinity,

e informing the user what sign to look

The reader is referred to section

to a s i mpie

i n fin ity be

the re sho uld

for pr eced i ng

i * 5 of BSR

62.2

Negative Machine Infinity

This test uses the numerical constant (-999999)E99999 assigned to a simple variable. On output, the test requires that the negative

implementation-supplied machine infinity be supplied and printed. Before

this value is printed, however, there should be an informative message to the

user as to what value should be printed in order that the user can judge

whether the implementation fails or passes the test.

* PROGRAM FILE 62 *

-kitis-k'k-k'k-k-k'k'k-kit^c-kic'k’k-k

0010

0060

0070

0080

0090

0100

0110

0120

0130

0140

0150

0160

0170

0180

0190

0200

0210

0220

0230

0240

0250

0260

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

LET A

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

"PROGRAM FILE 62"

" SECTION 62.1"

" (THE MAGNITUDE IS TOO LARGE, POSITIVE MACHINE INFINITY.)"

" BEGIN TEST."

=9. 99999E99999

" IF THE NUMBER PRINTED AFTER THIS STATEMENT IS POSITIVE

"AND THE MACHINE INFINITY FOR THIS SYSTEM, THEN THE TEST"

"WILL HAVE PASSED."

A

END TEST.

SECTION 62.2"

II

119
0270 PRINT

0280 PRINT " (THE MAGNITUDE IS TOO LARGE, NEGATIVE MACHINE INFINITY-)"

0290 PRINT

0300 PRINT

0310 PRINT " BEGIN TEST."

0320 PRINT

0330 LET A=-9. 99999E99999

0340 PRINT " IF THE NUMBER PRINTED AFTER THIS STATEMENT IS NEGATIVE"

0350 PRINT "AND THE MACHINE INFINITY FOR THIS SYSTEM, THEN THE TEST"

0360 PRINT "WILL HAVE PASSED."

0370 PRINT A

0380 PRINT

0390 PRINT " END TEST."

0400 PRINT

0410 END

*****************

* SAMPLE OUTPUT * *****************

PROGRAM FILE 62

SECTION 62.1

(THE MAGNITUDE IS TOO LARGE, POSITIVE MACHINE INFINITY.)

BEGIN TEST.

POVERFLOW IN LINE 160

IF THE NUMBER PRINTED AFTER THIS STATEMENT IS POSITIVE

AND THE MACHINE INFINITY FOR THIS SYSTEM, THEN THE TEST

WILL HAVE PASSED.

1. 70141E + 38

END TEST.

SECTION 62.2

(THE MAGNITUDE IS TOO LARGE, NEGATIVE MACHINE INFINITY.)

BEGIN TEST.

120
70VERFL0W IN LINE 330

IF THE NUMBER PRINTED AFTER THIS STATEMENT IS NEGATIVE

AND THE MACHINE INFINITY FOR THIS SYSTEM, THEN THE TEST

WILL HAVE PASSED.

-1. 70141E+38

END TEST.

121
63.0 DIM STATEMENT WITH THE OPTION STATEMENT

The objective of this test is to verify that, in using the

OPTION-statement with a lower bound of 1, implementations will recognize any

subscript value less than 1 as an exception. In this test arrays are explicitly dimensioned. The OPTION feature is in general not available in

existing processors . As a result, a user may obtain a diagnostic referencing an illegal statement in line 255. For new processors with this feature, there

should only be output diagnostics as in the sample output. A diagnostic is

required for a subscript of range as specified in section 6.5 of BSR

X3.60- For other specifications the user is referred to section 15 of

BSR X3. 60.

There should be an implementation-defined diagnostic for attempting to access the zero subscript element in lines 400 and 440. However, execution

of this program may terminate with a diagnostic reference to line 400 only.

Should the implementation

printed which will inform

recognize the subscripted

fail to recognize the error, the test has a message

the user that the implementation has failed to error

.

*******************

* PROGRAM FILE 63 * *******************

0010

0060

0070

0080

0090

0100

0110

0120

0130

0140

0150

0160

0170

0180

0190

0200

0210

0220

0230

0240

0250

0255

0260

0280

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

OPTION

DIM B ( LET B

1

"PROGRAM FILE 63"

SECTION 63.0"

(DIM-STATEMENT WITH THE OPTION-STATEMENT.)"

" * * * * *n 0TE j THE OBJECTIVE OF THIS PART IS TO DETERMINE"

"WHETHER THE SYSTEM RECOGNIZES WHEN AN UPPER BOUND OF ZERO"

"IS SPECIFIED FOR A SUBSCRIPT AS A FATAL ERROR (THAT IS,"

"SUSPENDING PROGRAM EXECUTION PENDING USER-DIRECTED RESTART"

"PROCEDURES) WHEN AN OPTION-STATEMENT SPECIFIES THAT ALL"

"LOWER BOUNDS ARE ONE.*****"

BEGIN TEST,

BASE 1 15, 15) ,C (25)

= 0

122
0290 LET B 2 = 0 0300 LET S 1=0

0310 LET S 2 = 0 0320 FOR 1=1 TO 15

0330 LET B(I # 12)=B1“2

0340 LET Bl=Bl+2

0350 NEXT I 0360 FOR 1=1 TO 15

0370 LET S1=S1+B (I , 12)

0380 NEXT I 0390 FOR 1=0 TO 25

0400 LET C (I ) = (B2+I

) ~2

0410 LET B 2=B 2+1

0420 NEXT I 0430 FOR 1=0 TO 25

0440 LET S2=S2+C (I

)

0450 NEXT I 0460 PRINT " WHETHER THERE ARE/ARE NOT ANY NUMERALS PRINTED BELOW“

0470 PRINT "THIS STATEMENT, THE SYSTEM HAS FAILED THE TEST."

0480 PRINT S1,S2

0490 PRINT

0500 PRINT " END TEST."

0510 PRINT

0520 END

*****************

* SAMPLE OUTPUT * *****************

PROGRAM FILE 63

SECTION 63.0

(DIM-STATEMENT WITH THE OPTION-STATEMENT.)

* * * * *NOTE : THE OBJECTIVE OF THIS PART IS TO DETERMINE

WHETHER THE SYSTEM RECOGNIZES WHEN AN UPPER BOUND OF ZERO

IS SPECIFIED FOR A SUBSCRIPT AS A FATAL ERROR (THAT IS,

SUSPENDING PROGRAM EXECUTION PENDING USER-DIRECTED RESTART

PROCEDURES) WHEN AN OPTION-STATEMENT SPECIFIES THAT ALL

LOWER BOUNDS ARE ONE.*****

BEGIN TEST.

123
? ARRAY INDEX OUT-OF-BOUNDS IN LINE 400

* .
64.0 USING THE OPTION BASE-STATEMENT TO CHANGE IMPLICIT

ARRAY LOWER BOUNDS

We know from previous tests that a program, written without OPTION BASE,

using implicitly dimensioned arrays, will have 0 as a lower bound for the

arrays. However, when OPTION BASE is introduced, we can increase the lower

bound of the arrays to 1. Thus, in order to test that this is so, we must

attempt to access the 0-th element of an array in a program with the

declaration OPTION BASE 1. A diagnostic is required by the standard, since a subscript of 0 would be out of bounds for the arrays. Processors may flag

line 80 as an illegal statement if they do not recognize the

OPTION-statement

.

*******************

* PROGRAM FILE 64 * *******************

0010

0020

0030

0040

0050

0060

0070

0080

0090

0100

0110

0120

0130

0140

0150

0160

0170

0180

0190

0200

0210

PRINT "PROGRAM FILE 64"

PRINT

PRINT

PRINT

PRINT " SECTION 64.0: OPTION BASE WITH IMPLICIT DIMENSIONING"

PRINT

PRINT " BEGIN TEST."

OPTION BASE 1 FOR 1=10 TO 0 STEP -1

LET A ( I

) =1

LET B ( I , I ) =1

NEXT I PRINT

PRINT " A(0)=";A(0) , " B ( 0 , 0

) =

" ; B ( 0 , 0

)

PRINT

PRINT " IF A ( 0

) =0 AND B(0,0)=0, THEN THE OPTION BASE STATEMENT DID"

PRINT " NOT AFFECT THE DEFAULT LOWER BOUND OF 0. TEST FAILED."

PRINT

PRINT " END TEST."

PRINT

END

*****************

* SAMPLE OUTPUT * *****************

125
PROGRAM FILE 64

SECTION 64.0: OPTION BASE WITH IMPLICIT DIMENSIONING

BEGIN TEST.

? ARRAY INDEX OUT-OF-BOUNDS IN LINE 100

126
65.0 TESTING THE ASSIGNMENT OF ZERO FOR AN EXPRESSION CAUSING

UNDERFLOW UPON EVALUATION

The objective of this test is to verify that the implementation will

assign a value of zero to an expression that causes an underflow. In this case a simple variable is assigned a numerical value generated by raising

999999 to the -99999 power. This value is too small to be represented in

general. On output, the test should print zero, after informing the user of

this expected value. The reader is referred to section 7.4 of BSR X3.60

for this section.

* PROGRAM FILE 65 * •ft******************

0010 PRINT

0060 PRINT

0070 PRINT

0080 PRINT

0090 PRINT

0100 PRINT

0110 PRINT

0120 PRINT

0130 PRINT

0140 PRINT

0150 PRINT

0160 LET X = 0170 LET X = 0180 PRINT

0190 PRINT

0200 PRINT

0210 PRINT

0220 PRINT

0230 PRINT

0240 END

"PROGRAM FILE 65"

"SECTION 65.0: TEST FOR ASSIGNMENT OF ZERO FOR AN EXPRESSION

" WHICH CAUSES UNDERFLOW UPON EVALUATION."

BEGIN TEST."

999999

999999^-99999

" IF ZERO IS PRINTED BELOW THIS STATEMENT THEN THE SYS-"

"TEM WILL HAVE PASSED THE TEST."

X

" END TEST."

II

•kic'k’k'k'klc'kiclc-k'k-k'k-klc’k * SAMPLE OUTPUT *

127
PROGRAM FILE 65

SECTION 65.0: TEST FOR ASSIGNMENT OF ZERO FOR AN EXPRESSION

WHICH CAUSES UNDERFLOW UPON EVALUATION.

BEGIN TEST.

IF ZERO IS PRINTED BELOW THIS STATEMENT THEN THE SYSTEM WILL HAVE PASSED THE TEST.

0 END TEST.

«

128
66.0

GOSUB/RETURN -STATEMENT

This test unit verifies the relationship between the GOSUB-statement and

the RETURN-statement . These statement types allow subroutines to be written

within a program. These subroutines differ from user-defined functions

because they in general might produce more complicated results than a single

value as the function routine would.

The action of the GOSUB and RETURN statements can be described in terms

of a stack concept. Prior to execution of the first GOSUB-statement by the

test, the stack should be empty. Each time a GOSUB-statement is executed,

the line number of the GOSUB-statement should be placed on top of the stack

and execution of the program should continue at the line specified in the

GOSUB-statement. Each time a RETURN-statement is executed, the line number

on top of the stack should be removed from the stack and execution of the

program should continue at the line following the one with that line number.

Equal numbers of GOSUB-statements and RETURN-statements need not necessarily

be executed before termination of a program. The reader should refer to

section 10.4 of BSR X3.60 for the specifications.

66.1

One GOSUB and One RETURN

This test verifies that a GOSUB-statement and a RETURN-statement perform

together. The control of the GOSUB-statement and the RETURN-statement is

checked by a counter, N. If the control action proves to be proper, the

value of N should be 2 at the termination of the test. On output, there

should be only one of two possible printed messages. These are statements to

the effect that the test either failed or passed. If the test fails, then

the following message should be printed: RELATION BETWEEN GOSUB/RETURN

,

FAILED TEST. If the test passes, then the following message should be

printed: RELATION BETWEEN GOSUB/RETURN, PASSED TEST.

66.2

Two GOSUB Statements Before a RETURN

The objective of this test is to verify that two GOSUB-statements can be

executed without an intervening RETURN-statement. Through the use of a counter, N, the performance of the two GOSUB-statements is checked as well as the performance of the RETURN-statement in conjunction with the last

GOSUB-statement. Upon proper performance of the two GOSUB-statements and the

RETURN-statement, the value of the counter should be 3. The output for this

test should be a message indicating pass or fail. If the test fails, then

the following message should be printed: TWO GOSUBS WITHOUT INTERVENING

RETURN, FAILED TEST. If the test passes, then the following message should

be printed: TWO GOSUBS WITHOUT INTERVENING RETURN, PASSED TEST.

66.3

Testing Proper GOSUB Returns

The purpose of this test is to verify the stack-like relationship

between GOSUB-statements and RETURN-statements through the use of nested

GOSUB-statements with RETURN-statements. There are four levels of nesting

performed by this test. The number of GOSUB-statements per level is equal to

the number of its level. For each level of GOSUB-statements, there is only

one RETURN-statement. This program also tests that an equal number of

129
GOSUB-statements and RETURN-statements need not necessarily be executed

before termination of a program. The output for this test should either be a fail or a pass message. If the test fails, then the following message should

be printed: GOSUB NESTING, FAILED TEST. If the test passes, then the

following message should be printed: GOSUB NESTING, PASSED TEST.

*******************

* PROGRAM FILE 66 * *******************

0010 PRINT "PROGRAM ] 0020 PRINT

0030 PRINT

0040 PRINT

0070 PRINT " 0080 PRINT

0090 PRINT " 0100 PRINT

0110 LET N=0

0120 GOSUB 190

0130 LET N=N+1

0140 IF N=2 THEN 170

0150 PRINT " 0160 GOTO 230

0170 PRINT " 0180 GOTO 210

0190 LET N=N+1

0200 RETURN

0210 PRINT

0220 PRINT " 0230 PRINT

0240 PRINT " 0250 PRINT

0260 PRINT " 0270 PRINT

0280 LET N = 0 0530 GOSUB 550

0540 PRINT " 0550 LET N=N + 1 0560 GOSUB 630

0570 LET N=N+1

0580 IF N=3 THEN 610

0590 PRINT " TWO

0600 GOTO 6

1 0 0610 PRINT " TWO

0620 GOTO 650

0630 LET N=N+1

0640 RETURN

0650 PRINT

SECTION 66.1: ONE GOSUB AND ONE RETURN."

BEGIN TEST.

RELATION BETWEEN GOSUB/RETURN , FAILED TEST."

RELATION BETWEEN GOSUB/RETURN, PASSED TEST."

END TEST."

SECTION 66.2: TWO GOSUBS BEFORE A RETURN."

BEGIN TEST."

ERROR, FIRST GOSUB FAILED."

130
0660 PRINT END TEST II 0670 PRINT

0680 PRINT (I 0690 PRINT

0700 PRINT II 0710 PRINT

0720 LET N = 0 0730 GOSUB 780

0740 IF N=24 THEN 940

0750 PRINT II 0760 PRINT

0770 GOTO 950

0780 GOSUB 860

0790 GOSUB 860

0800 RETURN

0810 GOSUB 900

0820 GOSUB 900

0830 GOSUB 900

0840 GOSUB 900

0850 RETURN

0860 GOSUB 810

0870 GOSUB 810

0880 GOSUB 810

0890 RETURN

0900 LET N =N+l

0910 IF N=7 THEN 890

0920 RETURN

0930 GOTO 750

0940 PRINT II 0950 PRINT

0960 PRINT II 0970 PRINT

0980 PRINT

0990 END

SECTION 66.3: TESTING PROPER GOSUB RETURNS"

BEGIN TEST."

GOSUB NESTING, FAILED TEST."

GOSUB NESTING, PASSED TEST."

END TEST."

*****************

* SAMPLE OUTPUT * *****************

PROGRAM FILE 66

SECTION 66.1: ONE GOSUB AND ONE RETURN.

BEGIN TEST.

RELATION BETWEEN GOSUB/RETURN , PASSED TEST.

131
END TEST.

SECTION 66.2: TWO GOSUBS BEFORE A RETURN.

BEGIN TEST.

TWO GOSUBS WITHOUT AN INTERVENING RETURN, PASSED TEST.

END TEST.

SECTION 66.3: TESTING PROPER GOSUB RETURNS

BEGIN TEST.

GOSUB NESTING, PASSED TEST.

END TEST.

132
67.0 SEMANTIC ERROR - TEST ON GOSUB TRANSFER TO AN ILLEGAL

LINE NUMBER

The objective of this test is to verify that the implementation will

recognize a transfer by a GOSUB-statement to a non-existent line as an error.

The test has a GOSUB-statement which uses a non-existent program line number

as its designated transfer point in line 260. Although this error is not

considered an exception it is not a meaningful construction and should be

handled by an implementation with a diagnostic pointing to an illegal line

number in line 260. After the diagnostic the program should be terminated.

On output, there should be some form of implementation-defined diagnostic.

However, the test does have a message printed should the implementation fail

to recognize the error or ignore the line with the error. The reader is

referred to section 10.4 of BSR X3.60 for the specifications.

*******************

* PROGRAM FILE 67 * *******************

0010

0 0 60

0070

0080

0090

0100

0110

0120

0130

0140

0150

0160

017 0 0180

0190

0200

0210

0220

0230

0240

0250

0260

0270

0280

0290

0300

0310

0320

0330

PRINT "PROGRAM FILE 67"

PRINT

PRINT

PRINT

PRINT " SECTION 67.0: GOSUB TO ILLEGAL LINE NUMBER"

PRINT

PRINT

PRINT

PRINT " THE OBJECTIVE OF THIS SECTION IS TO USE A GOSUB -STATE-"

PRINT "MENT WHICH REFERS TO A NON-EXISTENT LINE NUMBER IN ORDER TO"

PRINT "DETERMINE WHETHER THE SYSTEM WILL RECOGNIZE THIS PROCEDURE"

PRINT "AS A FATAL ERROR. THAT IS, SUCH A RECOGNITION BY THE SYS-"

PRINT "TEM WILL SUSPEND EXECUTION OF THE PROGRAM PENDING USER-"

PRINT "DIRECTED RESTART PROCEDURES. IF SUCH A RESULT SHOULD OCCUR,"

PRINT "THEN THE TEST WILL HAVE PASSED."

PRINT

PRINT

PRINT

PRINT " BEGIN TEST."

PRINT

LET F=0

GOSUB 123

IF F=1 THEN 300

PRINT "TEST FAILED BECAUSE GOSUB-STATEMENT WAS IGNORED."

GOTO 340

PRINT "TEST FAILED BECAUSE TRANSFER WAS MADE TO NON-EXISTENT LINE."

GOTO 340

LET F=1

RETURN

133
0340 PRINT

0350 PRINT " 0360 PRINT

0370 END

In order

reported. A

END TEST."

*****************

* SAMPLE OUTPUT * *****************

for this test to pass, an error must be diagnosed and

possible error diagnostic for this program might be:

? UNDEFINED LINE NUMBER 123 IN LINE 260
\

68.0 EXCEPTION TEST - RETURN-STATEMENT WITHOUT GOSUB

The objective of this test is to ver RETURN-statement without having executed

be diagnosed as an exception. This r termination of the program since. there

in the ANSI Minimal BASIC standard. On o implementation-defined diagnostic desc

However, the test is constructed to

implementation fails to recognize the

will inform the user that the implementat

referred to section 10.5 of BSR X3.60.

ify that attempting to execute a

a corresponding GOSUB-statement will

equires a diagnostic message and

are no specified recovery procedures

utput, there should be some form of

ribing the nature of the error,

allow, in the event that the

error, the output of a message that

ion failed the test. The reader is

*******************

* PROGRAM FILE 68 * *******************

0010 PRINT

0060 PRINT

0070 PRINT

0080 PRINT

0 09 0 PRINT

0100 PRINT

0110 PRINT

0120 PRINT

0130 PRINT

0140 PRINT

0150 PRINT

0160 PRINT

0170 PRINT

0180 PRINT

0190 PRINT

0200 PRINT

0210 PRINT

0220 PRINT

0230 PRINT

0240 PRINT

0250 RETURN

0260 PRINT

0270 PRINT

0280 PRINT

0290 PRINT

0300 END

"PROGRAM FILE 68"

SECTION 68.0: FATAL ERROR CHECK ON RETURN-STATEMENT."

" THE OBJECTIVE OF THIS SECTION IS TO EXECUTE A RETURN-"

"STATEMENT WITHOUT HAVING EXECUTED A CORRESPONDING GOSUB-"

"STATEMENT SO THAT IT MAYBE DETERMINED WHETHER SUCH AN EXE-"

" CUT I ON IS PERMISSIBLE BY THIS SYSTEM. IF THE SYSTEM SHOULD

"RECOGNIZE THIS EXECUTION AS A FATAL ERROR (THAT IS, SUS-"

"PENDING PROGRAM EXECUTION PENDING USER-DIRECTED RESTART"

"PROCEDURES), THEN THE TEST WILL HAVE PASSED."

BEGIN TEST."

"SYSTEM FAILED TEST."

END TEST.

135
*****************

* SAMPLE OUTPUT * *****************

PROGRAM FILE 68

SECTION 68.0: FATAL ERROR CHECK ON RETURN-STATEMENT.

THE OBJECTIVE OF THIS SECTION IS TO EXECUTE A RETURNSTATEMENT WITHOUT HAVING EXECUTED A CORRESPONDING GOSUBSTATEMENT SO THAT IT MAYBE DETERMINED WHETHER SUCH AN EXECUTION IS PERMISSIBLE BY THIS SYSTEM. IF THE SYSTEM SHOULD

RECOGNIZE THIS EXECUTION AS A FATAL ERROR (THAT IS, SUSPENDING PROGRAM EXECUTION PENDING USER-DIRECTED RESTART

PROCEDURES), THEN THE TEST WILL HAVE PASSED.

BEGIN TEST.

? RETURN BEFORE GOSUB IN LINE 250

136
69.0

TESTING ROUNDOFF TO SIX SIGNIFICANT DIGITS OF CONSTANTS

OF ARBITRARY LENGTH

The objective of this test is to verify that although the accuracy, with

which evaluation of an expression takes place, varies from implementation to

implementation, each implementation should attempt to maintain at least six

decimal digits of precision. For each test the output should contain a minimum of six significant digits. Fur thermore, programs can contain numeric

constants of an arbitrary number of digits, although an implementation may

choose to round them to no less than six significant digits. The reader is

referred to section 5.4 of BSR X3.60.

69.1

Using Numerically Assigned Constants of Six or Fewer

Significant Digits

The objective of this test is to verify, for various numerical

operations, that the implementation will maintain at least six decimal digits

of precision. This test uses constants of six digits or fewer. Although

rounding has been tested before for operations on numbers made up of less

than or equal to six significant digits, this part of the test is included

for completeness.

The test has a three column formatted output. In the first column,

titled "True Rounded Values", there should be a list of the expected rounded

values. In the second column, titled "System Rounded Values", there should

be a list of the system evaluations, as rounded by the implementation. In

the third column, titled "Absolute Error", there should be the listings of

marginal differences between the expected rounded values and the respective

implementation rounded values. If any value in the third column does not

fall within the expected or allowed range of one unit error in the position

of the sixth significant digit, then an asterisk should have appeared beside

that difference.

69.2

Using Numerically Assigned Constants of More Than Six Digits

of Significance

The

maintain

arbitrary

constants

assignmen

the same

objective of this test is to verify that the impl

at least six decimal digits of precision for

number of digits of precision. This test uses

that are composed of up to 1? decimal digits of p

ts are then used in various operations. On output,

output format described in section 69.1.

ementation will

numbers with an assignment of

recision. These

this test has

*******************

* PROGRAM FILE 69 * *******************

137
0010 PROGRAM FILE 69

0060

0070

0080

0090

0100

0110

0120

0130

0140

0150

0160

0170

0180

0190

0200

0210

0220

0230

0240

0250

0260

0270

0280

0290

0300

0310

0320

0330

0340

0350

0360

0370

0380

0390

0400

0410

0420

0430

0440

0450

0460

0470

0480

0490

0500

0510

0520

0530

0540

0550

0560

0570

0580

0590

0600

0610

PRINT " PRINT

PRINT

PRINT

PRINT " SECTION 69.0: ROUNDOFF."

PRINT

PRINT " (TESTING ROUNDOFF TO SIX SIGNIFICANT DIGITS.)"

PRINT

PRINT

PRINT

PRINT " IF NO ASTERISK FOLLOWS ANY VALUE IN THE ABSOLUTE ERROR"

PRINT "COLUMN, TEST PASSED. HOWEVER, IF AN ASTERISK FOLLOWS"

PRINT "A VALUE IN THE ABSOLUTE ERROR COLUMN, TEST FAILED BE-"

PRINT "CAUSE SYSTEM WOULD HAVE FAILED THE ERROR BOUND ROUND-OFF."

PRINT

PRINT

PRINT " TRUE "

, "SYSTEM " PRINT "ROUNDED" /’ROUNDED" , "ABSOLUTE"

PRINT " VALUE "," VALUE ERROR " PRINT 11 ************************************************** M • PRINT M **********************"

PRINT

PRINT

PRINT " SECTION 69.1"

PRINT

PRINT " *****USING NUMERICALLY ASSIGNED CONSTANTS OF SIX OR LESS SIG-”

PRINT "NIFICANT DIGITS.*****"

PRINT

PRINT

PRINT " BEGIN TEST."

PRINT

DIM A ( 1 2

)

LET A (1 ) =3. 74959

LET A ( 2

) =1 . E28

LET A (3) =1 . E-l

6

LET A (4 ) =9. 99999E-3 7 LET A (5) = 9. 99888E-1’7 LET F = 0 LET A $= " " LET B $ = " 9. 99888 " LET A (6) =A (1 ) *2. 66666

LET B=9. 99888

LET E=A ( 6

) -B

IF ABS (E) <=lE-5 THEN 500

LET A $ = " * " GOSUB 1000

LET A $ = " " LET B $ = " 3.74959 " LET A( 7 )=B/2. 66666

LET C =A ( 1

)

LET E=A

(

7 ) -C

IF ABS (E ) <=lE-5 THEN 580

LET A $ = " *

GOSUB 1000

LET A$=" " LET B $ = " 9.00000E3 7 " LET A (8) =A (2) *9. E9

138
0620

0630

0640

0650

0660

0670

0680

0690

0700

0710

0720

0730

0740

0750

0760

07 7 0 0780

0790

0800

0810

0820

0830

0840

0850

0860

0870

0880

0890

0900

0910

0920

0930

0940

0950

0960

0 9

7 0 0980

0990

1000

1010

1020

1030

1040

1050

10 60

1070

1080

1090

1100

1110

1120

1130

1140

1150

1160

117 0 1180

LET B=9.E37

LET E=A ( 8

) -B

IF ABS (E ) < = 1E 32 THEN 660

LET A$=" *

GOSUB 1000

LET A$=" " LET B $ = " 2.6214 4E-33 " LET A (9)=A(3) *. 262144E-16

LET B=2. 62144E-33

LET E=A ( 9

) -B

IF ABS (E) <=lE-38 THEN 740

LET A $ = " * " GOSUB 1000

LET A$ = " " LET B $ = " 99.9998 " LET A ( 1 0

) =A ( 4

) *9.99999E37

LET B=99 . 9998

LET E=A ( 1 0

) -B

IF ABS (E ) <=lE-4 THEN 820

LET A $ = " *

GOSUB 1000

LET A$=" " LET B $ = " 2 . 66666E-3 3

" LET A ( 1 1

) =A ( 5 ) /3. 7 4959E16

LET B=2 . 66666E-33

LET E=A ( 1 1

) -B

IF ABS (E) <=lE-38 THEN 900

LET A

$= " *

GOSUB 1000

LET A$= " " LET B $ = " 524288 " LET A (12) =524287+1

LET B = 524 288

LET E=A (12) -B

IF ABS (E ) < = 1E0 THEN 980

LET A

$= " *

GOSUB 1000

GOTO 1060

IF FOB THEN 1020

LET 1=6

PRINT B $ , A ( I )

, E ; A $

LET 1=1+1

LET F=1

RETURN

PRINT

PRINT " END TEST.

PRINT

PRINT

PRINT

PRINT " SECTION 69.2"

PRINT

PRINT " *****USING NUMERICALLY ASSIGNED CONSTANTS OF MORE THAN SIX"

PRINT "DIGITS OF SIGNIFICANCE.*****"

PRINT

PRINT

PRINT " BEGIN TEST."

PRINT

139
1190

1200

1210

1220

1230

1240

1250

1260

1270

1280

1290

1300

1310

1320

1330

1340

1350

1360

1370

1380

1390

1400

1410

1420

1430

1440

1450

1460

1470

1480

1490

1500

1510

1520

1530

1540

1550

1560

1570

1580

1590

1600

1610

1620

1630

1640

1650

1660

1670

1680

1690

1700

1710

1720

1730

1740

1750

LET A(1)=3.749586439134E0

LET A (2) =. 15707963267948966E+28

LET A(3)=.10004783691736557E-34

LET A(4)=9.9999999999999996E-36

LET A(5)=9.9996666866652382E-17

LET F = 0 LET A$=" " LET B $ = " 9.99889 " LET A (6)=A(1) *2. 66 6 6 6 3 52789 3 IE 0 LET B=9. 99889

LET E=A ( 6

) -B

IF ABS (E ) <=lE-5 THEN 1320

LET A $ = " *

GOSUB 1820

LET A

$= " " LET B$=" 3.74959 " LET A (7) =9. 998 8 8 54 02/2. 66666 3 52 78 93 IE

0

LET C=3. 74959

LET E=A

(

7 ) -C

IF ABS ( E ) <=1E- 5 THEN 1400

LET A $ = " *

GOSUB 1820

LET A

$= " " LET B $ = " 1.05988E32 " LET A(8)=A(2)*.67474094222355266E5

LET B=1 . 05988E32

LET E=A ( 8

) -B

IF ABS (E ) <=1E27 THEN 1480

LET A $ = " * " GOSUB 1820

LET A$=" " LET B $ = " 3.73503E-33 " LET A (9)=. 37332419967990016E3 * A(3)

LET B=3. 73503E-33

LET E=A ( 9

) -B

IF ABS (E) <=lE-38 THEN 1560

LET A $ = " *

GOSUB 1820

LET A $ = " " LET B $ = " 100 " LET A (10) =A (4) *9. 999999999999999 6E 36

LET B=100

LET E=A ( 10 ) -B

IF ABS (E ) <=lE-3 THEN 1640

LET A $ = " *

GOSUB 1820

LET A$=" " LET B$=" 3 . 81 958E-33 " LET A(11)=A (5) /2. 618001412710174 8E 16

LET B=3. 81958E-33

LET E=A (11) -B

IF ABS (E) <=lE-38 THEN 1720

LET A $ = " * " GOSUB 1820

LET A$=" " LET B $ = " 3.0 37 6

" LET A (12) =. 14801364 39 594 151 5E1+. 15574637835007 50 9E1

lliO
1760 LET B = 3 . 0 37

6

1770 LET E=A ( 1 2

) -B

1780 IF ABS (E ) <=lE-5 THEN 1800

1790 LET A $ = " *

1800 GOSUB 1820

1810 GOTO 1880

1820 IF FOB THEN 1840

1830 LET 1=6

1840 PRINT B$,A(I) ,E;A$

1850 LET 1=1+1

1860 LET F=1

1870 RETURN

1880 PRINT

1890 PRINT " END TEST."

1900 PRINT

1910 PRINT

1920 END

*****************

* SAMPLE OUTPUT * *****************

PROGRAM FILE 69

SECTION 69.0: ROUNDOFF.

(TESTING ROUNDOFF TO SIX SIGNIFICANT DIGITS.)

IF NO ASTERISK FOLLOWS ANY VALUE IN THE ABSOLUTE ERROR

COLUMN, TEST PASSED. HOWEVER, IF AN ASTERISK FOLLOWS

A VALUE IN THE ABSOLUTE ERROR COLUMN, TEST FAILED BECAUSE SYSTEM WOULD HAVE FAILED THE ERROR BOUND ROUND-OFF.

TRUE SYSTEM

ROUNDED ROUNDED ABSOLUTE

VALUE VALUE ERROR ************************************************************************

SECTION 69.1

*****USING NUMERICALLY ASSIGNED CONSTANTS OF SIX OR LESS SIGNIFICANT DIGITS.*****

lLl
BEGIN TEST

9.99888

3.74959

9. 00000E37

2. 62144E-33

99.9998

2. 66666E-33

524288

9.99888

3.74959

9. 00000E+37

2. 62144E-33

99.9998

2. 66666E-33

524288

0

0

0

0

0

00 END TEST.

SECTION 69.2

* * * * *US ING NUMERICALLY ASSIGNED CONSTANTS OF MORE THAN SIX

DIGITS OF SIGNIFICANCE.*****

BEGIN TEST.

9.99889 9.99889 0

3

.

7 4959 3

.

7 4 959 0 1. 05988E32 1. 05988E+32 0 3. 73503E-33 3.73503E-33 0 100 100 0 3. 81958E-33 3. 81958E-33 0 3.0376 3.0376 0 END TEST
70.0

THE ON-GOTO STATEMENT

This test verifies that the ON-GOTO statement for the test system can

round its numeric expression to an integer and use that integer to select the

appropriate line number from a list of line numbers following the GOTO. In

particular, suppose that there are N line numbers. Then, if the statement

expression is rounded to an integer M, this integer is either less than 1, one of the integers from 1 to N } or greater than N. If M is one of the

integers 1 to N then the control statement transfers control to the M-th line

number in the list. Otherwise, the system must report an exception. The

reader is referred to section 10 of BSR X3.60.

70.1

The ON-GOTO Numeric Expression, Using an Integer Within Range

The objective of this test is to show that the conditional transfer

should be performed properly if the simple variable I, used in the ON-GOTO

expression, is an integer from 1 to 5. 5 is the list length. I is also the

simple variable of a FOR-NEXT loop which uses integers for its initial value

and limit, and has no STEP clause. The test informs the user when the

transfer was not made by the ON-GOTO-statement to the correct statement. If

there is no transfer, then the following message should be printed: THE

<number> ON-GOTO TRANSFER, FAILED. Then, the following message should be

printed: ERROR, TRANSFER SHOULD HAVE BEEN TO LINE NO. <number> IN LIST.

That the transfer was actually made to the correct statement is determined by

an IF-THEN statement. This tests the FOR-NEXT loop index. There is a counter that acts as a bookkeeper for the number of correct transfers, which

in this case should be five. If this counter is not five, then the following

message should be printed: ON-GOTO-STATEMENT, FAILED TEST. If the counter

is five, then the following message should be printed: ON-GOTO-STATEMENT,

PASSED TEST.

70.2

The ON-GOTO Numeric Expression, As a Fraction Rounded

to an Integer

This test determines the round-off capability of the ON-GOTO-statement

for numeric expressions. The Minimal BASIC standard requires rounding of the

expression value to the nearest integer before performing the transfer. The

numeric expression in this test is the simple control variable of a FOR-NEXT

loop in which the initial value is incremented in steps of .5 to the limit.

K counts the number of passes through the loop. In this case there should be

5. On the first pass (K=l), transfer should be to the first ON-GOTO line

number. On the second and third, the transfer should be to the second line

number and finally, on the fourth and fifth passes, the transfer should be to

the third line number. There is then one transfer to the first number and

two each to the second and third line numbers. These counts are tested by

the variables A, B, and C, respectively. If the ON-GOTO statement fails and

the program continues, then a message follows: THE <number> ON-GOTO

TRANSFER, FAILED. The second possible message is as follows: ERROR,

TRANSFER SHOULD HAVE BEEN TO LINE NO. <number> IN LIST. Finally, the

variables A, B, and C are each used to keep count of the number of transfers

made by the ON-GOTO statement to the line numbers in the ON-GOTO list. The

values of the correct number of transfers by A, B, and C should be 1, 2, and

2 respectively. Proper transfers by the ON-GOTO-statement are determined by

IF-THEN-statements which are placed at each of the line numbers of the

1U3
ON-GOTO list. If upon completion of the FOR-NEXT loopings, the values of the

counters A, B, and C are not 1, 2, and 2 respectively, the following message

should be printed: ON-GOTO-STATEMENT, FAILED TEST. If the value of the

counters A, B, and C are in order, then the following message should be

printed: ON-GOTO-STATEMENT, PASSED TEST.

70.3 The ON-GOTO Numeric Expression, As An Expression of More

Than One Term

This test verifies the proper evaluation and use for transfer control of

an expression of more than one term by the ON-GOTO-statement . For this test,

as for the previous tests, the evaluation should be based on the nearest

integer value of the expression. Through the use of FOR-NEXT loops,

different values are assigned for the evaluation of the numeric expression by

the ON-GOTO-statement. The values of the numeric expression should be 1, 2,

3, 4, and 5. These values should be the position indices of the line numbers

in the ON-GOTO list. Within the FOR-NEXT loop, there are two checks on the

ON-GOTO-statement, and two counters. The first counter again keeps count of

which transfer is being made and is used in the first error message. In the

second error message, it acts as a pointer to the correct line number in the

ON-GOTO list. The two messages should be the same as in the past two tests.

Upon completion of the FOR-NEXT loops, as a means for checking the proper

performance of the ON-GOTO-statement, the value of the second counter is

checked for a value of 5. If the value of the count is not five, then the

following message should be printed: ON-GOTO-STATEMENT, FAILED TEST. If the

value of the count is five, then the following message should be printed:

ON-GOTO-STATEMENT, PASSED TEST.

*******************

* PROGRAM FILE 70 * *******************

0010 PRINT "PROGRAM FILE 70"

0020 PRINT

0030 PRINT

0040 PRINT

0050 PRINT " SECTION •70. 0: THE ON-GOTO STATEMENT"

0080 PRINT

0090 PRINT " SECTION 70. 1: THE ON-GOTO NUMERIC EXPRESSION"

0100 PRINT

0110 PRINT " USING AN INTEGER WITHIN RANGE"

0120 PRINT

0130 PRINT " BEGIN TEST."

0140 PRINT

0150 LET K= 0 0160 LET N=0

0170 FOR 1=1 TO 5 0180 LET K=K+1
0190

0200

0210

0220

0230

0240

0250

0260

0270

0280

0290

0300

0310

0320

0330

0340

0350

0360

0370

0380

0390

0 4 0 0 0410

0420

0430

0440

0450

0455

0457

0460

0470

0480

0490

0500

0510

0520

0530

0540

0550

0560

0570

0580

0590

0600

0610

0620

0630

0640

0650

0 660

0670

0680

0690

0700

0710

0720

0730

ON I GOTO 220,240,260,280,300

PRINT TAB (20) ; "THE" ;K; "ON-GOTO TRANSFER, FAILED."

PRINT

IF 1=1 THEN 320

GOTO 340

IF 1=2 THEN 320

GOTO 340

IF 1=3 THEN 320

GOTO 340

IF 1=4 THEN 320

GOTO 340

IF 1=5 THEN 320

GOTO 340

LET N=N+1

GOTO 350

PRINT "ERROR, TRANSFER SHOULD HAVE BEEN TO LINE NO.";K;"IN LIST

NEXT I PRINT

IF N=5 THEN 400

PRINT " ON-GOTO-STATEMENT, FAILED TEST."

GOTO 430

PRINT " PRINT

PRINT " PRINT

PRINT " PRINT

PRINT " PRINT

PRINT " PRINT

LET A=0

LET B=0

LET C=0

LET K=0

FOl C = 1 TO 3 STEP .5

LET K=K+1

ON I GOTO 570,590,620

PRINT TAB (20) ; "THE" ; K; "ON-GOTO TRANSFER, FAILED."

PRINT

IF 1=1 THEN 730

GOTO 640

IF 1=1.5 THEN 750

IF 1=2.0 THEN 750

GOTO 640

IF 1=2.5 THEN 770

IF 1=3.0 THEN 770

IF K=1 THEN 680

IF K>=4 THEN 700

LET F=2

GOTO 710

LET F=1

GOTO 710

LET F=3

PRINT "ERROR, TRANSFER SHOULD HAVE BEEN TO LINE NO." ;F;"IN LIST

GOTO 780

LET A=A+1

ON-GOTO-STATEMENT, PASSED TEST."

END TEST."

SECTION 70.2: THE ON-GOTO NUMERIC EXPRESSION"

AS A FRACTION ROUNDED TO AN INTEGER"

BEGIN TEST."
0740 GOTO 780

0750 LET B=B+1

0760 GOTO 780

0770 LET C=C + 1 0780 NEXT I 0790 PRINT

0800 IF A=1 THEN 820

0810 GOTO 850

0820 IF B = 2 THEN 840

0830 GOTO 850

0840 IF C=2 THEN 870

0850 PRINT M ON-GOTO-STATEMENT, FAILED TEST.

0860 GOTO 900

0870 PRINT " ON-GOTO-STATEMENT, PASSED TEST.

0880 PRINT

0890 PRINT " END TEST."

0900 PRINT

0910 PRINT " SECTION 70.3: THE ON-GOTO NUMERIC EXPRESSION"

0913 PRINT

0915 PRINT " AS AN EXPRESSION OF MORE THAN ONE TERM"

0920 PRINT

0930 PRINT " BEGIN TEST."

0940 PRINT

0950 LET K=0

0960 LET N=0

0970 FOR 1=1 TO 5 0980 ON (3*1-2) -2 *(I-1) GOTO 1010,1030,1050,1070,1090

0990 PRINT TAB (20) ; "THE" ;K;ON-GOTO TRANSFER, FAILED."

1000 PRINT

1010 IF 1=1 THEN 1110

1020 GOTO 1130

1030 IF 1=2 THEN 1110

1040 GOTO 1130

1050 IF 1=3 THEN 1110

1060 GOTO 1130

1070 IF 1=4 THEN 1110

1080 GOTO 1130

1090 IF 1=5 THEN 1110

1100 GOTO 1130

1110 LET N=N + 1 1120 GOTO 1140

1130 PRINT " ERROR TRANSFER SHOULD HAVE BEEN TO LINE NO." ; K

; "IN LIST

1140 NEXT I 1150 PRINT

1160 IF N=5 THEN 1190

1170 PRINT " ON-GOTO-STATEMENT, FAILED TEST.

1180 GOTO 1220

1190 PRINT " ON-GOTO-STATEMENT, PASSED TEST.

1200 PRINT

1210 PRINT " END TEST."

1220 PRINT

1230 PRINT

1240 END

146
*****************

* SAMPLE OUTPUT * *****************

PROGRAM FILE 70

SECTION 70.0: THE ON-GOTO STATEMENT

SECTION 70.1: THE ON-GOTO NUMERIC EXPRESSION

USING AN INTEGER WITHIN RANGE

BEGIN TEST.

ON-GOTO-STATEMENT, PASSED TEST.

END TEST.

SECTION 70.2: THE ON-GOTO NUMERIC EXPRESSION

AS A FRACTION ROUNDED TO AN INTEGER

BEGIN TEST.

ON-GOTO-STATEMENT, PASSED TEST.

END TEST

SECTION 70.3: THE ON-GOTO NUMERIC EXPRESSION

AS AN EXPRESSION OF MORE THAN ONE TERM

BEGIN TEST.

ON-GOTO-STATEMENT, PASSED TEST.

END TEST.

147
71.0 SEMANTIC DIAGNOSTIC - ON-GOTO STATEMENT REFERRING TO A

NON-EXISTENT LINE NUMBER

This test verifies that the implementation will recognize when a transfer to an illegal line number is attempted by the ON-GOTO statement. In

particular, the objective is to determine whether an attempted transfer of

this sort in line 380 will be considered by the implementation as an error requiring a diagnostic and program termination. On output, there should be some form of implementation-defined diagnostic. However, should the

implementation fail to recognize this error, the program prints a message

which tells the user that the implementation failed the test. The reader is

referred to section 10.4 of BSR X3.60.

*******************

* PROGRAM FILE 71 * *******************

0010 PRINT

0020 PRINT

0030 PRINT

0040 PRINT

0090 PRINT

0100 PRINT

0110 PRINT

0120 PRINT

0130 PRINT

0140 PRINT

0150 PRINT

0160 PRINT

0170 PRINT

0180 PRINT

0190 PRINT

0200 PRINT

0210 PRINT

0220 PRINT

0230 PRINT

0240 PRINT

0250 PRINT

0260 PRINT

0270 PRINT

0280 PRINT

0290 PRINT

0310 PRINT

0320 PRINT

0330 PRINT

0340 PRINT

0350 PRINT

0360 PRINT

"PROGRAM FILE 71"

SECTION 71.0: FATAL ERROR TEST - ON-GOTO-STATEMENT .

" THE OBJECTIVE OF THIS SECTION IS TO DETERMINE WHETHER"

"THIS SYSTEM RECOGNIZES THE FOLLOWING AS FATAL ERRORS (THAT"

"IS, SUSPENDING PROGRAM EXECUTION PENDING USER-DIRECTED RE-"

"START PROCEDURES):"

" (1) WHEN AN ON-GOTO-STATEMENT REFERS TO A NON-EXISTENT"

" LINE NUMBER, OR"

" (2) WHEN THE INTEGER OBTAINED AS THE VALUE OF AN EX-"

PRESS ION IN AN ON-GOTO-STATEMENT IS LESS THAN ONE"

" OR GREATER THAN THE NUMBER OF LINE NUMBERS IN THE"

" LIST."

"IF BOTH OF THE ABOVE REFERRALS ARE CONSIDERED FATAL ERRORS,"

"THEN THE TEST WILL HAVE PASSED."

(A REFERRAL TO A NON-EXISTENT LINE NUMBER.)"

BEGIN TEST."

1U8
0370 LET X=1

0380 ON X GOTO 159

0390 PRINT "SYSTEM FAILED TEST."

0400 PRINT

0410 PRINT " 0420 PRINT

0430 END

END TEST."

*****************

* SAMPLE OUTPUT * *****************

In order for

reported. A poss

this test

ible error

to pass , a diagnosticfatal error must be diagnosed

for this program might be:

and

? UNDEFINED LINE NUMBER 159 IN LINE 380

1U9
72.0 EXCEPTION TEST VALUE OF ON-GOTO EXPRESSION LESS THAN ONE

This test verifies that the implementation recognizes the numeric

expression evaluation with values less than one as an exception. The test

has an ON-GOTO-statement which uses an expression that should round to an integer less than one at line 170. In this case the expression is a simple

variable with a value of .3 that should be rounded to 0. On output, there

should be some form of implementation-defined diagnostic. However, the test

is structured to print a message of the implementation’s failure should the

test system not recognize the error. The reader is referred to section 10.5

of BSR X3. 60

.

*******************

* PROGRAM FILE 72 * *******************

0010 PRINT "PROGRAM FILE 72"

0060 PRINT

0070 PRINT

0080 PRINT

0090 PRINT II SECTION 72.0"

0100 PRINT

0110 PRINT " (VALUE OF ON-GOTO EXPRESSION

0120 PRINT

0130 PRINT

0140 PRINT II BEGIN TEST.

0150 PRINT

0160 LET X= 3 0170 ON X GOTO 190

0180 PRINT

0190 PRINT "SYSTEM FAILED TEST."

0200 PRINT

0210 PRINT II END TEST."

0220 PRINT

0230 END

LESS THAN ONE.)

II

•I

*****************

* SAMPLE OUTPUT * *****************

150
PROGRAM FILE 72

SECTION 72.0

(VALUE OF ON-GOTO EXPRESSION LESS THAN ONE.)

BEGIN TEST.

? ON EVALUATED OUT OF RANGE IN LINE 170

151
73.0 EXCEPTION TEST - VALUE OF ON -GOTO

THAN THE NUMBER OF LINE NUMBERS

EXPRESSION GREATER

IN THE LIST

The objective of this test is to compute an integer value for the

numerical expression used in an ON-GOTO-statement . In this case the integer

value should be greater than the number of line numbers listed in the

ON-GOTO-statement. The test determines whether the implementation recognizes

this as an exception. The program has a simple variable, X, assigned the

value 2 in line 170 but an ON-GOTO with one line number in its list in line

180. Then, X is used as the expression in line 180. On output, there should

be some form of implementation-defined diagnostic relating to the error. should the implementation fail to recognize the error, a message

printed to the user. The reader is referred to section

However

,

will be

X3. 60 . 10.5 of BSR

*******************

* PROGRAM FILE 73 * *******************

0010 PRINT "PROGRAM

0060 PRINT

0070 PRINT

0080 PRINT

0090 PRINT •1 0100 PRINT

0110 PRINT " (VALU

0115 PRINT

0120 PRINT H 0130 PRINT

0140 PRINT

0150 PRINT n 0160 PRINT

0170 LET X=2

0180 ON X GOTO 190

0190 PRINT

0200 PRINT “SYSTEM

0210 PRINT

0220 PRINT II 0230 PRINT

0240 END

SECTION 73.0"

(VALUE OF ON-GOTO EXPRESSION GREATER THAN

LINE NUMBERS IN THE LIST

BEGIN TEST."

END TEST."

THE NUMBER OF"

) "

*****************

* SAMPLE OUTPUT * *****************
PROGRAM PILE 73

SECTION 73.0

(VALUE OF ON-GOTO EXPRESSION GREATER THAN THE NUMBER OF

LINE NUMBERS IN THE LIST.)

BEGIN TEST.

? ON EVALUATED OUT OF RANGE IN LINE 180

153
74.0

READ/DATA STATEMENTS

These next eight sections are oriented towards testing (1) whether the

READ-statement assigns values, provided by DATA-statements , to variables, and

(2) whether the RESTORE-statement enables the rereading of those same values.

The values supplied by DATA-statements can be either numeric constants,

string constants, or unquoted strings. All of the data from the totality of

DATA-statements should be collected together into a data sequence. It should

not matter where DATA-statements are located in a program as long as they occur before the END-statement . However, the order in which the different

types of data occur should determine the order of the variables within the

variable list of the READ-statements . That is, the order of the numeric

variables must match that of the numeric constants within the data sequence

and the same for string variables. If there are variables in READ-statements

with subscripted expresions, then the expressions are evaluated after values

have been assigned to any variables preceding those subscripted variables (to

the left of them in the list). By the use of the RESTORE-statement, the

pointer associated with the data sequence should be reset to the beginning of

the data sequence so that the next READ-statement executed will read data

from the beginning of the sequence once again. The reader is referred to

section 14 of BSR X3.60 for the specifications.

74.1

READ/DATA for Numeric Variables

The objective of this section is to introduce the READ/DATA relationship

by assigning numerical constants to both simple and subscripted variables.

74.1.1

For Simple Variables

This test determines whether a list of numeric constants can be assigned

to a list of simple numeric variables through the READ-statement and

DATA-statement . The test has three numeric constants in the DATA-statement

assigned to three simple variables by a READ. The numeric constants are in

the forms NR1, NR2 , and NR3. On output there should be a message flagging

false assignments by the READ-statement. Each of the error messages should

read as follows: READ ASSIGNMENT FOR VARIABLE NUMBER <number>, FAILED. If

each variable assignment is proper then the following message should be

printed: READ/DATA ASSIGNMENTS FOR SIMPLE VARIABLES, PASSED TEST.

74.1.2

For Subscripted Variables

The objective of this section is to execute READ/DATA assignments for

both singly and doubly subscripted arrays.

74. 1.2.1 As One-Dimensional Arrays

This test uses one-dimensional arrays for four subscripted variables.

Two are assigned values by use of LET-statements . These values have also

been entered into a DATA-list. The other two variables used in the

READ-statement should be assigned the same values as the first two

subscripted variables after the READ-statement has been executed. The values

of the assignments are checked by use of IF-THEN-statements . The test also

154
verifies incidentally that DATA-statements can be placed anywhere in the

program before the END-statement . On output, there should be an error message for any faulty READ assignments. Each of the error messages should

be printed as follows: READ ASSIGNMENT FOR VARIABLE NUMBER <number>, FAILED.

If each variable assignment is correct, then the following message should be

printed: READ/DATA ASSIGNMENTS FOR ONE-DIMENSIONAL ARRAYS, PASSED. 74.1.2.2

As Two-Dimensional Arrays

In this test, two-dimensional arrays are used in a manner similar to

that in 74.1.2.1. Two of the four subscripted variables are assigned values

through the use of LET-statements . The remaining two variables, used in the

READ-list, should be assigned the same values. On output there should be a printed message for any faulty READ assignment. Each of thpse error messages

should appear as follows: READ ASSIGNMENT FOR VARIABLE NUMBER <number>,

FAILED. If each assignment is correctly made, then the following message

should be printed: READ/DATA ASSIGNMENTS FOR TWO-DIMENSIONAL ARRAYS, PASSED.

74.2

READ/DATA for String Variables

The object of this test is to assign string constants to string

variables by using the READ-statement and DATA-statement . Three string

constants ("ASSIGNING", "STRING", and "CONSTANTS") are assigned to three

string variables (A$, B$, and C$). These assignments are then checked. On

output there should be an error message for any faulty assignment. Each of

these error messages should appear as follows: READ ASSIGNMENT FOR VARIABLE

NUMBER <number>, FAILED. If there are no faulty assignments, then the

following message should be printed: READ/DATA ASSIGNMENTS FOR STRING VARS.,

PASSED TEST.

74.3

READ/DATA for Numerical and String Variables Together

The object of this test is to verify that there should be a single

sequence of data items, rather than separate sequences, for string data and

for numeric data. However, if the DATA-list is a mixture of numeric

constants and string constants, then the order of the mixture of numeric

variables and string variables in the READ-list must correspond to the

mixture in the DATA-list. That is, the type of a datum in the data sequence

must correspond to the type of the variable to which it is to be assigned,

(which means numeric variables require numeric constants as data and string

variables require quoted strings or unquoted strings as data. On output

there should be an error message for any incorrect assignment. Each of the error messages should appear as follows: READ ASSIGNMENT FOR VARIABLE NUMBER

<number>, FAILED. If all assignments are correct then the following message

should be printed: READ/DATA ASSIGNMENTS FOR NUM/STRG VARS. TOGETHER,

PASSED.

74.4

Evaluation of Subscripted Variables

This test confirms (1) that subscripted expressions in the variable list

are evaluated after values have been assigned to the variables preceding them

(that is, to the left of them) in the list, and (2) that any previous LET

assignments for the index should be ignored. The test first assigns values

155
to the elements of the array A ( I ) by a LET-statement. After the values have

been assigned to the array A(I), the index I is assigned a value by a LET-statement in order to select one of the elements of the array A(I).

Then, another value is assigned to the index I by a READ-statement and a DATA-statement . At this point the index value assigned by the LET-statement

should be nullified, and the index value for I assigned by the READ and

DATA-statements should take precedence. This controls the element assigned

to the subscripted variable A(I) in the READ-1 i st . On output one of two

possible messages should be printed. If the test fails, then the following

message should be printed: EVALUATION OF SUBSCRIPT EXP. IN VARIABLE LISTS,

FAILED. If the test is passed, then the following message should be printed:

EVALUATION OF SUBSCRIPT EXP. IN VARIABLE LISTS, PASSED.

*******************

* PROGRAM FILE 74 * *******************

0010 PRINT "PROGRAM FILE 74"

0020 PRINT

0030 PRINT

0040 PRINT

0070 PRINT

0080 PRINT " SECTION 74.1: READ/DATA FOR NUMERIC VARIABLES."

0090 PRINT

0100 PRINT " SECTION 74.1.1: FOR SIMPLE VARIABLES."

0110 PRINT

0120 PRINT " BEGIN TEST."

0130 PRINT

0140 LET K=0

0150 DATA 123456, -4. 76567, 1.111E33

0160 READ M , N ,

0

0170 LET K=K+1

0180 IF M=123456 THEN 200

0190 GOSUB 270

0200 LET K=K+1

0210 IF N=-4. 76567 THEN 230

0220 GOSUB 270

0230 LET K=K+1

0240 IF 0=1 . 11 IE 33 THEN 290

0250 GOSUB 270

0260 GOTO 320

0270 PRINT TAB (12) ; "READ ASSIGNMENT FOR VARIABLE NUMBER" ;K;", FAILED."

0280 RETURN

0290 PRINT "READ/DATA ASSIGNMENTS FOR SIMPLE VARIABLES, PASSED TEST."

0300 PRINT

0310 PRINT " END TEST."

0320 PRINT

0330 PRINT " SECTION 74.1.2: FOR SUBSCRIPTED VARIABLES."

0340 PRINT

156
0350

0360

0370

0380

0390

0400

0410

0420

0430

0440

0450

0460

0470

0480

0490

0500

0510

0520

0530

0540

0550

0560

0570

0580

0590

0600

0610

0620

0630

0640

0650

0660

0670

0680

0690

0700

0710

0720

0730

0740

0750

0760

0770

0780

0790

0800

0810

0820

0830

0840

0850

0860

0870

0880

0890

0900

0910

PRINT " SECTION 74.1.2.1: AS ONE-DIMENSIONAL ARRAYS."

PRINT

PRINT " BEGIN TEST."

PRINT

DIM A ( 1 5 ) r B (15) ,C (15) ,D (15)

LET F = 0 DATA -9, -1.75, -8, -.7 5, -7, .25,-6,1.25,-5,2.25

FOR 1=1 TO 15

READ A (I) ,B (I)

LET C ( I

) =1—10

LET D (I ) =1-2. 75

NEXT I DATA -4,3.25,-3,4.25,-2,5.25,-1,6.25,0,7.25

LET K=0

FOR 1=1 TO 15

LET K=K+1

IF A (I )=C (I ) THEN 530

GOSUB 620

LET K=K+1

IF B ( I

) =D ( I ) THEN 560

GOSUB 620

NEXT I DATA 1,8.25,2,9.25,3,10.25,4,11.25,5,12.25

IF F=0 THEN 650

PRINT

PRINT " DO TO THE ABOVE ERROR (S ) , TEST FAILED."

GOTO 680

LET F=F+1

PRINT TAB (12) ; "READ ASSIGNMENT FOR VARIABLE NUMBER" ; K

; " , FAILED."

RETURN

PRINT "READ/DATA ASSIGNMENTS FOR ONE-DIMENSIONAL ARRAYS, PASSED."

PRINT

PRINT " END TEST."

PRINT

PRINT " SECTION 74.1.2.2: AS TWO-DIMENSIONAL ARRAYS."

PRINT

PRINT " BEGIN TEST."

PRINT

DIM M ( 2 , 15 ) ,N(2,15) , X ( 2 , 1 5 ), Y ( 2 , 1 5

)

LET F=0

DATA -1, -4. 25, 0,-3. 25, 1, -2. 25, 2,-1. 25, 3,-. 25, 4, . 75

DATA 5,1.75,6,2.75,7,3.75,8,4.75,9,5.75,10,6.75

FOR 1=1 TO 2 FOR J=1 TO 15

READ M (I, J) ,N (I, J)

LET X ( I , J

) =J-2 *1

LET Y(I,J)=I*J-5.25

NEXT J

NEXT I DATA 11, 7. 75, 12, 8. 75, 13, 9. 75, -3, -3. 25, -2,-1. 25,-1,. 75

LET K = 0 FOR 1=1 TO 2 FOR J=1 TO 15

LET K=K+1

IF M(I, J)=X (I, J) THEN 910

GOSUB 1020

LET K = K +

1

157
0920 IF N (I, J)=Y (I, J) THEN 940

0930 GOSDB 1020

0940 NEXT J

0950 NEXT I 0960 DATA 0,2.75,1,4.75,2,6.75,3,8.75,4,10.75,5,12.75

0970 DATA 6,14.75,7,16.75,8,18.75,9,20.75,10,22.75,11,24.75

0980 IF F=0 THEN 1050

0990 PRINT

1000 PRINT " DO TO THE ABOVE ERRORS (S), TEST FAILED.'1 1010 GOTO 1080

1020 LET F=F+1

1030 PRINT TAB (12) ; "READ ASSIGNMENT FOR VARIABLE NUMBER" ;K;", FAILED."

1040 RETURN

1050 PRINT "READ/DATA ASSIGNMENTS FOR TWO-DIMENSIONAL ARRAYS, PASSED."

1060 PRINT

1070 PRINT " END TEST."

1080 PRINT

1090 PRINT " SECTION 74.2: READ/DATA FOR STRING VARIABLES."

1100 PRINT

1110 PRINT " BEGIN TEST."

1120 PRINT

1130 LET K=0

1140 DATA "ASSIGNING" , STRING, "CONSTANTS"

1150 READ A$ , B$, C$

1160 LET K=K+1

1170 IF A $=" ASSIGNING" THEN 1190

1180 GOSUB 1260

1190 LET K=K+1

1200 IF B$="STRING" THEN 1220

1210 GOSUB 1260

1220 LET K=K+1

1230 IF C$=" CONSTANTS" THEN 1280

1240 GOSUB 1260

1250 GOTO 1310

1260 PRINT TAB ( 12) ; "READ ASSIGNMENT FOR VARIABLE NUMBER" ;K; n

, FAILED."

1270 RETURN

1280 PRINT "READ/DATA ASSIGNMENTS FOR STRING VARIABLES, PASSED TEST."

1290 PRINT

1300 PRINT " END TEST."

1310 PRINT

1320 PRINT "SECTION 74.3: READ/DATA FOR NUM . AND STRG . VARS. TOGETHER."

1330 PRINT

1340 PRINT " BEGIN TEST."

1350 PRINT

1360 LET K= 0 1370 DATA MIXING, 123456, "NUMBERS", -4. 76567, AND, 1.111E33

1380 DATA STRINGS, -. 654321 ," IN" , DATA

1390 READ A$,B,C$,D,E$,F,G$,H,I$,J$

1400 LET K=K+1

1410 IF A$="MIXING" THEN 1430

1420 GOSUB 1710

1430 LET K=K+1

1440 IF B=123456 THEN 1460

1450 GOSUB 1710

1460 LET K=K+1

1470 IF C$="NUMBERS" THEN 1490

1480 GOSUB 1710

158
1490

1500

1510

1520

1530

1540

1550

1560

1570

1580

1590

1600

1610

1620

1630

1640

1650

1660

1670

1680

1690

1700

1710

1720

1730

1740

1750

1760

1770

1780

1790

1 30

1810

1820

1830

1840

1850

1860

1870

1880

1890

1900

1910

1920

1930

1940

1950

1960

1970

LET K=K + 1 IF D=-4. 76567 THEN 1520

GOSUB 1710

LET K=K+1

IF E$="AND" THEN 1550

GOSUB 1710

LET K=K+1

IF F = 1 . 111E 33 THEN 1580

GOSUB 1710

LET K=K+1

IF G$="STRINGS" THEN 1610

GOSUB 1710

LET K=K + 1 IF H=-. 654321 THEN 1640

GOSUB 1710

LET K=K + 1 IF I $ = " I N " THEN 1670

GOSUB 1710

LET K=K + 1 IF J$="DATA" THEN 1730

GOSUB 1710

GOTO 1760

PRINT TAB (12) ; "READ ASSIGNMENT FOR VARIABLE NUMBER" ;K;" # FAILED."

RETURN

PRINT "READ/DATA ASSIGNMENTS FOR NUM/STRG VARS. TOGETHER, PASSED."

PRINT

PRINT " END TEST."

PRINT

PRINT " SECTION 74.4: EVALUATION OF SUBSCRIPTED VARIABLES."

PRINT

PRINT " BEGIN TEST."

PRINT

DIM V(10)

FOR 1=1 TO 10

LET V (I ) =1 — 4*1^2

NEXT I LET 1=8

DATA 6 , 3E-33

READ I,V(I)

IF V (8 ) 0-24 8 THEN 1900

IF V (6 ) =3E-33 THEN 1920

PRINT " EVALUATION OF SUBSCRIPT EXPS. IN VARIABLE LIST, FAILED."

GOTO 1950

PRINT " EVALUATION OF SUBSCRIPT EXPS. IN VARIABLE LIST, PASSED."

PRINT

PRINT " END TEST.

PRINT

PRINT

END

ft**********'******

* SAMPLE OUTPUT * *****************

159
PROGRAM FILE 74

SECTION 74.1: READ/DATA FOR NUMERIC VARIABLES.

SECTION 74.1.1: FOR SIMPLE VARIABLES.

BEGIN TEST.

READ/DATA ASSIGNMENTS FOR SIMPLE VARIABLES, PASSED TEST.

END TEST.

SECTION 74.1.2: FOR SUBSCRIPTED VARIABLES.

SECTION 74.1.2.1: AS ONE-DIMENSIONAL ARRAYS.

BEGIN TEST.

READ/DATA ASSIGNMENTS FOR ONE-DIMENSIONAL ARRAYS, PASSED.

END TEST.

SECTION 74.1.2.2: AS TWO-DIMENSIONAL ARRAYS.

BEGIN TEST.

READ/DATA ASSIGNMENTS FOR TWO-DIMENSIONAL ARRAYS, PASSED.

END TEST.

SECTION 74.2: READ/DATA FOR STRING VARIABLES.

BEGIN TEST.

READ/DATA ASSIGNMENTS FOR STRING VARIABLES, PASSED TEST.

END TEST.

SECTION 74.3: READ/DATA FOR NUM. AND STRG . VARS. TOGETHER.

BEGIN TEST.

READ/DATA ASSIGNMENTS FOR NUM/STRG VARS. TOGETHER, PASSED.

END TEST.

SECTION 74.4: EVALUATION OF SUBSCRIPTED VARIABLES.

BEGIN TEST.

EVALUATION OF SUBSCRIPT EXPS. IN VARIABLE LIST, PASSED.

END TEST.

160
75.0 EXCEPTION TEST - READ-STATEMENT ENCOUNTERS

INSUFFICIENT DATA

The objective of this test is to verify that the implementation will

diagnose whether a variable list in a READ-statement requires more data than

is present in the remainder of the data sequence and reports this as an exception. The test has a DATA-statement at line 380 which has a DATA-list

that is not in one-to-one correspondence with the variable list for the

READ-statement at line 390. On output, there should appear some implementation-defined diagnostic reporting the error. However, should the

implementation fail to recognize the error, the test has a message that

reports test failure. The reader is referred to section 14.5 of BSR

X3. 60 .

*******************

* PROGRAM FILE 75 * *******************

0010 PRINT

0020 PRINT

0030 PRINT

0040 PRINT

0090 PRINT

0100 PRINT

0110 PRINT

0120 PRINT

0130 PRINT

0140 PRINT

0150 PRINT

0160 PRINT

0170 PRINT

0180 PRINT

0190 PRINT

0200 PRINT

0210 PRINT

0220 PRINT

0230 PRINT

0240 PRINT

0250 PRINT

0260 PRINT

0270 PRINT

0280 PRINT

0290 PRINT

0300 PRINT

0330 PRINT

0340 PRINT

0350 PRINT

0360 PRINT

"PROGRAM FILE 75"

SECTION 75.0: FATAL ERROR CHECK ON READ-STATEMENT.

" THE OBJECTIVE OF THIS SECTION IS TO DETERMINE WHETHER"

"THIS SYSTEM RECOGNIZES THE FOLLOWING AS FATAL ERRORS (THAT"

"IS, SUSPENDING PROGRAM EXECUTION PENDING USER-DIRECTED RE-"

"START PROCEDURES):"

" (1) WHEN THE VARIABLE LIST IN A READ-STATEMENT"

" REQUIRES MORE DATA THAN ARE PRESENT IN THE RE-

" MAINDER OF THE DATA SEQUENCE."

" (2) WHEN A STRING DATUM DOES NOT MATCH THE TYPE OF THE"

" NUMERIC VARIABLE TO WHICH IT IS TO BE ASSIGNED."

" (3) WHEN THE CONVERSION OF A STRING DATUM CAUSES A"

" STRING OVERFLOW."

"IF ALL OF THE ABOVE REFERRALS ARE CONSIDERED FATAL ERRORS,"

"THEN THE TEST WILL HAVE PASSED."

(INSUFFICIENT DATA FOR VARIABLE LIST.)"

BEGIN TEST."

l6l
0370 PRINT

0380 DATA -2,16

0390 READ A , B ,

C

0400 PRINT " IF THERE IS A PRINTOUT OF NUMBERS AFTER THIS STATEMENT"

0410 PRINT "THEN THE TEST WILL HAVE FAILED."

0420 PRINT A , B ,

C

0430 PRINT

0440 PRINT " END TEST."

0450 PRINT

0460 END

*****************

* SAMPLE OUTPUT * *****************

PROGRAM FILE 75

SECTION 75.0: FATAL ERROR CHECK ON READ-STATEMENT.

THE OBJECTIVE OF THIS SECTION IS TO DETERMINE WHETHER

THIS SYSTEM RECOGNIZES THE FOLLOWING AS FATAL ERRORS (THAT

IS, SUSPENDING PROGRAM EXECUTION PENDING USER-DIRECTED RESTART PROCEDURES):

(1) WHEN THE VARIABLE LIST IN A READ-STATEMENT

REQUIRES MORE DATA THAN ARE PRESENT IN THE REMAINDER OF THE DATA SEQUENCE.

(2) WHEN A STRING DATUM DOES NOT MATCH THE TYPE OF THE

NUMERIC VARIABLE TO WHICH IT IS TO BE ASSIGNED.

(3) WHEN THE CONVERSION OF A STRING DATUM CAUSES A

STRING OVERFLOW.

IF ALL OF THE ABOVE REFERRALS ARE CONSIDERED FATAL ERRORS,

THEN THE TEST WILL HAVE PASSED.

(INSUFFICIENT DATA FOR VARIABLE LIST.)

BEGIN TEST.

? OUT OF DATA IN LINE 390

162
76.0 EXCEPTION TEST - NON-MATCHING STRING DATUM ASSIGNED TO A

NUMERIC VARIABLE

The objective of this test is to determine whether the implementation

will recognize the attempt to read a string constant in the data sequence by

a numeric variable as an exception. The test attempts to read a quoted

string in a DATA-list by a simple numeric variable in a READ-list. On

output, there should be some form of implementation-defined diagnostic

However, should the implementation fail to recognize the error,

a message printed that tells the user that the implementation

test. The reader is referred to section 14.5 of BSR X3.60.

the test has

failed the

*******************

* PROGRAM FILE 76 * *******************

0010 PRINT

0020 PRINT

0030 PRINT

0 0 4 0 PRINT

0090 PRINT

0100 PRINT

0110 PRINT

0120 PRINT

0130 PRINT

0140 PRINT

0150 PRINT

0160 DATA " 0170 READ A

0180 PRINT

0190 PRINT

0200 PRINT

0210 PRINT

0220 PRINT

0230 END

"PROGRAM FILE 76"

" SECTION 76.0"

"(NON-MATCHING STRING DATUM ASSIGNED TO A NUMERIC VARIABLE.)

BEGIN TEST."

SIX"

" EXECUTION OF PROGRAM WAS NOT SUSPENDED, THEREFORE,"

"THE SYSTEM HAS FAILED THE TEST."

END TEST.

It

*****************

* SAMPLE OUTPUT * *****************

163
PROGRAM FILE 76

SECTION 76.0

(NON-MATCHING STRING DATUM ASSIGNED TO A NUMERIC VARIABLE.)

BEGIN TEST.

? VARIABLE IN LINE 170 INCOMPATIBLE WITH DATA
77.0 EXCEPTION TEST - ATTEMPTING A STRING DATUM OVERFLOW

This test determines at what point, i recognizes the assigning of a string, cons

as an exception. Processors may accept the

point to this test is that when a processor

18 characters, then some form of diagnostic

program. This test has strings of various

relationship. In fact, strings of lengths

characters are used. On output, either the

there should be some form of implementationstring overflow error. The reader is

X3.60 .

f possible, the implementation

isting of more than 18 characters

assigning of long strings. The

cannot assign strings longer than

is required with suspension of

lengths assigned by the READ/DATA

19, 20, 30, 40, 50, and 58

strings are properly assigned or defined diagnostic reporting a referred to section 14.5 of BSR

*******************

* PROGRAM FILE 77 * *******************

0010

0020

0030

0040

0090

0100

0110

0120

0130

0140

0150

0160

0170

0180

0190

0200

0210

0220

0230

0240

0250

0260

0270

0280

0290

0300

0310

0320

0330

0340

PRINT "PROGRAM FILE 77"

PRINT

PRINT

PRINT

PRINT " SECTION 77.0"

PRINT

PRINT " (A STRING OVERFLOW.)

PRINT

PRINT

PRINT " BEGIN TEST."

PRINT

DATA " *********19********"

DATA "*********20*********"

DATA 11 **************30**************"

DATA "*******************40*******************"

DATA "************************50************************"

DATA "****************************58****************************"

READ A$,B$,C$,D$,E$,F$

PRINT " IF THERE IS A PRINTOUT BELOW THIS PARAGRAPH AND NOT AN"

PRINT "INDICATION OF A FATAL ERROR, THEN THIS SYSTEM SATISFIES"

PRINT "MORE IN THIS RESPECT THAN IS REQUIRED BY MINIMAL BASIC."

PRINT "THE NUMBERS TOWARD THE CENTER OR IN THE CENTER OF THE AS-"

PRINT "TERISKS SIGNIFY THE LENGTH OF THE CHARACTER STRINGS ASSO-"

PRINT "CIATED WITH EACH ASSIGNED STRING VARIABLE."

PRINT

PRINT A$

PRINT B

$

PRINT C$

PRINT D$

PRINT E$

165
0 350 PRINT F

$

0360 PRINT

0370 PRINT " END TEST."

0380 PRINT

0390 END

*****************

* SAMPLE OUTPUT * *****************

PROGRAM FILE 77

SECTION 77.0

(A STRING OVERFLOW.)

BEGIN TEST.

IF THERE IS A PRINTOUT BELOW THIS PARAGRAPH AND NOT AN

INDICATION OF A FATAL ERROR, THEN THIS SYSTEM SATISFIES

MORE IN THIS RESPECT THAN IS REQUIRED BY MINIMAL BASIC.

THE NUMBERS TOWARD THE CENTER OR IN THE CENTER OF THE ASTERISKS SIGNIFY THE LENGTH OF THE CHARACTER STRINGS ASSOCIATED WITH EACH ASSIGNED STRING VARIABLE.

*********^9********

********* 20 ********* ************** 20 ************** ***************** **40 ******************* ************************50************************

****************************23****************************

END TEST.

166
78.0 SEMANTIC INTERPRETATION - A NUMERIC VALUE IN A DATA LIST

CAUSES AN UNDERFLOW

This test verifies that the implementation recognizes the semantic

interpretation required when a positive numerical constant, which is too

small to be represented by the machine, is assigned. The READ/DATA

relationship should ignore the value being assigned by making an assignment

of zero to the value and continuing the program. The test has a DATA-statement which lists a numerical value of the magnitude 9.0E-99999 at

line 360. On output, there should be a message which should tell the user to

look for a zero as a printout following that message. If zero is printed,

then the implementation will have passed the test. The reader is referred to

section 14.4 in BSR X3.60.

*******************

* PROGRAM FILE 78 * *******************

0010 PRINT " 0020 PRINT

0030 PRINT

0040 PRINT

0260 PRINT

0270 PRINT

0280 PRINT

0290 PRINT " 0300 PRINT

0310 PRINT " 0320 PRINT

0330 PRINT

0340 PRINT " 0350 PRINT

0360 DATA 9.

0370 READ A

0380 PRINT " 0390 PRINT " 0 4 00 PRINT A

0410 PRINT

0420 PRINT " 0430 PRINT

0440 END

PROGRAM FILE 78"

SECTION 78.0"

(A NUMERIC DATUM CAUSES AN UNDERFLOW.)"

BEGIN TEST."

0E-99999

IF THE NUMBER PRINTED AFTER THIS STATEMENT IS ZERO,

THEN THE SYSTEM WILL HAVE PASSED THE TEST."

END TEST."

II

*****************

* SAMPLE OUTPUT *
*****************

PROGRAM FILE 78

SECTION 78.0

(A NUMERIC DATUM CAUSES AN UNDERFLOW.)

BEGIN TEST.

IF THE NUMBER PRINTED AFTER THIS STATEMENT IS ZERO,

THEN THE SYSTEM WILL HAVE PASSED THE TEST.

0 END TEST.

168
79.0 EXCEPTION TEST - A NUMERIC VALUE IN A DATA STATEMENT

CAUSES AN OVERFLOW

This test verifies that the implementation will recognize the assigning,

by the READ/DATA relationship, of a number that causes overflow, as an exception. The exception recovery procedure should cause the

implementation-defined machine infinity to be assigned instead. The test has

a DATA-statement in line 170 which lists a numerical value of magnitude

9 . 99999E99999 . On output, there should be a message telling the user to look

for the implementation-defined machine infinity as a printout following the

message. If a positive machine infinity is printed, then the implementation

will have passed the test. The reader is referred to section 14.5 of BSR

X3. 60 •

* PROGRAM FILE 79 *

0010 PRINT "PROGRAM FILE 79"

0020 PRINT

0030 PRINT

0040 PRINT

0090 PRINT " SECTION 79.0"

0100 PRINT

0110 PRINT " (A NUMERIC DATUM CAUSES AN OVERFLOW, POSITIVE

0120 PRINT " INFINITY. )

0130 PRINT

0140 PRINT

0150 PRINT " BEGIN TEST."

0160 PRINT

0170 DATA 9. 99999E99999

0180 READ A

0190 PRINT " IF THE NUMBER PRINTED BELOW THIS STATEMENT IS

0200 PRINT "AND THE MACHINE INFINITY FOR THIS SYSTEM, THEN THE

0210 PRINT "WILL HAVE PASSED ON THIS SYSTEM.

0220 PRINT A

0230 PRINT

0240 PRINT " END TEST."

0250 PRINT

0260 END

POSITIVE"

* SAMPLE OUTPUT *

169
PROGRAM FILE 79

SECTION 79.0

(A NUMERIC DATUM CAUSES AN OVERFLOW, POSITIVE MACHINE

INFINITY.

)

BEGIN TEST.

?OVERFLOW IN LINE 180

IF THE NUMBER PRINTED BELOW THIS STATEMENT IS POSITIVE

AND THE MACHINE INFINITY FOR THIS SYSTEM, THEN THE TEST

WILL HAVE PASSED ON THIS SYSTEM.

1 . 70141E+38 . . END TEST.

170
80.0 EXCEPTION TEST - OVERFLOW CAUSED BY A NUMERIC VALUE

IN A DATA-STATEMENT (CONTINUED)

verifies that

a negative

This test

infinity when

DATA-statement which has the

On output, a message should

machine infinity. If that value is printed

implementation will have passed the test. The

14.5 of BSR X3. 60 .

the implementation

numeric datum ca numerical constant

be printed telling

will assign negative machine

uses an overflow. There is a -9. 99999E99999 in line 150.

the user to look for negative

following the message, then

reader is referred to section

* PROGRAM FILE 80 *

0010 PRINT II 0020 PRINT

0030 PRINT

0040 PRINT

0090 PRINT n 0100 PRINT

0110 PRINT

0120 PRINT

0130 PRINT ii 0140 PRINT

0150 DATA - 9 0160 READ A

0170 PRINT 11 0180 PRINT It 0190 PRINT •» 0200 PRINT A

0210 PRINT

0220 PRINT II 0230 PRINT

0240 END

80'

SECTION 80.0: OVERFLOW CAUSED BY A NUMERIC DATUM."

BEGIN TEST."

IF THE NUMBER PRINTED BELOW THIS STATEMENT IS NEGATIVE"

END TEST.

* SAMPLE OUTPUT *

171
PROGRAM FILE 80

SECTION 80.0: OVERFLOW CAUSED BY A NUMERIC DATUM.

BEGIN TEST.

?OVERFLOW IN LINE 160

IF THE NUMBER PRINTED BELOW THIS STATEMENT IS NEGATIVE

AND THE MACHINE INFINITY FOR THIS SYSTEM, THEN THE TEST

WILL HAVE PASSED ON THIS SYSTEM.

-1.70141E+38

END TEST.

172
81.0 RESTORING READ DATA

This test verifies that, through the use of the RESTORE-statement , data

from the data sequence can be reread. The test on the RESTORE-statement is

accomplished by first reading each datum of the DATA-list and then assigning

each value read to a variable. These assignments are then checked. If any

faulty assignments are made, then an error message should be printed for each

incorrect assignment. Each of these error messages should be printed as follows: READ ASSIGNMENT FOR VARIABLE NUMBER <number>, FAILED. If all

assignments were correct, then, using the RESTORE-statement, a second set of

variables should be assigned the same values as the first. The correctness

of the assignments are then checked by IF-THEN comparisons between the values

of the first and the second set of variables. If there are any incorrect

comparisons, then there should be an error message for each incorrect

reassigned value. Each of the error messages should be printed as follows:

REREAD ASSIGNMENT FOR VARIABLE NUMBER <number>, FAILED. If all assignments

in the rereading process were correct then the following message should be

printed: RESTORING DATA TO BE REREAD FOR ASSIGNMENT, PASSED. The reader is

referred to section 14.4 of BSR X3.60.

*******************

* PROGRAM FILE 81 * *******************

0010 PRINT "PROGRAM FILE 81"

0020 PRINT

0030 PRINT

0040 PRINT

0090 PRINT " CAUTION: THE NATURE OF THE RESTORE-STATEMENT DOES"

0100 PRINT "NOT ALLOW THIS SECTION TO BE TESTED WITH OTHER SECTIONS"

0110 PRINT "USING A DATA-STATEMENT .

0120 PRINT

0130 PRINT " SECTION 81.0: RESTORING READ DATA."

0140 PRINT

0150 PRINT " BEGIN TEST."

0160 PRINT

0170 LET F=0

0180 LET K=0

0190 DATA "RESTORING", 1.23E-9, READ, -9. 876E22, "DATA"

0200 READ A$,B,C$,D,E$

0210 LET K=K+1

0220 IF A$=" RESTORING" THEN 240

0230 GOSUB 570

0240 LET K=K+1

0250 IF B=1 . 23E-9 THEN 270

0260 GOSUB 570

0270 LET K=K+1

0280 IF C$= H READ" THEN 300

173
0290 GOSUB 570

0300 LET K=K+1

0310 IF D=-9 . 876E22 THEN 330

0320 GOSUB 570

0330 LET K=K+1

0340 IF E$="DATA" THEN 370

0350 GOSUB 570

0360 GOTO 600

0370 IF FO0 THEN 600

0380 LET K=0

0390 RESTORE

0400 READ M$ , N , 0$ , P , Q$

0410 LET K=K+1

0420 IF M$=A$ THEN 440

0430 GOSUB 630

0440 LET K=K+1

0450 IF N=B THEN 470

0460 GOSUB 630

0470 LET K=K+1

0480 IF 0$=C$ THEN 500

0490 GOSUB 630

0500 LET K=K+1

0510 IF P=D THEN 530

0520 GOSUB 630

0530 LET K=K+1

0540 IF Q$=E $ THEN 650

0550 GOSUB 630

0560 GOTO 680

0570 LET F=G+1

0580 PRINT TAB (12) , "READ ASSIGNMENT FOR VARIABLE NUMBER" ; K

; " , FAILED

0590 RETURN

0600 PRINT

0610 PRINT " THEREFORE, RESTORE TEST WILL NOT CONTINUE.

0620 GOTO 680

0630 PRINT TAB (12) , "REREAD ASSIGNMENT FOR VARIABLE NO.";K;", FAILED.

0640 RETURN

0650 PRINT "RESTORING READ DATA TO BE REREAD FOR ASSIGNMENT, PASSED.

0660 PRINT

0670 PRINT " END TEST."

0680 PRINT

0690 PRINT

0700 END

*****************

* SAMPLE OUTPUT * *****************

PROGRAM FILE 81
CAUTION: THE NATURE OF THE RESTORE STATEMENT DOES

NOT ALLOW THIS SECTION TO BE TESTED WITH OTHER SECTIONS

USING A DATA-STATEMENT.

SECTION 81.0: RESTORING READ DATA.

BEGIN TEST.

RESTORING READ DATA TO BE REREAD FOR ASSIGNMENT, PASSED.

END TEST.

175
82.0

INPUT STATEMENT FOR NUMERIC CONSTANTS

The next several test sections emphasize user interaction with a running

program. This is accomplished through the use of the INPUT-statement (see

section 13 of BSR X3.60). By using the INPUT-statement, data can be

entered as quoted strings, unquoted strings, numeric constants or a mixture

of all three types. However, upon call for data by an input-prompt, there is

a restriction on the order in which data is supplied in the input-reply.

That is, the type of each datum in the input-reply must correspond to the

type of the variable td which it is to be assigned (numeric constants must be

supplied as input for numeric variables, and either quoted strings or unquoted strings must be supplied as input for string variables). If the

response to input for a string variable is an unquoted string, leading and

trailing spaces are to be ignored. Subscript expressions in the variable

list should be evaluated after values have been assigned to the variables

preceding them, that is, from left to right in the variable list.

The standard specifies that in batch mode, input-reply is requested from

an external source by an implementation-defined means. If these tests are run in batch mode, then the user will have to use the appropriate external

source and program the proper data input form before these codes can be

executed

.

The objective of the program in this section, specifically, is to

determine whether the implementation recognizes the assigning of numerical

constants by the use of the INPUT-statement.

82.1

Input of a Numeric Constant

The objective of this exercise is to test simple interaction by

requesting the user to input a single value at a time. The test requests

that all three of the numeric constant forms (NRl, NR2, and NR3 forms) be

individually entered by the user. Each prompt message (which should be

followed by an input-prompt) tells the user what number, and in what form to

enter the number for a proper response. To allow for possible data input

errors during input-reply responses, each datum is checked by the test for

proper format. If an incorrect value is found to have been entered, the user will be given only two more possible chance.; to correct his error. If the

input is not correct after that, the following message will be printed:

FAILURE TO ENTER PROPER DATA. After this message, the test will stop. If

all of the proper data is entered, a comparative output should be printed.

There are four columns of output. The first specifies the standard value,

the second an option, if any, the third reports the system value after

input/output conversion, and the final column reports any internal relative

error

.

82.2

Input of Numeric Constants As a Line of Data

Separated by Commas

The objective of this test is again to determine whether numeric

constants (in either of the three forms NRl, NR2, NR3, or all three) can be

assigned by user interaction. In this test, however, the user is requested

to enter several numbers separated by commas rather than a single number as above. Except for the input-prompts requiring several numbers rather than a

176
single number, the structure of this test and output is similar to section

82.1.

*******************

* PROGRAM FILE 82 * *******************

0010 PRINT "PROGRAM FILE 82"

0020 PRINT

0030 PRINT

0040 PRINT

0080 PRINT " SECTION 82.0: INPUT OF NUMERIC CONSTANTS

0090 PRINT

0100 PRINT

0110 PRINT

0120 PRINT

0130 PRINT " SECTION 82.1"

0140 PRINT

0150 PRINT " (AS A SINGLE DATUM VALUE.)"

0160 PRINT

0170 PRINT

0180 PRINT " BEGIN TEST."

0190 PRINT

0200 DIM E (8) ,N (8) ,D (8) ,Z (8)

0202 DATA 8. 13008E-7 , 8.10045E-7, 8.10005E-7, IE-7

0203 DATA 1 . 528 30E-7 , 1.26727E-7, 1.01256E-7, 8. 10045E-7

0204 FOR I = 1 TO 8 0205 READ Z(I)

0206 NEXT I 0210 LET 1=1

0220 LET C=123

0230 LET A $ = " 1 2 3

" 0240 GOSUB 1050

0250 LET C=-12345

0260 LET A$=" -12345"

0270 GOSUB 1050

0280 LET C = 1234 5 .

6

0290 LET A$="12345.6"

0300 GOSUB 1050

0310 LET C=-99999 .

9

0320 LET A$=" -99999. 9"

0330 GOSUB 1050

0340 LET C=6 . 54321E-20

0350 LET A$="6. 54321E-20"

0360 GOSUB 1050

0370 LET C=-7 . 891E25

0380 LET A$="-7. 891E25"

0390 GOSUB 1050

0 4 0 0 LET C=-987. 6E-27

177
0410

0420

0430

0440

0450

0460

0470

0480

0490

0500

0510

0520

0530

0540

0550

0560

0570

0580

0590

0600

0610

0620

0630

0640

0650

0660

0670

0680

0690

0700

0710

0720

0730

0740

0750

0760

0770

0780

0790

0800

0810

0820

0830

0840

0850

0860

0870

0880

0890

0900

0910

0920

0930

0940

0950

0960

0970

LET A$="-987. 6E-27"

GOSUB 1050

LET C=12345E18

LET A$ = " 12345E18"

GOSUB 1050

PRINT

PRINT

PRINT " IF THE RELATIVE ERROR IS OUT OF TOLERANCE,"

PRINT "THEN AN ASTERISK WILL FOLLOW THAT RELATIVE"

PRINT "ERROR SIGNIFYING ONE OF TWO POSSIBILITIES:"

PRINT

PRINT ” (1) USER INPUT ERROR (S)."

PRINT " (2) FAILURE OF THE SYSTEM TO MAINTAIN SIX SIGNIFICANT"

PRINT "DIGITS OF PRECISION."

PRINT

PRINT "OTHERWISE, NO ASTERISKS MEAN TEST PASSED."

PRINT

PRINT

PRINT "STANDARD" , "OPTIONAL" , "SYSTEM" , "RELATIVE"

PRINT " OUTPUT "," OUTPUT ", "OUTPUT"," ERROR " PRINT

FOR 1=1 TO 8 ON I GOTO 640,690,740,790,830,880,930,980

IF N ( I

) =0 THEN 670

PRINT " 123 "

, "NONE" ,D (I ) ,E (I )

;

GOTO 1020

PRINT " 123 "

, "NONE" ,D(I) ,E(I)

GOTO 1020

IF N ( I

) =0 THEN 720

PRINT " - 1 2 3 4 5 "

, "NONE" ,D (I ) , E (I ) ; "*

GOTO 1020

PRINT " - 1 2 3 4 5 "

, "NONE" , D (I )

, E (I

)

GOTO 1020

IF N ( I

) = 0 THEN 770

PRINT " 12345.6 "

, "NONE" ,D (I ) ,E (I )

;

GOTO 1020

PRINT " 12345.6 "

, "NONE" ,D (I ) , E (I

)

GOTO 1020

IF N (I ) =0 THEN 810

GOTO 1020

PRINT ”-99999.9 "

, " NONE" , D ( I ) , E ( I

)

GOTO 1020

IF N (I ) =0 THEN 860

PRINT " 6.54321E-20 "

, " NONE" , D ( I ) , E ( I )

; " *

GOTO 1020

PRINT " 6 . 54321E-20 "

, " NONE " , D ( I ) , E ( I

)

GOTO 1020

IF N ( I

) =0 THEN 910

PRINT "-7.89100E25 "

, "-7. 89100E+25 " ,D (I ) , E (I ) ; "*" GOTO 1020

PRINT "-7. 8910 0E 25 "

, " -7 . 891 0 0E +25 ",D(I),E(I)

GOTO 1020

IF N ( I

) =0 THEN 960

PRINT "-9.87600E-25 "

, “ NONE" , D ( I ) , E ( I ) ; " *

GOTO 1020

PRINT "-9. 87600E-25 "

, " NONE" , D ( I ) , E ( I

)

GOTO 1020

178
0980 IF N ( I

) =0 THEN 1010

0990 PRINT " 1.2345E22 1.2345E + 22 " , D ( I ) , E ( I ) ; " *

1000 GOTO 1020

1010 PRINT " 1.2345E22 "

, " 1.2345E+22 ”,D(I),E(I)

1020 NEXT I 1030 PRINT

1040 GOTO 1300

1050 LET N (I ) =0

1060 PRINT "ENTER THE FOLLOWING NUMERAL AS IS: ";A$

1070 INPUT D ( I

)

1080 IF COD (I ) THEN 1120

1090 LET E (I)= (C-D (I) )/C

1100 LET 1=1+1

1110 RETURN

1120 IF ABS (C-D (I )

) >ABS (C) *Z (I ) THEN 1160

1130 LET E (I)= (C-D (I) )/C

1140 LET 1=1+1

1150 RETURN

1160 FOR J=1 TO 2 1170 PRINT " POSSIBLE INPUT ERROR, PLEASE RE-ENTER DATA IN THE”

1180 PRINT "FOLLOWING FORM: ";A$

1190 INPUT D ( I

)

1200 IF C=D ( I ) THEN 1090

1210 IF ABS (C-D (I) ) >ABS (C) *Z (I) THEN 1250

1220 LET E (I) = (C-D (I) )/C

1230 LET 1=1+1

1240 RETURN

1250 NEXT J

1260 N (I ) =1

1270 LET E (I)= (C-D (I) )/C

1280 LET 1=1+1

1290 RETURN

1300 PRINT

1310 PRINT

1320 PRINT

1330 PRINT " SECTION 82.2"

1340 PRINT

1350 PRINT " (AS A LINE OF DATA SEPARATED BY COMMAS.)"

1360 PRINT

1370 PRINT

1380 PRINT " BEGIN TEST."

1390 PRINT

1400 DIM B(3) ,A(3) ,R(3) ,T(3) ,H(3)

1401 DATA 8 . 10373E-7 , 8.10005E-7, 1.01266E-7

1402 FOR I = 1 TO 3 1403 READ H (I

)

1404 NEXT I 1410 LET B ( 1

) =1 2 34

1420 LET B(2)=123.456

1430 LET B (3)=-98. 76E21

1440 PRINT " PLEASE ENTER THE FOLLOWING LIST OF NUMERALS IN THE EX-"

1450 PRINT "ACT ORDER WHICH FOLLOWS: 1 234 , 1 2 3 . 4 56 , -98 . 7 6E 2

1

1460 INPUT A ( 1 )

, A ( 2 ) , A ( 3

)

1470 LET F=0

1480 FOR 1=1 TO 3 1490 IF B ( I ) <>A ( I

)

THEN 1530

1500 LET R ( I

) = ( B ( I

) -A ( I ) ) /B ( I

)

179
1510 LET T(I)=0

1520 GOTO 1600

1530 IF ABS ( B ( I

) -A ( I )

) >ABS (B ( I )

) *H ( I ) THEN 1570

1540 LET R(I)= (B(I)-A(I) )/B(I)

1550 LET T ( I

) =0

1560 GOTO 1600

1570 LET R (I ) = (B ( I

) -A ( I ) ) /B ( I

)

1580 LET T ( I

) =1

1590 LET F=1

1600 NEXT I 1610 IF F=0 THEN 1860

1620 FOR J=1 TO 2 1630 PRINT " POSSIBLE INPUT ERROR, PLEASE RE-ENTER THE FOLLOWING"

1640 PRINT "LIST EXACTLY AS ORDERED: 1234 , 1 23 . 4 56 , -98 . 7 6E 2

1

1650 INPUT A ( 1 ) , A ( 2 ) ,A(3)

1660 GOSUB 1710

1670 IF F < > 0 THEN 1690

1680 GOTO 1860

1690 NEXT J

1700 GOTO 1860

1710 LET F=0

1720 FOR 1=1 TO 3 1730 IF B ( I ) < >A ( I ) THEN 1770

1740 LET R ( I

) = ( B ( I

) —A ( I ) ) /B ( I

)

1750 LET T (I ) =0

1T60 GOTO 1840

17 7 0 IF ABS (B (I)-A(I )

) >ABS (B (I )

) *H (I ) THEN 1810

1780 LET R(I)= (B(I)-A(I) )/B(I)

1790 LET T (I ) =0

1800 GOTO 1840

1810 LET R ( I

) = (B ( I

) -A ( I ) ) /B ( I

)

1820 LET T ( I

) =

1

1830 LET F=1

1840 NEXT I 1850 RETURN

1860 PRINT

1870 PRINT

1880 PRINT " IF THE RELATIVE ERROR IS OUT OF TOLERANCE,"

1890 PRINT "THEN AN ASTERISK WILL FOLLOW THAT RELATIVE"

1900 PRINT "ERROR SIGNIFYING ONE OF TWO POSSIBILITIES:"

1910 PRINT

1920 PRINT " (1) USER INPUT ERROR (S ) .

1930 PRINT " (2) FAILURE OF THE SYSTEM TO MAINTAIN SIX SIGNIFICANT"

1940 PRINT "DIGITS OF PRECISION."

1950 PRINT

1960 PRINT "OTHERWISE, NO ASTERISKS MEAN TEST PASSED."

1970 PRINT

1980 PRINT

1990 PRINT "STANDARD" , "OPTIONAL" , "SYSTEM" , "RELATIVE"

2000 PRINT " OUTPUT "," OUTPUT "/'OUTPUT"," ERROR " 2010 PRINT

2020 FOR 1=1 TO 3 2030 ON I GOTO 2040,2090,2140

2040 IF T ( I

) =0 THEN 2070

2050 PRINT " 1234 "

, "NONE" , A ( I ) , R (I ) ; " *

2060 GOTO 2180

2070 PRINT " 1234 "

, " NONE " , A ( I ) , R ( I

)

180
2080 GOTO 2180

2090 IF T ( I

) =0 THEN 2120

2100 PRINT M 123.456 "

, " NONE " , A ( I ) , R ( I ) ; " *

2110 GOTO 2180

2120 PRINT " 123.456 "

, "NONE" , A ( I ) , R (I

)

2130 GOTO 2180

2140 IF T ( I

) =0 THEN 2170

2150 PRINT "-9. 8760 0E 22 "

, "-9 . 87600E + 22 " , A ( I ) , R ( I ) ; " *

2160 GOTO 2180

2170 PRINT "-9.87600E22 "

, “-9 . 87600E+22 M ,A(I),R(I)

2180 NEXT I 2190 PRINT

2200 PRINT

2210 END

*****************

* SAMPLE OUTPUT * *****************

PROGRAM FILE 82

SECTION 82.0: INPUT OF NUMERIC CONSTANTS.

SECTION 82.1

{AS A SINGLE DATUM VALUE.)

BEGIN TEST.

ENTER THE FOLLOWING

?123

NUMERAL AS IS: 123

ENTER THE FOLLOWING

7-12345

NUMERAL AS IS : -12345

ENTER THE FOLLOWING

712345.6

NUMERAL AS IS: 12345.6

ENTER THE FOLLOWING

7-99999.9

NUMERAL AS IS: -99999.9

ENTER THE FOLLOWING

76. 54321E-20

NUMERAL AS IS: 6.54 321E-20

ENTER THE FOLLOWING

7-7.891E25

NUMERAL AS IS: -7. 891E25

ENTER THE FOLLOWING

7-987. 6E-27

NUMERAL AS IS: -987. 6E-27

ENTER THE FOLLOWING NUMERAL AS IS : 12345E18

l8l
?12345E18

IF THE RELATIVE ERROR IS OUT OF TOLERANCE,

THEN AN ASTERISK WILL FOLLOW THAT RELATIVE

ERROR SIGNIFYING ONE OF TWO POSSIBILITIES:

(1) USER INPUT ERROR (S )

.

(2) FAILURE OF THE SYSTEM TO MAINTAIN SIX SIGNIFICANT

DIGITS OF PRECISION.

NO ASTERISKS MEAN TEST PASSED.

OPTIONAL

OUTPUT

SYSTEM

OUTPUT

RELATIVE

ERROR

OTHERWISE,

STANDARD

OUTPUT

123

-12345

12345.6

-99999.9

6. 54321E-20

-7. 89100E25

-9. 87600E-25

1.2345E22

NONE

NONE

NONE

NONE

NONE

-7. 89100E+25

NONE

1. 2345E+22

123

-12345

12345.6

-99999.9

6. 54321E-20

-7.89100E+25

-9 . 87600E-25

1. 23450E+22

0

0

0

0

0

0

0

0

BY COMMAS.)

SECTION 82.2

(AS A LINE OF DATA SEPARATED

BEGIN TEST.

PLEASE ENTER THE FOLLOWING LIST OF NUMERALS IN THE EXACT ORDER WHICH FOLLOWS: 1234 , 123 . 456 , -98 . 76E21

21234,123. 456, -98.

7 6E21

IF THE RELATIVE ERROR IS OUT OF TOLERANCE,

THEN AN ASTERISK WILL FOLLOW THAT RELATIVE

ERROR SIGNIFYING ONE OF TWO POSSIBILITIES:

(1) USER INPUT ERROR (S )

.

(2) FAILURE OF THE SYSTEM TO MAINTAIN SIX SIGNIFICANT

DIGITS OF PRECISION.

OTHERWISE, NO ASTERISKS MEAN TEST PASSED.

STANDARD OPTIONAL

OUTPUT OUTPUT

SYSTEM

OUTPUT

RELATIVE

ERROR

1234

123.456

-9. 87600E22

NONE

NONE

-9. 87600E+22

1234

123.456

-9.

8

7 600E+22

0

0

0

182
83.0

INPUT OF NUMERIC DATA TO SUBSCRIPTED VARIABLES AND

UNQUOTED STRINGS 83.1

Evaluation of a Subscripted Variable in a Variable List

This test determines whether the implementation will allow a variable,

used in a subscript, to be assigned a value in the same input list as the

subscripted variable itself. The assignment of the value must of course be

prior to the use of the variable in the subscript.

The test tells the user by input-prompt messages how to enter a list of

ten given values for ten elements of an array A(I). After the proper input

of the given list of values has been accomplished, the list will be printed

out for user verification. After this printout, the user will be asked by an input-prompt message to choose one of the digits 1, 2, ..., 10 and then enter

the chosen digit for the value of I in the variable list, and for the

variable A(I) in the variable list, enter the value 54.8. After the values

for I and A ( I ) have been entered properly, the elements of the array A(I)

will again be printed out for comparison with the first printout of the

elements of A(I). The comparison should show that the subscripted element

which has the selected I value should now have an assigned value of 54.8.

83.2

Allowable Characters for Unquoted String Inputs

The objective of this test is to assign strings using the

INPUT-statement in order to verify that the implementation allows the

assigning of all of the characters specified by the standard for unquoted

strings. These include all plain-string-characters and the character space

(refer to the standard for the description of plain-string-characters). The

test uses input-prompt messages to the user informing him which subset of

plain string characters should be entered and the form or order in which each

subset of characters should be entered for each response. All data are checked for proper form, and, if the data are entered incorrectly, the user will be given three chances to enter them correctly. If the data are still

found to be incorrectly entered, the following message will be printed:

FAILURE TO ENTER PROPER DATA. The test will then terminate. If the data are entered properly, a printout of the characters will be given. The reader is

referred to sections 3 and 13 of BSR X3.60.

* PROGRAM FILE 83 *

0010 PRINT "PROGRAM FILE 83

0060 PRINT

0070 PRINT

183
0080

0090

0100

0110

0130

0140

0150

0160

0170

0180

0190

0200

0210

0220

0230

0240

0250

0260

0270

0280

0290

0300

0310

0320

0330

0340

0350

0360

0370

0380

0390

0400

0410

0420

0430

0440

0450

0460

0470

0480

0490

0500

0510

0520

0530

0540

0550

0560

0570

0580

0590

0600

0610

0620

0630

0640

0650

PRINT

PRINT " SECTION 83.1"

PRINT

PRINT " EVALUATION OF A SUBSCRIPTED VARIABLE IN A VARIABLE LIST"

PRINT

PRINT

PRINT " BEGIN TEST."

PRINT

PRINT

PRINT

PRINT " AFTER EACH SUCCESSIVE INPUT-PROMPT, ENTER SEQUENTIALLY

PRINT "ONE OF THE FOLLOWING LISTED NUMBERS : 1 . 5 , 2 . 5 , 3 . 5 , 4 . 5 , 5 . 5

,

PRINT "6.5,7.5,8.5,9.5,10.5"

FOR 1=1 TO 10

INPUT A (I)

GOSUB 540

NEXT I PRINT

PRINT " LISTED BELOW ARE YOUR 10 INPUTTED DATA VALUES FOR THE"

PRINT "ARRAY A (I). THE ELEMENTS ARE LISTED IN THE ORDER OF A(l),"

PRINT "A(2) ,A(3) ,...,A(10) FROM TOP TO BOTTOM RESPECTIVELY."

PRINT

FOR 1=1 TO 10

PRINT TAB (29) ,A(I)

NEXT I PRINT

PRINT " AFTER THE INPUT-PROMPT, YOU ARE TO ENTER ONLY TWO IN-"

PRINT "PUT-VALUES. (1) FOR THE FIRST INPUT-VALUE, SELECT ONE OF"

PRINT "THE DIGITS 1,2, 3,..., 10 AS THE SELECTION OF ONE OF THE ELEPRINT "MENTS OF ARRAY A(I). (2) FOR THE SECOND INPUT-VALUE, ENTER

PRINT "THEN NUMBER 54.8."

INPUT I, A (I)

GOSUB 630

PRINT

PRINT " LISTED BELOW ARE AGAIN THE ELEMENTS OF ARRAY A (I) IN"

PRINT "THE SAME ORDER A ( 1 ) , A ( 2 ) , A ( 3 ) , . . .

, A ( 1 0

)

FROM TOP TO BOTTOM"

PRINT "RESPECTIVELY, BUT IN THIS LIST THE VALUE OF YOUR SELECTED"

PRINT "ELEMENT SHOULD BE 54.8 AND NOT THE VALUE IT HAD IN THE LIST

PRINT "ABOVE."

PRINT

FOR 1=1 TO 10

PRINT TAB (29) ,A(I)

NEXT I PRINT

GOSUB 780

IF A (I ) OI + . 5 THEN 560

RETURN

FOR K=1 TO 3 PRINT " DATA ERROR, PLEASE ENTER DATA AFTER THE INPUT-PROMPT"

PRINT "IN THE FOLLOWING FORM:";I+.5

INPUT A ( I

)

IF A (I ) =I+.

5

THEN 550

NEXT K GOTO 770

IF I <1 THEN 670

IF I>10 THEN 670

IF A ( I ) 0 54.8 THEN 670
0660

0670

0680

0690

0700

0710

0720

0730

0740

0750

0760

0770

0780

0790

0820

0830

0840

0 8 50

0860

0870

0880

0890

0900

0910

0920

0930

0940

0950

0960

0970

0980

0990

1000

1010

1020

1030

1040

1050

1060

1070

1080

1090

1100

1110

1120

1130

1140

1150

1160

1170

1180

1190

1200

1210

1220

1230

1240

RETURN

FOR J=1 TO 3 PRINT " DATA ERROR, RE-ENTER YOUR SELECTED DIGIT OF THE DIGITS"

PRINT "1, 2, 3, . . .

, 10 AS THE FIRST DATA INPUT AND THE NUMBER 54.8 AS"

PRINT "THE SECOND DATA ENTRY. PLEASE MAKE ALL ENTRIES AFTER THE"

PRINT "INPUT-PROMPT."

INPUT I , A ( I

)

IF I <1 THEN 760

IF I>10 THEN 760

IF A ( I

) =54 . 8 THEN 660

NEXT J

PRINT " PRINT

PRINT " PRINT

PRINT

PRINT

PRINT

PRINT " PRINT

PRINT " PRINT

PRINT

PRINT " PRINT

PRINT " PRINT "OF

PRINT

PRINT " ABCDEFGHI JKLM"

PRINT "NOPQRSTUVWXYZ"

PRINT "0123456789"

PRINT "* ( ) : $=><"

PRINT "- %;+.?/ " INPUT A$

INPUT B

$

INPUT C$

INPUT D$

INPUT E

$

GOSUB 1380

PRINT

PRINT " AFTER THE INPUT-PROMPT, ENTER THE DIGIT 1, SPACE OVER"

PRINT "EIGHT SPACES, AND THEN TYPE THE DIGIT 1 AGAIN."

INPUT F

$

GOSUB 1660

PRINT

PRINT

PRINT " UNQUOTED-STRING-CHARACTER= SPACE/PLAIN-STRING-CHARACTER"

PRINT

PRINT " PLAIN-STRING-CHARACTERS.

PRINT

PRINT " ABCDEFGHI JKLMNOPQRSTUVWXYZ 0123456789* () :$ = ><- %;+.?/"

PRINT

PRINT " IF THE LINE OF CHARACTERS PRINTED BELOW, APPEAR IN THE"

PRINT "SAME FORM AS THE LINE OF CHARACTERS ABOVE, CHECK TEST PASS-"

PRINT "ED."

PRINT

PRINT A$;B$;C$;D$;E$

FAILURE TO ENTER PROPER DATA."

END TEST."

SECTION 83.2"

ALLOWABLE CHARACTERS FOR UNQUOTED STRING INPUTS"

BEGIN TEST."

AT EACH SUCCESSIVE INPUT-PROMPT, ENTER ONE OF THE ROWS"

CHARACTERS BELOW AS THEY APPEAR FROM TO TO BOTTOM:"

185
1250

1260

1270

1280

1290

1300

1310

1320

1330

1340

1350

1360

1370

1380

1390

1400

1410

1420

1430

1440

1450

1460

1470

1480

1490

1500

1510

1520

1530

1540

1550

1560

1570

1580

1590

1600

1610

1620

1630

1640

1650

1660

1670

1680

1690

1700

1710

1720

1730

1740

1750

1760

1770

1780

1790

1800

PRINT

PRINT " SPACE (IMBEDDED)."

PRINT

PRINT * IF AFTER THE COLUMN NUMBERED HEADINGS, THERE ARE EIGHT"

PRINT "COUNTABLE SPACES BETWEEN THE ONES- CHECK TEST PASSED."

PRINT

PRINT "00000000011111111112222222222333333333344444444445";

PRINT "5555555556666666666777-

PRINT "1234567890123456'7 890123456'7 89012345678901234567890";

PRINT "1234567890123456789012"

PRINT F$

PRINT

GOTO 1760

IF A$<>"ABCDEFGHI JKLM" THEN 1440

IF B $ <>"NOPQRSTUVWXYZ " THEN 1440

IF C$<>" 0123456789" THEN 1440

IF D $<>"*( ) :$=><" THEN 1440

IF E $ < > " - %;+.?/" THEN 1440

RETURN

FOR 1=1 TO 3 PRINT " DATA ERROR, PLEASE SUCCESSIVELY ENTER AFTER EACH INPUT"

PRINT "PROMPT ONE OF THE LIST OF CHARACTERS AS THEY APPEAR FROM"

PRINT "TOP TO BOTTOM."

PRINT

PRINT " ABCDEFGHI JKLM

PRINT "NOPQRSTUVWXYZ

PRINT "0123456789"

PRINT "* () : $=><"

PRINT %;+.?/ " INPUT A$

INPUT B

$

INPUT C$

INPUT D$

INPUT E$

IF A$<>" ABCDEFGHI JKLM" THEN 1640

IF B $ <> " NOPQRSTUVWXYZ " THEN 1640

IF C$<>" 0123456789" THEN 1640

IF D$<>"*() :$=><" THEN 1640

IF E$ = " - %;+.?/" THEN 1430

NEXT I GOTO 1750

IF F § <

>

" 1 1" THEN 1680

RETURN

FOR 1=1 TO 3 PRINT " DATA ERROR, PLEASE ENTER AFTER THE INPUT-PROMPT THE"

PRINT "DIGIT 1, SPACE OVER EIGHT SPACES, AND THE TYPE THE DIGIT 1"

PRINT "AGAIN."

INPUT F

$

IF F $ = " 1 1" THEN 1670

NEXT I PRINT " FAILURE TO ENTER PROPER DATA."

PRINT

PRINT " END TEST."

PRINT

PRINT

END

186

.
*****************

* SAMPLE OUTPUT * *****************

PROGRAM FILE 83

SECTION 83.1

EVALUATION OF A SUBSCRIPTED VARIABLE IN A VARIABLE LIST

BEGIN TEST.

AFTER EACH SUCCESSIVE INPUT-PROMPT, ENTER SEQUENTIALLY

ONE OF THE FOLLOWING LISTED NUMBERS : 1 . 5 , 2 . 5 , 3 . 5 , 4 . 5 , 5 . 5

,

6.5.7.5.8.5.9.5.10.5

?1 .

5

?2 .

5

?3.

5

?4.

?5.

?6 . 77.5

?8 .

5

?9 . ?10.

5

LISTED BELOW ARE YOUR 10 INPUTTED DATA VALUES FOR THE

ARRAY A ( I )

.

THE ELEMENTS ARE LISTED IN THE ORDER OF A(l),

A (2) , A ( 3 ) , . . . ,A(10) FROM TOP TO BOTTOM RESPECTIVELY.

1.5

2.5

3.5

4.5

5.5

6.5

5 8.5

9.5

10.5

AFTER THE INPUT-PROMPT, YOU ARE TO ENTER ONLY TWO INPUT-VALUES. (1) FOR THE FIRST INPUT-VALUE, SELECT ONE OF

THE DIGITS 1,2, 3,..., 10 AS THE SELECTION OF ONE OF THE ELEMENTS OF ARRAY A (I). (2) FOR THE SECOND INPUT-VALUE, ENTER

THEN NUMBER 54.8.

75,54.8

LISTED BELOW ARE AGAIN THE ELEMENTS OF ARRAY A (I) IN

THE SAME ORDER A ( 1 )

, A ( 2 ), A ( 3 ) , . . ., A ( 1 0

)

FROM TOP TO BOTTOM

187
RESPECTIVELY, BUT IN THIS LIST THE VALUE OF YOUR SELECTED

ELEMENT SHOULD BE 54.8 AND NOT THE VALUE IT HAD IN THE LIST

ABOVE.

1.5

2.5

3.5

4.5

54.8

6.5

7 .5

8.5

9.5

10.5

END TEST.

SECTION 83.2

ALLOWABLE CHARACTERS FOR UNQUOTED STRING INPUTS

BEGIN TEST.

AT EACH SUCCESSIVE INPUT-PROMPT, ENTER ONE OF THE ROWS

OF CHARACTERS BELOW AS THEY APPEAR FROM TO TO BOTTOM:

ABCDEFGHI JKLM

NOPQRSTU VWXYZ

0123456789

* 0 :$ = ><

- %;+.?/

7 ABCDEFGHI JKLM

7NOPQRSTUVWXYZ

70123456789

?* 0 :$ = ><

?- %;+.?/

AFTER THE INPUT-PROMPT, ENTER THE DIGIT 1, SPACE OVER

EIGHT SPACES, AND THEN TYPE THE DIGIT 1 AGAIN.

71 1 UNQUOTED-STRING-CHARACTER= SPACE/PLAIN -STRING-CHARACTER

PLAIN-STRING-CHARACTERS.

ABCDEFGHI JKLMNOPQRSTUVWXYZ 0123456789* () :$ = ><- %;+.?/

IF THE LINE OF CHARACTERS PRINTED BELOW, APPEAR IN THE

SAME FORM AS THE LINE OF CHARACTERS ABOVE, CHECK TEST PASSED.

ABCDEFGHI JKLMNOPQRSTU VWXYZ 0123456789* () : $ = ><- %;+.?/

188
SPACE (IMBEDDED).

IF AFTER THE COLUMN NUMBERED HEADINGS, THERE ARE EIGHT

COUNTABLE SPACES BETWEEN THE ONES- CHECK TEST PASSED.

000000000111111111122222222223333333333444444444455555555556666666666777

123456789012345678901234567890123456789012345678901234567890123456789012

1 1

END TEST.
84.0

INPUTTING MIXED DATA

84.1

Testing Leading and Trailing Spaces on Unquoted Strings

This test verifies that the implementation recognizes that leading and

trailing spaces should be ignored when used with unquoted strings. The test

has messages printed to the user. These instructions supply the information

which the user should follow for each input-reply response. On output, the

test generates two rows of digits to act as column labels. Following this

output, t ie user inputs should be printed to verify that trailing and leading

spaces are ignored by the implementation. The reader is referred to section

13.4 of BSR X3. 60 .

84.2

Inputting Leading and Trailing Spaces in Quoted Strings

This test shows that the implementation should recognize all leading and

trailing spaces used in quoted strings. The test generates appropriate data

input instructions to the user. These instructions supply the information

the user should follow for each input-reply response. The test checks the

correctness of the input values. Should the user fail to properly enter the

data requested according to the printed instructions, the test will terminate

its execution by printing the following message: FAILURE TO ENTER PROPER

DATA. If the user correctly enters the data two rows of digits should be

printed to act as column labels and the results entered by the user.

84.3

Inputting Mixed Data

This test shows that numeric constants and string constants can be

entered in mixed form as the DATA-list for an input response. All data

entered by the user will be checked for proper form as specified by the

input-prompt messages. As in the previous tests, if any data is entered

incorrectly, the user will be given three chances to enter the data

correctly. If after the three chances the data is still entered incorrectly,

the following message will be printed: FAILURE TO ENTER PROPER DATA and

termination of the test will follow. However, if the data is entered

correctly, an output should be printed in two columns. In the first column

the required output will be printed and in the second column, the test system

output will be printed.

*******************

* PROGRAM FILE 84 * *******************

0010 PRINT "PROGRAM FILE 84"

0020 PRINT

190
0030

00 4 0 0090

0100

0110

0130

0140

0150

0160

0170

0180

0190

0200

0210

0220

0230

0240

0250

0260

0270

0280

0290

0300

0310

0320

0330

0340

0350

0360

0370

0380

0390

0 4 00

0410

0420

0430

0440

0450

0460

0470

0480

0490

0500

0510

0520

0530

0540

0550

0560

0570

0580

0590

0600

0610

0620

0630

0640

SECTION 84. I"

BEGIN TEST."

INPUT SHOULD NOT EXCEED 72 CHARACTERS PER LINE."

PRINT

PRINT

PRINT " PRINT

PRINT "TESTING LEADING AND TRAILING SPACES ON UNQUOTED STRINGS,

PRINT

PRINT

PRINT " PRINT

PRINT "NOTE:

PRINT

PRINT

FOR 1=1 TO 3 PRINT " AFTER THE INPUT-PROMPT, AS A CHOICE OF INPUT, MAKE"

PRINT "YOUR SELECTION FROM THE DIGITS 0 , 1 , 2 , 3 , . . .

, 9 IN ACCORDANCE"

PRINT "WITH THE FOLLOWING STEPS."

PRINT

PRINT " (1) SPACE OVER ABOUT FIVE SPACES, THEN TYPE YOUR"

PRINT "SELECTED DIGIT."

PRINT “ (2) SPACE OVER ABOUT FIVE SPACES, FOLLOW THIS ACTION"

PRINT "BY TYPING THE COMMA PUNCTUATION MARK, THEN TYPE YOUR NEXT"

PRINT "SELECTED DIGIT."

INPUT G$,H$

PRINT

PRINT

PRINT " IF AFTER THE COLUMN NUMBERED HEADINGS, YOUR TWO"

PRINT "SELECTED DIGITS ARE PRINTED STARTING IN COLUMN ONE WITHOUT"

PRINT "ANY SPACES SEPARATING THEM, TYPE YES AFTER THE INPUT-PROMPT"

PRINT "WHICH FOLLOWS, AND IF NOT, TYPE NO."

PRINT

PRINT

PRINT "00000000011111111112222222222333333333344444444445";

PRINT "5555555556666666666777"

PRINT "12345678901234567890123456789012345678901234567890";

PRINT "1234567890123456789012"

PRINT G$ ; H

$

INPUT 1$

IF I $="YES" THEN 490

GOSUB 540

NEXT I GOTO 650

PRINT " TEST PASSED."

GOTO 520

PRINT " TEST FAILED."

PRINT

GOTO 680

PRINT

PRINT " IF THE OUTPUT WAS INCORRECT BECAUSE YOU DID NOT FOLLOW"

PRINT "THE INPUT DIRECTIONS CORRECTLY, THEN YOU SHOULD TYPE YES"

PRINT "WHEN THE INPUT-PROMPT APPEARS AFTER THIS PARAGRAPH AND BY"

PRINT "DOING SO YOU WILL HAVE ANOTHER CHANCE TO ENTER DATA COR-"

PRINT "RECTLY. HOWEVER, IF YOU DID FOLLOW THE INPUT DIRECTIONS"

PRINT "CORRECTLY, TYPE A NO WHEN THE INPUT-PROMPT APPEARS AFTER"

PRINT "THIS PARAGRAPH."

INPUT

IF J $ = " NO" THEN 510

RETURN

191
0650

0660

0670

0680

0690

0700

0710

0720

0730

0740

0750

0760

0770

0780

0790

0800

0810

0820

0830

0840

0850

0860

0870

0880

0890

0900

0910

0920

0930

0940

0950

0960

09‘7 0 0980

0990

1000

1010

1020

1030

1040

1050

1060

1070

1080

1090

1100

1110

1120

1130

1140

1150

1160

1170

1180

1190

1200

1210

PRINT

PRINT " FAILURE TO ENTER DATA CORRECTLY."

PRINT

PRINT " END TEST."

PRINT

PRINT

PRINT

PRINT

PRINT " SECTION 84.2"

PRINT

PRINT "INPUTTING LEADING AND TRAILING SPACES IN QUOTED STRINGS."

PRINT

PRINT

PRINT " BEGIN TEST."

PRINT

PRINT " AFTER THE INPUT-PROMPT, ENTER DATA WITHIN THE QUOTE-"

PRINT "MARK SYMBOLS OF PUNCTUATION IN ACCORDANCE WITH THE FOLLOW-"

PRINT "ING PROCEDURES:"

PRINT

PRINT " (1) SPACE OVER EXACTLY FIVE SPACES, THEN TYPE THE WORD"

PRINT "THAT FOLLOWS: SPACED"

PRINT " (2) SPACE OVER EXACTLY FIVE SPACES, FOLLOW THIS ACTION"

PRINT "BY TYPING THE COMMA PUNCTUATION MARK, THEN TYPE THE WORD"

PRINT "THAT FOLLOWS: APART"

INPUT L$,M$

GOSUB 1040

PRINT

PRINT " IF AFTER THE COLUMN NUMBERED HEADINGS, THE WORD SPACED"

PRINT "IS PRINTED STARTING IN THE SIXTH COLUMN AND THE WORD APART"

PRINT "IS PRINTED STARTING IN THE SEVENTEENTH COLUMN, CHECK TEST"

PRINT "PASSED."

PRINT

PRINT "00000000011111111112222222222333333333344444444445";

PRINT "555555555666666666677''"

PRINT "12345678901234567890123456789012345678901234567890"

;

PRINT "1234567890123456789012"

PRINT L$;M$

PRINT

GOTO 1220

IF L$<>" SPACED "THEN 1070

IF M$<> "APART" THEN 1070

RETURN

FOR 1=1 TO 3 PRINT " DATA ERROR, PLEASE ENTER DATA AFTER THE INPUT-PROMPT"

PRINT "WITHIN THE QUOTE-MARK SYMBOLS OF PUNCTUATION IN ACCORDANCE"

PRINT "WITH THE FOLLOWING STEPS:"

PRINT

PRINT " (1) SPACE OVER EXACTLY FIVE SPACES, THEN TYPE THE WORD"

PRINT "THAT FOLLOWS: SPACED"

PRINT " (2) SPACE OVER EXACTLY FIVE SPACES, FOLLOW THIS ACTION"

PRINT "BY TYPING THE COMMA PUNCTUATION MARK, THEN TYPE THE WORD"

PRINT "THAT FOLLOWS: APART"

INPUT L$ , M

$

IF L $ <

>

" SPACED "THEN 1200

IF M$="APART " THEN 1060

NEXT I PRINT " FAILURE TO ENTER PROPER DATA."

192
1220

1230

1240

1250

1260

1270

1280

1290

1293

1295

1300

1310

1320

1330

1340

1350

1360

1370

1380

1390

1400

1410

1420

1430

1440

1450

1460

1470

1480

1490

1500

1510

1520

1530

1540

1550

1560

1570

1580

1590

1600

1610

1620

1630

1640

1650

1660

1670

1680

1690

1700

1710

1720

1730

1740

1750

PRINT

PRINT " END TEST.”

PRINT

PRINT

PRINT

PRINT

PRINT " SECTION 84.3"

PRINT

PRINT " INPUTTING MIXED DATA."

PRINT

PRINT " BEGIN TEST."

PRINT

PRINT " AFTER THE INPUT-PROPT, ENTER DATA ACCORDING TO THE"

PRINT "STEPS WHICH FOLLOW, AND SEPARATING THE PERFORMANCE OF EACH"

PRINT "STEP FROM EACH OTHER WITH THE COMMA PUNCTUATION MARK:"

PRINT

PRINT " (1) WITHIN THE QUOTE-MARK SYMBOLS OF PUNCTUATION, TYPE"

PRINT "THE WORD THAT FOLLOWS: QUOTED"

PRINT " (2) TYPE THE NUMERAL THAT FOLLOWS: 1.23456"

PRINT " (3) TYPE THE WORD THAT FOLLOWS: UNQUOTED"

INPUT N $ , 0 , P$

GOSUB 1510

PRINT

PRINT "NEEDED" , "SYSTEM"

PRINT "OUTPUT" , "OUTPUT"

PRINT

PRINT "QUOTED", N$

PRINT " 1.23456 ",0

PRINT "UNQUOTED" ,P$

PRINT

GOTO 1710

IF N$O"QU0TED" THEN 1550

IF 001.23456 THEN 1550

IF P$ O "UNQUOTED" THEN 1550

RETURN

FOR 1=1 TO 3 PRINT " DATA ERROR, PLEASE ENTER DATA AFTER THE INPUT-PROMPT"

PRINT "ACCORDING TO THE STEPS WHICH FOLLOW, AND SEPARATE THE PER-"

PRINT "FORMANCE OF EACH STEP FROM EACH OTHER WITH THE COMMA PUNC-"

PRINT "TUATION MARK:"

PRINT

PRINT " (1) WITHIN THE QUOTE -MARK SYMBOLS OF PUNCTUATION, TYPE"

PRINT "THEN WORD THAT FOLLOWS: QUOTED"

PRINT " (2) TYPE THE NUMERAL THAT FOLLOWS: 1.23456"

PRINT " (3) TYPE THE WORD THAT FOLLOWS: UNQUOTED"

INPUT N $ , 0 , P$

IF N $ <> "QUOTED" THEN 1690

IF 001.23456 THEN 1690

IF P$= "UNQUOTED" THEN 1540

NEXT I PRINT " FAILURE TO ENTER PROPER DATA."

PRINT

PRINT " END TEST."

PRINT

PRINT

END

193
*****************

* SAMPLE OUTPUT * *****************

PROGRAM FILE 84

SECTION 84.1

TESTING LEADING AND TRAILING SPACES ON UNQUOTED STRINGS.

BEGIN TEST.

NOTE: INPUT SHOULD NOT EXCEED 72 CHARACTERS PER LINE.

AFTER THE INPUT-PROMPT, AS A CHOICE OF INPUT, MAKE

YOUR SELECTION FROM THE DIGITS 0 , 1 , 2 , 3 , . . ., 9 IN ACCORDANCE

WITH THE FOLLOWING STEPS.

(1) SPACE OVER ABOUT FIVE SPACES, THEN TYPE YOUR

SELECTED DIGIT.

(2) SPACE OVER ABOUT FIVE SPACES, FOLLOW THIS ACTION

BY TYPING THE COMMA PUNCTUATION MARK, THEN TYPE YOUR NEXT

SELECTED DIGIT.

? 2 ,8

IF AFTER THE COLUMN NUMBERED HEADINGS, YOUR TWO

SELECTED DIGITS ARE PRINTED STARTING IN COLUMN ONE WITHOUT

ANY SPACES SEPARATING THEM, TYPE YES AFTER THE INPUT-PROMPT

WHICH FOLLOWS, AND IF NOT, TYPE NO.

000000000111111111122222222223333333333444444444455555555556666666666'7 7'7 123456"'8901234 56 78901234567890 123456"'890 1234567 89012345678901234 56789012

28

?YES

TEST PASSED.

END TEST.

SECTION 84.2

INPUTTING LEADING AND TRAILING SPACES IN QUOTED STRINGS.

BEGIN TEST.

19 1*
AFTER THE INPUT-PROMPT, ENTER DATA WITHIN THE QUOTEMARK SYMBOLS OF PUNCTUATION IN ACCORDANCE WITH THE FOLLOWING PROCEDURES:

(1) SPACE OVER EXACTLY FIVE SPACES, THEN TYPE THE WORD

THAT FOLLOWS: SPACED

(2) SPACE OVER EXACTLY FIVE SPACES, FOLLOW THIS ACTION

BY TYPING THE COMMA PUNCTUATION MARK, THEN TYPE THE WORD

THAT FOLLOWS: APART

?" SPACED ", "APART"

IF AFTER THE COLUMN NUMBERED HEADINGS, THE WORD SPACED

IS PRINTED STARTING IN THE SIXTH COLUMN AND THE WORD APART

IS PRINTED STARTING IN THE SEVENTEENTH COLUMN, CHECK TEST

PASSED.

000000000111111111122222222223333333333444444444455555555556666666666777

1234 5678901234 56 789012345678 90 123456"7 8 90 123456789012 34 567890123456789012

SPACED APART

END TEST.

SECTION 84.3

INPUTTING MIXED DATA.

BEGIN TEST.

AFTER THE INPUT-PROPT, ENTER DATA ACCORDING TO THE

STEPS WHICH FOLLOW, AND SEPARATING THE PERFORMANCE OF EACH

STEP FROM EACH OTHER WITH THE COMMA PUNCTUATION MARK:

(1) WITHIN THE QUOTE-MARK SYMBOLS OF PUNCTUATION, TYPE

THE WORD THAT FOLLOWS: QUOTED

(2) TYPE THE NUMERAL THAT FOLLOWS: 1.23456

(3) TYPE THE WORD THAT FOLLOWS: UNQUOTED

?" QUOTED" , 1. 23456, UNQUOTED

NEEDED

OUTPUT

QUOTED

1.23456

UNQUOTED

SYSTEM

OUTPUT

QUOTED

1.23456

UNQUOTED

END TEST
85.0 EXCEPTION TEST TYPE OF DATUM INCORRECT

This test verifies that the implementation recognizes when the type of a datum does not match the type of the variable to which it is assigned (see

section 13.5 of BSR X3.60). If an improper datum type is entered, the

implementation should consider this an exception. The recovery procedure

requires that the user be allowed to resupply the input value.

The test begins with a message asking the user to enter, as an input-reply, the string of characters: SIX. This string is non-numeric,

which is not the type the system expects. Thus, the implementation should

request a resupply of data. If not, then the implementation does not meet

the standard specifications. If the system does ask the user to resupply

data, then the user should enter the numeric constant 1.

*******************

* PROGRAM FILE 85 * *******************

0010 PRINT

0020 PRINT

0030 PRINT

0040 PRINT

0300 PRINT

0310 PRINT

0320 PRINT

0330 PRINT

0340 PRINT

0350 PRINT

0360 PRINT

0370 PRINT

380 PRINT "

"PROGRAM FILE 85"

SECTION 85.0"

TYPE OF DATUM INCORRECT FOR VARIABLE IT IS ASSIGNED TO."

••**** *NOTE ; for THIS PART OF THE TEST, TO STOP THE CONTINUOUS REQUEST BY THE SYSTEM TO RESUPPLY THE INPUT-REPLY"

"(IF IT SHOULD OCCUR), JUST ENTER UPON A REQUEST THE DIGIT 1 *****” 0390 PRINT

0400 PRINT

0410 PRINT " BEGIN TEST."

0420 PRINT

0430 PRINT "AFTER THE INPUT-PROMPT, ENTER THE WORD: SIX"

0440 INPUT A

0450 IF A=1 THEN 480

0460 PRINT "TEST WAS NOT PROPERLY EXECUTED."

0470 GOTO 490

0480 PRINT "TEST WAS PROPERLY EXECUTED."

0490 PRINT

0500 PRINT " END TEST."

0510 PRINT

0520 END

M

196
*****************

* SAMPLE OUTPUT * *****************

PROGRAM FILE 85

SECTION 85.0

TYPE OF DATUM INCORRECT FOR VARIABLE IT IS ASSIGNED TO.

*****NOTE: FOR THIS PART OF THE TEST, TO STOP THE CONTINUOUS REQUEST BY THE SYSTEM TO RESUPPLY THE INPUT-REPLY

(IF IT SHOULD OCCUR), JUST ENTER UPON A REQUEST THE DIGIT 1. *****

BEGIN TEST.

AFTER THE INPUT-PROMPT, ENTER THE WORD: SIX

?SIX

?ILLEGAL DATA, PLEASE RESUPPLY

?1

TEST WAS PROPERLY EXECUTED.

END TEST.

197
86.0 EXCEPTION TEST FOR INPUT - TOO MUCH DATA IN DATA LIST

The objective of this test is to determine whether the implementation

recognizes too much data in the input data-list as an exception (see section

13.5 of BSR X3.60). Upon recognition of the error, the implementation

should allow the user to resupply his input data-list. The test has an instruction message that informs the user to input the data-list: 5, -35.

The test, however, has only one numeric variable in its variable-list for the

INPUT statement. Therefore the user should be requested, by the test system,

to resupply the input-list. Once this message appears the test has been

passed by the host system. In order to terminate the program the user should

enter the constant 1.

*******************

* PROGRAM FILE 86 * *******************

0010 PRINT "PROGRAM F 0020 PRINT

0030 PRINT

0040 PRINT

0120 PRINT n 0130 PRINT

0140 PRINT II 0150 PRINT

0160 PRINT

0170 PRINT «•**** NOTE

0180 PRINT "OUS REQUE

0190 PRINT "RESUPPLY

0200 PRINT "DIGIT 1.*

0210 PRINT

0220 PRINT

0230 PRINT II 0240 PRINT

0250 PRINT "AFTER THE

0260 LET A = 9999

0270 INPUT A

0280 IF A = 1 THEN 310

0290 PRINT "TEST WAS

0300 GOTO 320

0310 PRINT "TEST WAS

0320 PRINT

0330 PRINT II 0340 PRINT

0350 END

SECTION 86.0"

TOO MUCH DATA IN DATA-LIST. "

BEGIN TEST."

END TEST.

198
*****************

* SAMPLE OUTPUT * *****************

PROGRAM FILE 86

SECTION 86.0

TOO MUCH DATA IN DATA-LIST.

*****NOTE: FOR THIS PART OF THE TEST, TO STOP THE CONTINUOUS REQUEST BY THE SYSTEM —THAT IS, IF IT SHOULD OCCUR—TO

RESUPPLY THE INPUT-REPLY, JUST ENTER UPON A REQUEST THE

DIGIT 1.*****

BEGIN TEST.

AFTER THE INPUT-PROMPT, ENTER THE NUMBERS AS FOLLOWS: 5,-35

?5 , -35

?TOO MUCH DATA. PLEASE RESUPPLY

?5 , -35

?TOO MUCH DATA. PLEASE RESUPPLY

?1

TEST WAS EXECUTED PROPERLY

END TEST.

199
87.0 EXCEPTION TEST - INSUFFICIENT DATA IN

DATA-LIST

The objective of this test is to determine whether the implementation

will recognize too little data in the input-list as an exception (see section

13.5 of BSR X3.60). Upon recognition of the error, the implementation

should allow the user to resupply the input data. The test has a message

printed to the user to enter the number 64. However, the program requires

more than one numeric variable in the input-list. Therefore there should be an implementation prompt to resupply the input-list. The user should

continue to supply the value 64 several times to determine whether the system

continues to prompt. Finally the user should enter the list: 1,2 in order

to terminate the test.

*******************

* PROGRAM FILE 87 * *******************

010 PRINT "PROGRAM F 060 PRINT

070 PRINT

080 PRINT

090 PRINT •1 100 PRINT

110 PRINT n 120 PRINT

130 PRINT

140 PRINT " *****note

150 PRINT "OUS REQUE

160 PRINT "RESUPPLY

170 PRINT "DIGITS AS

180 PRINT

190 PRINT

200 PRINT II 210 PRINT

220 PRINT "AFTER THE

230 INPUT A, B 240 IF A

<

>1 THEN 260

250 IF B = 2 THEN 280

260 PRINT "TEST WAS

270 GOTO 290

280 PRINT "TEST WAS

290 PRINT

300 PRINT II 310 PRINT

320 END

SECTION 87.0"

INSUFFICIENT DATA IN DATA-LIST. "

BEGIN TEST.

END TEST."

200
*****************

* SAMPLE OUTPUT * *****************

PROGRAM FILE 87

SECTION 87.0

INSUFFICIENT DATA IN DATA-LIST.

*****NOTE: FOR THIS PART OF THE TEST, TO STOP THE CONTINUOUS REQUEST BY THE SYSTEM —THAT IS, IF IT SHOULD OCCUR—TO

RESUPPLY THE INPUT-REPLY, JUST ENTER UPON A REQUEST THE

DIGITS AS FOLLOWS: 1,2.*****

BEGIN TEST.

AFTER THE INPUT-PROMPT, ENTER THE FOLLOWING NUMBER: 64

?64

7INSUFFICIENT DATA IN LIST. PLEASE RESUPPLY.

?64

PINSUFFICIENT DATA IN LIST. PLEASE RESUPPLY.

?64

7INSUFFIC I ENT DATA IN LIST. PLEASE RESUPPLY.

? 1,

2

TEST WAS EXECUTED PROPERLY.

END TEST.

201
88.0 NUMERIC UNDERFLOW ON INPUT

The objective of this test is to determine whether the implementation

will diagnose as an exception the input of a numeric value too small to be

represented by the test system (see section 13.4 of BSR X3.60). Upon

recognition of the excepti on , the implementation should replace the value with zero and continue the program. The test has a message printed asking the user to input the numerical value of 10.0E-99999. After entering this value

the system will test the input variable to determine whether it has been

assigned the value 0. If not, then a message will indicate that the program

did not execute properly.

*******************

* PROGRAM FILE 88 * *******************

0010

0020

0030

0040

0090

0100

0110

0120

0130

0190

0200

0210

0220

0230

0240

0250

0260

0270

0280

0290

0300

0310

0320

SECTION 88.0"

THE CONVERSION OF A NUMERIC DATUM CAUSES AN UNDERFLOW.

BEGIN TEST."

PRINT "PROGRAM FILE 88"

PRINT

PRINT

PRINT

PRINT " PRINT

PRINT " PRINT

PRINT

PRINT

PRINT " PRINT

PRINT "AFTER THE APPEARANCE OF THE INPUT-PROMPT, ENTER THE FOLLOW-"

PRINT "ING NUMBER: 10.0E-99999"

INPUT A

IF A=0 THEN 280

PRINT "TEST WAS NOT EXECUTED PROPERLY."

GOTO 290

PRINT "TEST WAS EXECUTED PROPERLY."

PRINT

PRINT " PRINT

END

END TEST."

*****************

* SAMPLE OUTPUT * *****************

202
PROGRAM FILE 88

SECTION 88.0

THE CONVERSION OF A NUMERIC DATUM CAUSES AN UNDERFLOW.

BEGIN TEST.

AFTER THE APPEARANCE OF THE INPUT-PROMPT, ENTER THE FOLLOWING NUMBER: 10.0E-99999

?10. 0E-99999

TEST WAS EXECUTED PROPERLY.

END TEST.

203
89.0 EXCEPTION TEST - NUMERIC OVERFLOW

The objective of this test is to determine whether the implementation

will recognize, as an exception, a numeric value in an input-list that is too

large to be represented in the test system (see section 13.5 of BSR

X3.60 ). Upon recognition of the error, the implementation should allow

the user to resupply the input-list. The test has an instruction printed to

the user to enter the value 9 . 99999E99999.

should prompt the user to resupply data since

As in section 88.0, the system

an overflow was registered.

Again in order to terminate the system request the user should type 1.

*******************

* PROGRAM FILE 89 * *******************

0010

0020

0030

0 0 4 0 0090

0100

0110

0120

0130

0140

0150

0160

0170

0180

0190

0200

0210

0220

0230

0240

0250

0260

0270

0280

0290

0300

0310

0320

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

PRINT

INPUT

IF A = PRINT

GOTO

PRINT

PRINT

PRINT

PRINT

END

"PROGRAM FILE 89"

" SECTION 89.0"

" THE CONVERSION OF A NUMERIC DATUM CAUSES AN OVERFLOW. "

• * * * * *NOTE : FOR THIS PART OF THE TEST, TO STOP THE CONTINU-"

"OUS REQUEST BY THE SYSTEM —THAT IS IF IT SHOULD OCCUR—TO"

"RESUPPLY THE INPUT-RELY, JUST ENTER UPON A RE JUEST THE"

"DIGIT 1 .*****

" BEGIN TEST."

"AFTER THE APPEARANCE OF THE INPUT-PROMPT, ENTER THE FOLLOW-"

"ING NUMBER: 9 . 999 9 9E 999 9

9

A

1 THEN 280

"TEST WAS NOT EXECUTED PROPERLY."

290

"TEST WAS EXECUTED PROPERLY."

END TEST."

****** * * *********

201*
* SAMPLE OUTPUT * *****************

PROGRAM FILE 89

SECTION 89.0

THE CONVERSION OF A NUMERIC DATUM CAUSES AN OVERFLOW.

*****NOTE : FOR THIS PART OF THE TEST, TO STOP THE CONTINU

OUS REQUEST BY THE SYSTEM —THAT IS IF IT SHOULD OCCUR—TO

RESUPPLY THE INPUT-RELY, JUST ENTER UPON A REQUEST THE

DIGIT 1.*****

BEGIN TEST.

AFTER THE APPEARANCE OF THE INPUT-PROMPT, ENTER THE FOLLOW

ING NUMBER: 9 . 99999E99999

?9. 99999E99999

POVERFLOW IN INPUT DATA. PLEASE RETYPE

?9. 99999E99999

POVERFLOW IN INPUT DATA. PLEASE RETYPE

? 1.

0

TEST WAS EXECUTED PROPERLY.

END TEST.

205
90.0

TESTING THE INT AND SGN FUNCTIONS

90.1

The INT Function

The objective of this test is to use the INT function which returns the

largest integer not greater than the argument specified (see section 8 of BSR

X3.60). The test uses simple numeric-variables as the argument for the

function. Assignments of various numerical values are made to the simple

variable used as the argument parameter. On output, the test has three

column labels printed. In sequential order the labels should read as follows: ARGUMENT, NEEDED EVALUATION, ACTUAL EVALUATION. The first column

lists the values assigned to the function argument. The second lists the

required evaluations by INT for each argument. Finally, the third column

lists those values generated by the implementation-supplied INT function.

90.2

The SGN Function

This test initiates the use of the SGN function, which supplies -1 if

the argument is negative, 1 if the argument is positive and 0 if the argument

is 0. This test, except for the use of the SGN function instead of the INT

function, is similar to section 90.1 and has a similarly formatted output.

*******************

* PROGRAM FILE 90 * *******************

0010 PRINT

0020 PRINT

0030 PRINT

0040 PRINT

0050 PRINT

0060 PRINT

0070 PRINT

0080 PRINT

0090 PRINT

0100 PRINT

0110 PRINT

0120 PRINT

0130 PRINT

0140 PRINT

0150 PRINT

0160 PRINT

0170 PRINT

0180 PRINT

0190 PRINT

0200 PRINT

"PROGRAM FILE 90"

SECTION 90.0."

(TESTING APPLIC ATIONSS OF THE INT AND SGN FUNCTION. II

" SECTION 90.1: THE INT FUNCTION."

" BEGIN TEST."

EACH EVALUATED FAILURE OF THE INT FUNCTION WILL BE DE-"

"NOTED BY AN ASTERISK BEING PRINTED ON THAT COMPARATIVE ROW"

206
0210

0220

0230

0240

0250

0260

0270

0280

0290

0300

0310

0320

0330

0340

0350

0360

0370

0380

0390

0400

0410

0420

0430

0440

0450

0460

0470

0480

0490

0500

0510

0520

0530

0540

0550

0560

0570

0580

0590

0600

0610

0620

0630

0640

0650

0660

0 67 0 0680

0690

0700

0 7 10

0 7 20

0 7 30

PRINT "OF OUTPUT. CHECK TEST PASSED IF THERE ARE NOT ANY ASTER-"

PRINT "ISKS."

PRINT

PRINT

PRINT " "," NEEDED "," ACTUAL " PRINT " ARGUMENT EVALUATION" , " EVALUATION

PRINT

FOR 1=1 TO 10

READ M ,

N

LET X=INT (N

)

IF XOM THEN 340

PRINT N , M , X GOTO 350

PRINT N,M,X;

NEXT I PRINT

DATA 1,1. 99999,0,. 987 654, 12345, 12345.

6

DATA -1,-. 339872, -8, -7. 2, -9 8766, -98765.

4

DATA -10,-9.99999,127,127.999,-128,-127.999

DATA -1,-. 987654

PRINT

PRINT

PRINT

PRINT " SECTION 90.2: THEN SGN FUNCTION."

PRINT

PRINT " BEGIN TEST."

PRINT

PRINT

PRINT " EACH EVALUATED FAILURE OF THE SGN FUNCTION WILL BE DE-"

PRINT "NOTED BY AN ASTERISK BEING PRINTED ON THAT COMPARATIVE ROW"

PRINT "OF OUTPUT. CHECK TEST PASSED IF THERE ARE NOT ANY ASTER-"

PRINT "ISKS."

PRINT

PRINT

PRINT " "," NEEDED "," ACTUAL " PRINT " ARGUMENT "," EVALUATION" ," EVALUATION"

PRINT

FORI =1 TO 10

READ M 1 , N

1

LET Xl=SGN (Nl)

IF XlOMl THEN 640

PRINT Nl , Ml , Xl

GOTO 650

PRINT Nl , Ml , Xl ; " *

NEXT I PRINT

DATA -1,-. 930896, 1,12345, -1,-1. 222

DATA 0, 0. 00000,1, 2. 18 7 65, -1,-0. 00023

DATA 1,99999,0,0,-1,-888.99

DATA 1,1.99999

PRINT

PRINT

END

207
*****************

* SAMPLE OUTPUT * *****************

PROGRAM FILE 90

SECTION 90.0.

(TESTING APPLICATIONS OF THE INT AND SGN FUNCTIONS.)

SECTION 90.1: THE INT FUNCTION.

BEGIN TEST.

EACH EVALUATED FAILURE OF THE INT FUNCTION WILL BE DENOTED BY AN ASTERISK BEING PRINTED ON THAT COMPARATIVE ROW

OF OUTPUT. CHECK TEST PASSED IF THERE ARE NOT ANY ASTERISKS.

ARGUMENT

NEEDED

EVALUATION

ACTUAL

EVALUATION

1.99999

0.987654

12345.6

-0.3398^2

-7.2

-98765.4

-9.99999

127.999

-127.999

-0.987654

1012345

-1

-8

-98766

-10

127

-128

-1

1012345

-1

-8

-98766

-10

127

-128

-1

SECTION 90.2: THEN SGN FUNCTION.

BEGIN TEST.

EACH EVALUATED FAILURE OF THE SGN FUNCTION WILL BE DENOTED BY AN ASTERISK BEING PRINTED ON THAT COMPARATIVE ROW

OF OUTPUT. CHECK TEST PASSED IF THERE ARE NOT ANY ASTER208
ISKS

ARGUMENT

NEEDED

EVALUATION

ACTUAL

EVALUATION

-0.930896 -1 -1

12345 1 1 -1.222 -1 -1

0 0 0 2.18765 1 1 -2. 30000E-4 -1 -1

99999 1 1

0 0 0 -888.99 -1 -1

1.99999 1 1

209
91.0

PRINTING STRINGS BEYOND THE MARGIN

The objective of this section is to determine how the implementation

handles printing beyond its specified margin. Since the margin is

implementation defined this section uses specifically constructed long

strings, tabbed over a large number of spaces in some of the tests, in order

to take into account variable margin specifications. The reader is referred

to section 12.4 of BSR X3.60.

91.1

Printing Concatenated Strings

The objective of this test section is to determine how the print

delimiters effect printing strings of characters beyond the implementationdefined margin for a given system.

91.1.1

Using Semicolons With Quoted Strings

The objective of this test is to verify that the implementation, upon

the evaluation of any print item, which generates a string whose length is

greater than the implementation-defined margin, will generate an end-of-line

each time the columnar position of the current line exceeds the margin.

Printing then must begin at the first position in the next line. The test

has several print statements that output string constants of 50 characters

each. Each print-list ends with a semicolon, except for the last. The exact

output for this test will depend on the implementation-defined margin;

however, the output should show a continuous string of digits up to and

including the last columnar position for the implementation-defined margin.

If there are any characters remaining they must begin in column one of the

next line.

91.1.2

Using Commas With Quoted Strings

The objective of this test is similar to section 91.1.1. In this test,

the print delimiter used is a comma. However, there is a significant amount

of difference between the two outputs. For this test the string of digits

should not be continuous (i.e., there should be spaces within the string of

printed digits). The number of spaces depends on the implementation-defined

zone lengths. The output must show that the digits should be printedup to

and including the last columnar position for a defined margin, with printing

then continuing on the next line.

91.1.3

Using Semicolons With Assigned Strings

The objective of this test is to determine whether the assignment of

strings that exceed the margin will affect the evaluation of a print-item.

The print-list in this exercise generates a string, whose length is greater

than the defined margin. The implementation should still generate an end-of-line each time the columnar position of the current line exceeds the

margin. The test begins by assigning strings of various lengths to string

variables. These strings vary from lengths of 1 character to 18 characters.

The assigned variables are then printed using semicolon delimiters. The

output for this test should generate a similar display to that described in

210
section 91.1.1.

91.1.4 Using Commas With Assigned Strings

The objective of this test is similar to section 91.1.3, except, in this

test the print separator used in the variable-list for the PRINT statement is

the comma. The structure of this test, except for the comma as print-separator, is similar to the structure of test section 91.1.3, however,

the strings assigned to the string variables are all of equal length. The

output for this test should appear similar to that of section 91.1.2.

91.2 Simple TAB Tests Beyond The Margin

The objective of this test section is to determine whether the

implementation recognizes the standard specified relationship between the TAB

argument and the implementation-defined margin . 91.2.1 TAB Argument is Less Than the Value of the Current

Print Position

The objective of this test is to determine whether the implementation

will, upon evaluating a TAB argument whose rounded value is less than the

columnar position of the current line, generate an end-of-line and enough

spaces to set the columnar position of the new current line to the required

position. This test prints a message that there should be no printed

characters after the period at the end of the message. If there are, then

the tabbing has failed this test.

91.2.2 TAB Assigned Strings Less Than Current Position

The objective of this test, except for assigning the string of

characters to be tabbed to a string variable, is the same as that for section

91.2.1. In terms of output there should be no difference between this

section and the output of section 91.2.1.

* PROGRAM FILE 91 *

001

0

PRINT "PROGRAM FILE 91"

0020 PRINT

0030 PRINT

0 0 4 0 PRINT

0120 PRINT " SECTION

0130 PRINT

0140 PRINT

0150 PRINT " SECTION 91.1.1:

91.1: CONCATENATED STRINGS."

USING SEMICOLON, QUOTED STRINGS."

211
0160 PRINT

0 1 7 0 PRINT

0180 PRINT

0190 PRINT M 0200 PRINT

0210 PRINT "1234 5678901234 567890 1 0220 PRINT "1234 5678901234 567890 1 0230 PRINT "1234 5678901234 567890 1 0240 PRINT "1234 56 7 8901234 56 7 890 1 0250 PRINT "1234 5678901234 567890 1 0260 PRINT

0 27 0 PRINT II

• 0280 PRINT

0290 PRINT

0300 PRINT

0310 PRINT II SECTION

0320 PRINT

0330 PRINT

0340 PRINT

0350 PRINT " 0360 PRINT

0 3 7 0 PRINT "1234 5678901234 56 7 8 9 0 1 0380 PRINT "1234 56 7 8901234 56 7 890 1 0390 PRINT "1234 56 7 8901234 56 7 890 1 0400 PRINT "1234 56 7 8901234 56 7 890 1 0410 PRINT "1234 5678901234 56 7 890 1 0420 PRINT

0430 PRINT n 0440 PRINT

0450 PRINT

0460 PRINT

0 4 7 0 PRINT ii SECTION 91

0480 PRINT

0490 PRINT

0500 PRINT

0510 PRINT ii 0520 PRINT

0530 LET A $

_ n ii 0540 LET B $ „ M 2

II 0550 LET C$ = "12"

0560 LET D$ = "123 n 05 7 0 LET E $ = "123 4"

0580 LET F $ ="12345"

0590 LET G$ = "123 456"

0 6 00 LET H $ = "123 4 567"

0610 LET 1$ = "123 4 5 6

7 8

" 0620 LET J$ = "123 4 56 7 89

0630 LET K$ = "123 456 7 890"

0640 LET L$ ="12345678901"

0650 LET M$ = "123 456789012"

0660 LET N $ = "123 4567890123 n 0670 LET 0$ = "123 456 7 8901234"

0680 LET P$ = "123 456 7 89012345"

0690 LET Q$ = "123 456 7 890123456"

0 7 0 0 LET R$ = "123 4567890123 4567"

0710 LET S$ = "123 456789012345678"

0720 PRINT

BEGIN TEST."

56 7 89012345678901234567890"

56 7 890123456 7 890123456 7 890"

56 7 890123456 7 890123456 7 890"

56 7 890I23456 7 8901234567890"

5678901234567890123456 7 890"

END TEST."

1.2: USING COMMA, QUOTED STRINGS."

BEGIN TEST."

56 7 890 1234 56 7 890 1 234 56 7 890

56 7 890 1234 56 7 890 1 234 56 7 890

567 890 1234 56 7 890 1 234 56 7 890

567 890 1234 56 7 890 1 234 56 7 890

567 890 1234 56 7 890 1 234 56 7 890

END TEST."

: USING SEMICOLON, ASSIGNED STRINGS.

BEGIN TEST."

234

234

234

234

234

91.

234

234

234

234

234

1.3

212
0730

0

7 40

0750

0 7 60

07 7 0

0

7 80

0

7 90

0800

0810

0820

0830

0840

0850

0860

0870

0880

0890

0900

0910

0920

0930

0940

0950

0960

09 7 0 0980

0990

1000

1010

1020

1030

1040

1050

1060

10 7 0 1080

1090

1100

1110

1120

1130

1140

1150

1160

1 1 7 0 1180

1190

1200

1210

1220

1230

1240

1250

1260

1 2

7 0 1280

1290

PRINT A$;B?;C$;D$;E$;F$;G$;H$;I$;J$;K$;L$;M$;N$;0$;P$;Q$;R$;S$

PRINT

PRINT " END TEST."

PRINT

PRINT

PRINT

PRINT " SECTION 91.1.4: USING COMMA, ASSIGNED STRINGS."

PRINT

PRINT

PRINT

PRINT " BEGIN TEST."

PRINT

LET A$=" 1234567890"

LET B$=" 1234567890"

LET C$="123456 7 890"

LET D$=" 1234567890"

LET E$="123456 7 890"

LET F$=" 1234567890"

LET G$=" 1234567890"

LET H$=" 1234567890"

LET I$=" 1234567890"

LET J$=" 1234567890"

LET K$=" 1234567890"

LET L$=" 1234567890"

LET M$=" 1234567890"

LET N$=" 1234567890"

PRINT "00000000011111111112222222222333333333344444444445";

PRINT "5555555556666666666 77 7"

PRINT " 123456789012345678901 234567890123456 7 890123456 7 890";

PRINT "123456 7 890123456789012"

PRINT A$,B$,C$,D$,E$,F$,G$,H$,I$,J$,K$,L$,M$,N$

PRINT

PRINT " END TEST.

PRINT

PRINT

PRINT

PRINT " SECTION 91.2: TAB-CALL WITHIN AND BEYOND MARGIN."

PRINT

PRINT

PRINT " SECTION 91.2.1: TABBING QUOTED STRINGS WHEN TAB-CALL lb"

PRINT " LESS-THAN THE CURRENT PRINT POSITION."

PRINT

PRINT

PRINT

PRINT " BEGIN TEST."

PRINT

PRINT "00000000011111111112222222222333333333344444444445";

PRINT " 5555555556666666666 777 " PRINT "1234567890123456 7 890123456 7 890123456 7 890123456 7 890";

PRINT "123456 7 890123456 7 89012"

PRINT "NO PRINT, THIS LINE, AFTER PERIOD ."; TAB ( 1 5 );" X

PRINT

PRINT " X SHOULD BE ON LINE FOUR, COLUMN 15."

PRINT

PRINT " END TEST."

PRINT

PRINT

213
1300 PRINT

1310 PRINT II 1320 PRINT II 1330 PRINT

1340 PRINT

1350 PRINT

1360 PRINT II

1 3 7 0 PRINT

1380 LET A $ = 1390 PRINT II 1400 PRINT II 1410 PRINT II 1420 PRINT II 1430 PRINT II 1440 PRINT

1450 PRINT II 1460 PRINT

1 4 7 0 PRINT " 1480 PRINT

1490 PRINT

1500 END

SECTION 91.2.2: TABBING ASSIGNED STRINGS WHEN TAB-CALL

LESS-THAN THE CURRENT PRINT POSITION."

BEGIN TEST."

00000000011111111112222222222333333333344444444445"

5555555556666666666 77 7"

123456 7 890123456 7 890123456 7 8901234567890123456 7 890"

123456 7 8 90123456789012"

NO PRINT, THIS LINE, AFTER PERIOD . "

; TAB ( 1 5 )

; A

$

X SHOULD BE ON LINE FOUR, COLUMN 15.

END TEST.

IS"

*****************

* SAMPLE OUTPUT * *****************

PROGRAM FILE 91

SECTION 91.1: CONCATENATED STRINGS.

SECTION 91.1.1: USING SEMICOLON, QUOTED STRINGS.

BEGIN TEST.

12 3456 78 90 12 3456 7 8 9 0 1 2 34 567 890 123456 78901234 5 6

7 8 90 12 3456 7 8 90 1 234 56 7 890 12

34 56 7 8 90 12 34 5 6

7 8 901234 56 7 89 012 3 4 5 6

7 8 90123456 7 890 12 34 5 67 8 90 123456 7 89012 34

56 7890 12 34 56 7890 123456 78 901 234 56 7 890 123456 7 8 9012 34 56 7 890 12 3456 7 8901234 56

78 9012 34 56 78 9012 345678 90 123 456 7 890

END TEST.

SECTION 91.1.2: USING COMMA, QUOTED STRINGS
BEGIN TEST

12345678901234567890123456789012345678901234567890 1234567890123456

7890123456789012345678901234567890 123456789012345678901234567890

12345678901234567890 12345678901234567890123456789012345678901234

567890 12345678901234567890123456789012345678901234567890

END TEST.

SECTION 91.1.3: USING SEMICOLON, ASSIGNED STRINGS.

BEGIN TEST.

11212312341234512345612345671234567812345678912345678901234567890112345

678901212345678901231234567890123412345678901234512345678901234561234567

8901234567123456789012345678

END TEST.

SECTION 91.1.4: USING COMMA, ASSIGNED STRINGS.

BEGIN TEST.

0000000001111111111222222222233333333334444444444555555555566666666667??

123456789012345678901234567890123456789012345678901234567890123456789012

1234567890 1234567890 1234567890 1234567890 1234567890

1234567890 1234567890 1234567890 1234567890 1234567890

1234567890 1234567890 1234567890 1234567890

END TEST.

SECTION 91.2: TAB-CALL WITHIN AND BEYOND MARGIN.

SECTION 91.2.1: TABBING QUOTED STRINGS WHEN TAB-CALL IS

LESS-THAN THE CURRENT PRINT POSITION.

BEGIN TEST.

0000000001111111111222222222233333333334 444 444444555555555 566666666667-7^

123456789012345678901234567890123456789012345678901234567890123456789012

NO PRINT, THIS LINE, AFTER PERIOD.

X

215
X SHOULD BE ON LINE FOUR, COLUMN 15.

END TEST.

SECTION 91.2.2: TABBING ASSIGNED STRINGS WHEN TAB-CALL IS

LESS-THAN THE CURRENT PRINT POSITION.

BEGIN TEST.

000000000111111111122222222223333333333444444444455555555556666666666 777

123456789012345678901234567890123456 7 890123456 7 890123456 7 890123456 7 89012

NO PRINT, THIS LINE, AFTER PERIOD.

X

X SHOULD BE ON LINE FOUR, COLUMN 15.

END TEST
92.0

TABBING STRINGS BEYOND THE MARGIN

92.1

Quoted Strings

The objective of this test is to determine whether the implementation

will, upon evaluating a TAB argument whose rounded value is greater than the

implementation defined margin, reduce the value of n by an integral multiple

of m so that it is in the range l<=n<=m. In particular, n should be set

equal to n-m*INT ( (n-1 ) /m) . The reader is referred to section 12.4 of B3R

X3.60. The test begins by requesting that the user input the value for

the implementation-defined margin. The test then sequentially tabs 100

simple one character strings. Each TAB argument is increasedbya value of 13

(i.e., the arguments are sequentially ordered 13, 26, 39, ..., 1300). On

output, the test generates column count indices in order to verify each

columnar position. Each printout should be sequentially labelled by the

digits 1, 2, 3, ..., 100. Upon completion of the tab-call printout, messages

should be printed out indicating in which columns the strings should begin.

92.2

Assigned Strings

The objective of this test, except for the assigning of the string of

characters, that are to be tabbed, to a string variable, is the same as the

objective stated for test section 92.1. This test uses READ/DATA statements

to assign the strings Al, A2, A3, ...» A100 to the string variable A$ which

is the print-item used in conjunction with the tab-calls. As in test section

92.1, 100 tabbings are used with the same value increment for the tab

arguments. On output this test has a similar format to test 92.1.

*******************

* PROGRAM FILE 92 * *******************

0010 PRINT

0020 PRINT

0030 PRINT

0040 PRINT

0090 PRINT

0100 PRINT

0110' PRINT

0120 PRINT

0130 PRINT

0140 PRINT

0150 PRINT

0160 PRINT

0170 PRINT

0180 PRINT

0200 INPUT

"PROGRAM FILE 92"

" SECTION 92.1: TABBING QUOTED STRINGS BEYOND THE CURRENT"

" PRINT POSITION AS WELL AS BEYOND THE MAR-"

" GIN."

•• BEGIN TEST."

" NOTE: IN ORDER TO GET A PROPER OUTPUT, PLEASE ENTER"

"THE MARGIN VALUE FOR THIS SYSTEM AFTER THE INPUT-PROMPT"

M

21 ?
02113

0220

0230

0240

0250

0260

0270

0280

0290

0300

0310

0320

0330

0340

0350

0360

0370

0380

0390

0 4 00

0410

0420

0430

0440

0450

0460

0470

0480

0490

0500

0510

0520

0530

0540

0550

0560

0570

0580

0590

0600

0610

0620

0630

0640

0650

0660

0670

0680

0690

0700

0710

0 7 2 0 0730

0740

0750

0760

0770

DIM A ( 1 0 0

)

GOSUB 720

LET N=0

FOR 1=1 TO 100

LET N =N + 1

3

PRINT TAB (N) ; "X" ;

I

LET A (I ) =N-M*INT ( (N-l) /M)

NEXT I GOSUB 720

PRINT

FOR 1=1 TO 100

PRINT " X" ; I

; "SHOULD APPEAR BEGINNING IN COLUMN" ; A ( I ) ; " . " NEXT I PRINT

PRINT " END TEST.

PRINT

PRINT

PRINT

PRINT "SECTION 92.2: TABBING ASSIGNED STRINGS BEYOND THE CURRENT

PRINT " PRINT POSITION AS WELL AS BEYOND THE MARPRINT " GIN."

PRINT

PRINT

PRINT

PRINT " BEGIN TEST."

PRINT

GOSUB 7 20

LET N=0

DATA Al,A2,A3,A4,A5,A6,A?,A8,A9,Al0,All,Al2,Al3,Al4,Al5,Al6

DATA A17,A18,A19,A20,A21,A22,A23,A24,£ 15 , A26 , A2 7 , A28 , A2 9 , A30

DATA A31,A32,A33,A34,A35,A36,A37,A38,A39,A40,A41,A42,A43,A44

DATA A45,A46,A4 7 ,A48,A49,A50,A51,A52,A53,A54,A55,A56,A5 7 ,A58

DATA A59,A60,A61,A62,A63,A64,A65,A66,A67,A68,A69,A 7 0,A 7 1,A 7 2 DATA A 7 3,A 7 4,A75,A 7 6,A 7 7,A78,A 7 9,A80,A81,A82,A83,A84,A85,A86

DATA A87, A88,A89,A90, A91, A92, A93,A94, A95, A96, A9 7 , A98, A99, A100

FOR 1=1 TO 100

READ A $

LET N =N + 1

3

PRINT TAB (N) ;A$

LET A (I ) =N-M*INT ( (N-l ) /M)

NEXT I GOSUB 7 20

PRINT

RESTORE

FOR 1=1 TO 100

READ A $

PRINT A$ ; " SHOULD BEGIN IN COLUMN" ; A ( I )

; ".

NEXT I PRINT

PRINT " END TEST."

GOTO 1470

FOR 1=1 TO M

ON 1+INT ( 1/100 ) GOTO 740, 7 60, 780, 800, 820, 840, 860, 880, 900, 920

LET A $ = " 0

" GOTO 930

LET A $ = " 1

GOTO 930
0780 LET A $ = " 2

0790 GOTO 930

0800 LET A $ = " 3

0810 GOTO 930

0820 LET A $ = " 4

0830 GOTO 930

0840 LET A $ = " 5

0850 GOTO 930

0860 LET A $ = " 6

08 7 0 GOTO 930

0880 LET A $ = " 7

0890 GOTO 930

0 900 LET A $ = " 8

0910 GOTO 930

0920 LET A $ = " 9

0930 PRINT A$

;

0940 NEXT I 0950 FOR 1=1 TO M

0960 LET P= (1+INT (1/10) -10* (INT (1/100) )

)

0970 ON P GOTO 980,1000,1020,1040,1060,1080,1100,1120,1140,1160

0980 LET A $ = " 0

0990 GOTO 1170

1000 LET A $ = " 1

1010 GOTO 1170

1020 LET A $ = " 2

1030 GOTO 1170

1040 LET A $ = H 3

1050 GOTO 1170

1060 LET A $ = " 4

1070 GOTO 1170

1080 LET A $ = " 5

1090 GOTO 1170

1100 LET A § = " 6

1110 GOTO 1170

1120 LET A $ = " 7

1130 GOTO 1170

114 0 LET A $ = " 8

1150 GOTO 1170

1160 LET A $ = " 9

" 1170 PRINT A $

;

1180 NEXT I 1190 LET N=0

1200 FOR 1=1 TO M

1210 LET J=I-1

1220 LET N=N+1

1230 ON N-10* (INT (J/10) ) GOTO 1240,1260,1280,1300,1320,1340,1360,1380,1400

1240 LET A $ = " 1

1250 GOTO 1430

1260 LET A $ = '* 2

" 1270 GOTO 1430

1280 LET A $ = " 3

1290 GOTO 1430

1300 LET A $ = " 4

" 1310 GOTO 1430

1320 LET A $ = " 5

" 1330 GOTO 1430

1340 LET A$=" 6

219
1350 GOTO 1430

1360 LET A $ = " 7

" 1370 GOTO 1430

1380 LET A$="8"

1390 GOTO 1430

1400 LET A$=" 9

1410 GOTO 1430

1420 LET A $ = " 0

1430 PRINT A$

;

1440 NEXT I 1450 PRINT

1460 RETURN

1470 PRINT

1480 END

* SAMPLE OUTPUT * *********

PROGRAM FILE 92

SECTION 92.1: TABBING QUOTED STRINGS BEYOND THE CURRENT

PRINT POSITION AS WELL AS BEYOND THE MARGIN.

BEGIN TEST.

NOTE: IN ORDER TO GET A PROPER OUTPUT, PLEASE ENTER

THE MARGIN VALUE FOR THIS SYSTEM AFTER THE INPUT-PROMPT

?7 2 000000000000000000000000000000000000000000000000000000000000000000000000

000000000111111111122222222223333333333444444444455555555556666666666 7 7 7 123456 7 890123456 7 890123456 7 890123456 7 890123456 7 8901234567890123456 7 89012

X X 2 X 3

X 6 X 7 X 8 X

X X 5

X 10

X

220
11

X 12

X 13

X 14

X 15

X 17

X 16

X 18

X 19

X 20

X 21

22

X 23

X 24

X 25

X 26

X 28

X 27

X 29

X 30

X 31

X 32

33

X 34

X 35

X 36

X 37

X 38

X 39

X 40

X 41

X 42

X 43

44

X 45

X 46

X 4 7 X 48

X 49

X 50

X 51

X 52

X 53

X 54

55

X 56

X 57

X 58

X 59

X 61

X 60

X 62

X 63

221
X 64

X 65

X 67

X 68

X 69

X 66

X 70

x ?i

72

X 73

X 74

X 75

X 78

X 79

X 80

X 81

X 76

X 77

X 82

X

83

X 84

X 85

X 89

X 90

X 91

X

X 86

X 87

X 88

X 92

X 93

X 94

X 95

X 96

X 97

X 98

X 99

X 100

000000000000000000000000000000000000000000000000000000000000000000000000

0000000001111111111222222222233333333334444444444555555555566666666667-7-?

123456789012345678901234567890123456789012345678901234567890123456789012

X 1 SHOULD APPEAR BEGINNING IN COLUMN 13 . X 2 SHOULD APPEAR BEGINNING IN COLUMN 26 . X 3 SHOULD APPEAR BEGINNING IN COLUMN 39 . X 4 SHOULD APPEAR BEGINNING IN COLUMN 52 . X 5 SHOULD APPEAR BEGINNING IN COLUMN 65 . X 6 SHOULD APPEAR BEGINNING IN COLUMN 6 . X 7 SHOULD APPEAR BEGINNING IN COLUMN 19 . X 8 SHOULD APPEAR BEGINNING IN COLUMN 32 . X 9 SHOULD APPEAR BEGINNING IN COLUMN 45 . X 10 SHOULD APPEAR BEGINNING IN1 COLUMN 58 . X 11 SHOULD APPEAR BEGINNING IN1 COLUMN 71 . X 12; SHOULD APPEAR BEGINNING IN1 COLUMN 12 .

222
X 13 SHOULD APPEAR BEGINNING IN COLUMN 25

X 14 SHOULD APPEAR BEGINNING IN COLUMN 38

X 15 SHOULD APPEAR BEGINNING IN COLUMN 51

X 16 SHOULD APPEAR BEGINNING IN COLUMN 64

X 17 SHOULD APPEAR BEGINNING IN COLUMN 5 X 18 SHOULD APPEAR BEGINNING IN COLUMN 18

X 19 SHOULD APPEAR BEGINNING IN COLUMN 31

X 20 SHOULD APPEAR BEGINNING IN COLUMN 44

X 21 SHOULD APPEAR BEGINNING IN COLUMN 5^

X 22 SHOULD APPEAR BEGINNING IN COLUMN 70

X 23 SHOULD APPEAR BEGINNING IN COLUMN 11

X 24 SHOULD APPEAR BEGINNING IN COLUMN 24

X 25 SHOULD APPEAR BEGINNING IN COLUMN 37

X 26 SHOULD APPEAR BEGINNING IN COLUMN 50

X 27 SHOULD APPEAR BEGINNING IN COLUMN 63

X 28 SHOULD APPEAR BEGINNING IN COLUMN 4 X 29 SHOULD APPEAR BEGINNING IN COLUMN 17

X 30 SHOULD APPEAR BEGINNING IN COLUMN 30

X 31 SHOULD APPEAR BEGINNING IN COLUMN 43

X 32 SHOULD APPEAR BEGINNING IN COLUMN 56

X 33 SHOULD APPEAR BEGINNING IN COLUMN 69

X 34 SHOULD APPEAR BEGINNING IN COLUMN 10

X 35 SHOULD APPEAR BEGINNING IN COLUMN 23

X 36 SHOULD APPEAR BEGINNING IN COLUMN 36

X 37 SHOULD APPEAR BEGINNING IN COLUMN 49

X 38 SHOULD APPEAR BEGINNING IN COLUMN 62

X 39 SHOULD APPEAR BEGINNING IN COLUMN 3 X 40 SHOULD APPEAR BEGINNING IN COLUMN 16

X 41 SHOULD APPEAR BEGINNING IN COLUMN 29

X 42 SHOULD APPEAR BEGINNING IN COLUMN 42

X 43 SHOULD APPEAR BEGINNING IN COLUMN 55

X 44 SHOULD APPEAR BEGINNING IN COLUMN 68

X 45 SHOULD APPEAR BEGINNING IN COLUMN 9 X 46 SHOULD APPEAR BEGINNING IN COLUMN 22

X 47 SHOULD APPEAR BEGINNING IN COLUMN 35

X 48 SHOULD APPEAR BEGINNING IN COLUMN 48

X 49 SHOULD APPEAR BEGINNING IN COLUMN 61

X 50 SHOULD APPEAR BEGINNING IN COLUMN 2 X 51 SHOULD APPEAR BEGINNING IN COLUMN 15

X 52 SHOULD APPEAR BEGINNING IN COLUMN 28

X 53 SHOULD APPEAR BEGINNING IN COLUMN 41

X 54 SHOULD APPEAR BEGINNING IN COLUMN 54

X 55 SHOULD APPEAR BEGINNING IN COLUMN 6"7 X 56 SHOULD APPEAR BEGINNING IN COLUMN 8 X 57 SHOULD APPEAR BEGINNING IN COLUMN 21

X 58 SHOULD APPEAR BEGINNING IN COLUMN 34

X 59 SHOULD APPEAR BEGINNING IN COLUMN 4 1 X 60 SHOULD APPEAR BEGINNING IN COLUMN 60

X 61 SHOULD APPEAR BEGINNING IN COLUMN 1 X 62 SHOULD APPEAR BEGINNING IN COLUMN 14

X 63 SHOULD APPEAR BEGINNING IN COLUMN 27

X 64 SHOULD APPEAR BEGINNING IN COLUMN 40

X 65 SHOULD APPEAR BEGINNING IN COLUMN 53

X 66 SHOULD APPEAR BEGINNING IN COLUMN 66

X 67 SHOULD APPEAR BEGINNING IN COLUMN 7 X 68 SHOULD APPEAR BEGINNING IN COLUMN 20

X 69 SHOULD APPEAR BEGINNING IN COLUMN' 33

223
X 70 SHOULD APPEAR BEGINNING IN COLUMN 46

X 7 1 SHOULD APPEAR BEGINNING IN COLUMN 59

X 72 SHOULD APPEAR BEGINNING IN COLUMN 72

X 73 SHOULD APPEAR BEGINNING IN COLUMN 13

X 74 SHOULD APPEAR BEGINNING IN COLUMN 26 • X 7 5 SHOULD APPEAR BEGINNING IN COLUMN 39 • X 76 SHOULD APPEAR BEGINNING IN COLUMN 52 * X 77 SHOULD APPEAR BEGINNING IN COLUMN 65 # X 78 SHOULD APPEAR BEGINNING IN COLUMN 6 . X 79 SHOULD APPEAR BEGINNING IN COLUMN 19

X 80 SHOULD APPEAR BEGINNING IN COLUMN 32

X 81 SHOULD APPEAR BEGINNING IN COLUMN 45

X 82 SHOULD APPEAR BEGINNING IN COLUMN 58

X 83 SHOULD APPEAR BEGINNING IN COLUMN 71

X 84 SHOULD APPEAR BEGINNING IN COLUMN 12

X 85 SHOULD APPEAR BEGINNING IN COLUMN 25

X 86 SHOULD APPEAR BEGINNING IN COLUMN 38

X 87 SHOULD APPEAR BEGINNING IN COLUMN 51

X 88 SHOULD APPEAR BEGINNING IN COLUMN 64 # X 89 SHOULD APPEAR BEGINNING IN COLUMN 5 . X 90 SHOULD APPEAR BEGINNING IN COLUMN 18

X 91 SHOULD APPEAR BEGINNING IN COLUMN 31

X 92 SHOULD APPEAR BEGINNING IN COLUMN 44

X 93 SHOULD APPEAR BEGINNING IN COLUMN 5 7 X 94 SHOULD APPEAR BEGINNING IN COLUMN 70

X 95 SHOULD APPEAR BEGINNING IN COLUMN 11 . X 96 SHOULD APPEAR BEGINNING IN COLUMN 24 # X 97 SHOULD APPEAR BEGINNING IN COLUMN 3 7 * X 98 SHOULD APPEAR BEGINNING IN COLUMN 50 # X 99 SHOULD APPEAR BEGINNING IN COLUMN 63 1 X 100 SHOULD APPEAR BEGINNING IN COLUMN 4 . END TEST.

SECTION 92.2: TABBING ASSIGNED STRINGS BEYOND THE CURRENT

PRINT POSITION AS WELL AS BEYOND THE MARGIN.

BEGIN TEST.

000000000000000000000000000000000000000000000000000000000000000000000000

000000000111111111122222222223333333333444444444455555555556666666666 777

1234567890123456 7 890123456 7 8901234567890123456 7 890123456 7 890123456 7 89012

A

1

A 2 A3

A 4

A 6 A7

A8

A9

A 5

22k
1 A12

A13

A 1

4

A17

A 1

8

A19

A20

A23

A24

A25

A 28

A 2 9 A30

A 3

1

A 34

A 35

A36

A39

A40

A41

A42

A 1

0

A

1

A 1

5

A 1

6

A 2

1

A 2 2

A26

A2~>

A 32

A 3 3

A3 -

? A 3 8

A 4 3 A44

A45

A46

A 50

A 5

1

A52

A 56

A 5?

A61

A62

A63

A4 7 A48

A 4 9

A 5 3 A 5 4 A 5 5

A 58

A59

A 6 0

A64

A65

225
A66

A67

A68

A69

A70

A"7 !

72

A73

A74

A75

A76

A 77

A78

A 7 9 A 8 0 A81

A82

A8

A84

A85

A86

A87

A88

A89

A90

A91

A92

A93

A94

A95

A96

A97

A98

A99

A 1 0 0 000000000000000000000000000000000000000000000000000000000000000000000000

000000000111111111122222222223333333333444444444455555555556666666666 77 7 12345678901234 56 7 890123456 7 8901234567890123456 7 890123456 7 890123456 7 89012

A

1

SHOULD BEGIN IN COLUMN 13 . A 2 SHOULD BEGIN IN COLUMN 26 . A3 SHOULD BEGIN IN COLUMN 39 . A 4 SHOULD BEGIN IN COLUMN 52 . A 5 SHOULD BEGIN IN COLUMN 65 . A 6 SHOULD BEGIN IN COLUMN 6 . A 7 SHOULD BEGIN IN COLUMN 19 . A8 SHOULD BEGIN IN COLUMN 32 . A9 SHOULD BEGIN IN COLUMN 45 . A 1

0

SHOULD BEGIN IN COLUMN 58 . All SHOULD BEGIN IN COLUMN 71 . A 1

2

SHOULD' BEGIN IN COLUMN 12 . A 1

3

SHOULD BEGIN IN COLUMN 25 . A 1

4

SHOULD BEGIN IN COLUMN 38 . A15 SHOULD BEGIN IN COLUMN 51 .

226

k
A 1

6

SHOULD BEGIN IN COLUMN 64

A 1

7

SHOULD BEGIN IN COLUMN 5 A 1

8

SHOULD BEGIN IN COLUMN 18

Al 9 SHOULD BEGIN IN COLUMN 31

A 20 SHOULD BEGIN IN COLUMN 44

A 2

1

SHOULD BEGIN IN COLUMN 57

A22 SHOULD BEGIN IN COLUMN 70

A23 SHOULD BEGIN IN COLUMN 11

A24 SHOULD BEGIN IN COLUMN 24

A 25 SHOULD BEGIN IN COLUMN 37

A26 SHOULD BEGIN IN COLUMN 50

A 27 SHOULD BEGIN IN COLUMN 63

A 28 SHOULD BEGIN IN COLUMN 4 A29 SHOULD BEGIN IN COLUMN 17

A30 SHOULD BEGIN IN COLUMN 30

A31 SHOULD BEGIN IN COLUMN 43

A 32 SHOULD BEGIN IN COLUMN 56

A 33 SHOULD BEGIN IN COLUMN 69

A 34 SHOULD BEGIN IN COLUMN 10

A 35 SHOULD BEGIN IN COLUMN 23

A 36 SHOULD BEGIN IN COLUMN 36

A37 SHOULD BEGIN IN COLUMN 49

A 38 SHOULD BEGIN IN COLUMN 62

A 39 SHOULD BEGIN IN COLUMN 3 A40 SHOULD BEGIN IN COLUMN 16

A 4 1 SHOULD BEGIN IN COLUMN 29

A42 SHOULD BEGIN IN COLUMN 42

A43 SHOULD BEGIN IN COLUMN 55

A 4 4 SHOULD BEGIN IN COLUMN 68

A45 SHOULD BEGIN IN COLUMN 9 A46 SHOULD BEGIN IN COLUMN 22

A4‘* SHOULD BEGIN IN COLUMN 35

A 48 SHOULD BEGIN IN COLUMN 48

A49 SHOULD BEGIN IN COLUMN 61

A 50 SHOULD BEGIN IN COLUMN 2 A 51 SHOULD BEGIN IN COLUMN 15

A 52 SHOULD BEGIN IN COLUMN 28

A53 SHOULD BEGIN IN COLUMN 41

A 54 SHOULD BEGIN IN COLUMN 54

A55 SHOULD BEGIN IN COLUMN 6 7 A 56 SHOULD BEGIN IN COLUMN 8 A57 SHOULD BEGIN IN COLUMN 21

A 58 SHOULD BEGIN IN COLUMN 34

A59 SHOULD BEGIN IN COLUMN 47

A60 SHOULD BEGIN IN COLUMN 60

A 6

1

SHOULD BEGIN IN COLUMN 1 A62 SHOULD BEGIN IN COLUMN 14

A 6 3 SHOULD BEGIN IN COLUMN 2i

A64 SHOULD BEGIN IN COLUMN 40

A65 SHOULD BEGIN IN COLUMN 53

A66 SHOULD BEGIN IN COLUMN 66

A67 SHOULD BEGIN IN COLUMN 7 A68 SHOULD BEGIN IN COLUMN 20

A69 SHOULD BEGIN IN COLUMN 33

A 7 0 SHOULD BEGIN IN COLUMN 46

A71 SHOULD BEGIN IN COLUMN 59

A72 SHOULD BEGIN IN COLUMN 72
A73 SHOULD BEGIN IN COLUMN 13

A 7 4 SHOULD BEGIN IN COLUMN 26

A75 SHOULD BEGIN IN COLUMN 39

A 7 6 SHOULD BEGIN IN COLUMN 52

All SHOULD BEGIN IN COLUMN 65

A 1 Q SHOULD BEGIN IN COLUMN 6 A79 SHOULD BEGIN IN COLUMN 19

A 80 SHOULD BEGIN IN COLUMN 32

A81 SHOULD BEGIN IN COLUMN 45

A82 SHOULD BEGIN IN COLUMN 58

A83 SHOULD BEGIN IN COLUMN 7 1 A84 SHOULD BEGIN IN COLUMN 12

A85 SHOULD BEGIN IN COLUMN 25

A86 SHOULD BEGIN IN COLUMN 38

A8 7 SHOULD BEGIN IN COLUMN 51

A88 SHOULD BEGIN IN COLUMN 64

A89 SHOULD BEGIN IN COLUMN 5 A90 SHOULD BEGIN IN COLUMN 18

A91 SHOULD BEGIN IN COLUMN 31

A 9 2 SHOULD BEGIN IN COLUMN 44

A93 SHOULD BEGIN IN COLUMN 57

A 94 SHOULD BEGIN IN COLUMN 70

A 95 SHOULD BEGIN IN COLUMN 11

A 96 SHOULD BEGIN IN COLUMN 24

A97 SHOULD BEGIN IN COLUMN 37

A 98 SHOULD BEGIN IN COLUMN 50

A99 SHOULD BEGIN IN COLUMN 63

A 1 0 0 SHOULD BEGIN1 IN COLUMN 4
93.0 EXCEPTION TEST - STRING OVERFLOW

A preliminary test of acceptable assigned string lengths was done in

section 57.0. At that time string s of length 19, 20, 30, 40, 50, and 58

characters were used. Since program lines had to be restricted to 7 2 characters, inordinately long strings, used as program constants, could not

be tested. However, with the INPUT statement longer strings can be

introduced. The present test is based upon the assumption that a BASIC

processor will have an input buffer of some maximum length, which may be

unknown to the user. But, if the user enters a sufficiently long string, an overflow is inevitable. In order to execute this test one must assume that

characters can be continuously typed on a terminal and that a carriage return

or line feed character is not introduced into the string unless they are specifically entered by the user (say by a RETURN key). The user begins the

test by entering 18 characters. All succeeding entries will be in multiples

of 36. The user will then be asked to enter a sequence of strings of

increasing length. If no overflow is encountered at an entry the user will

be asked to enter a longer string. When a string overflow is finally

encountered, the test system must provide a message to the user indicating the

overflow and requesting input reentry (see section 13.5 of BSR X3.60).

The user should then type STOP since the system would have responded properly

to the string overflow. The authors have experienced at least one system

that allowed a string entry of more than 145 characters before an overflow

message was encountered.

* PROGRAM FILE 93 *

10 PRINT " 20 PRINT

30 PRINT

40 PRINT

50 PRINT " 60 PRINT

7 0 PRINT " 90 PRINT

100 PRINT

120 PRINT

130 PRINT

135 PRINT

140 PRINT

145 PRINT

150 PRINT

160 PRINT

1 7 0 PRINT

175 PRINT

180 PRINT

PROGRAM FILE 93"

SECTION 93.0"

CONVERSION OF A STRING INPUT DATUM CAUSES A STRING OVERFLOW"

" BEGIN TEST"

"THERE ARE TWO CRITERIA THAT MUST BE MET TO PASS THIS TEST. " "FIRST, IF A STRING OVERFLOW IS ENCOUNTERED THEN THE USER " "MUST BE ALLOWED TO REENTER THE STRING INPUT. SECOND, THE " "FIRST STRING INPUT OF 18 CHARACTERS MUST BE ACCEPTED " "WITHOUT ANY DIAGNOSTIC."

"UPON ENCOUNTERING AN OVERFLOW AND A REQUEST TO REENTER DATA"

"THE USER SHOULD TYPE STOP, WHICH TERMINATES THE PROGRAM."

229
190

210

220

230

240

250

260

270

280

285

290

320

325

330

340

345

350

360

370

380

385

390

400

410

415

420

430

440

450

460

465

4 6

7 468

4 7 0

PRINT "UPON INPUT PROMPT ENTER THE 18 CHARACTERS SHOWN BELOW."

PRINT

PRINT "XXXXXXXXXXXXXXXXXX"

INPUT A$

IF A$O"ST0P" THEN 2 7 0 PRINT "THIS SYSTEM HAS FAILED TO ACCEPT AN 18 CHARACTER STRING."

GO TO 4

7 0 PRINT

PRINT "FURTHER INPUT STRINGS WILL BE IN MULTIPLES OF 36 CHARACTER."

LET Q = 0 PRINT

PRINT "PLEASE DUPLICATE THE CHARACTER STRINGS DISPLAYED BEFORE EACH"

PRINT "INPUT PROMPT."

FOR I = 1 +Q * 1 0 0 TO 100+Q*100

PRINT

LET L = 36*1

PRINT "NEW INPUT STRING:"; L ; " CHARACTERS"

FOR J = 1 TO L

PRINT "X";

NEXT J PRINT

INPUT A$

IF A$<> "STOP" THEN 430

PRINT "IF STOP WAS TYPED DUE TO AN OVERFLOW MESSAGE THEN TEST"

PRINT "HAS PASSED WITH THIS MESSAGE."

GO TO 4

7 0 NEXT I PRINT

PRINT "NO OVERFLOWS UP TO THIS POINT. THE USER MUST CONTINUE."

PRINT "IF STOP IS TYPED BEFORE AN OVERFLOW THEN THE TEST IS"

PRINT "INVALID AND MUST BE RUN AGAIN."

LET Q = Q + 1 GO TO 320

END

*****************

* SAMPLE OUTPUT * *****************

PROGRAM FILE 93

SECTION 93.0

CONVERSION OF A STRING INPUT DATUM CAUSES A STRING OVERFLOW

BEGIN TEST

230
THERE ARE TWO CRITERIA THAT MUST BE MET TO PASS THIS TEST.

FIRST, IF A STRING OVERFLOW IS ENCOUNTERED THEN THE USER

MUST BE ALLOWED TO REENTER THE STRING INPUT. SECOND, THE

FIRST STRING INPUT OF 18 CHARACTERS MUST BE ACCEPTED

WITHOUT ANY DIAGNOSTIC.

UPON ENCOUNTERING AN OVERFLOW AND A REQUEST TO REENTER DATA

THE USER SHOULD TYPE STOP, WHICH TERMINATES THE PROGRAM.

UPON INPUT PROMPT ENTER THE 18 CHARACTERS SHOWN BELOW. xxxxxxxxxxxxxxxxxx

? XXXXXXXXXXXXXXXXXX

FURTHER INPUT STRINGS WILL BE IN MULTIPLES OF 36 CHARACTER.

PLEASE DUPLICATE THE CHARACTER STRINGS DISPLAYED BEFORE EACH

INPUT PROMPT.

NEW INPUT STRING: 36 CHARACTERS

XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

7XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

NEW INPUT STRING: ^2 CHARACTERS

XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

7XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

XNEW INPUT STRING: 108 CHARACTERS xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

? XXXXXXXXX XX XXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXX X XXXXXXXXXXXXXXXXXX XXX XX XX XX

XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

NEW INPUT STRING: 144 CHARACTERS

XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

7XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

XNEW INPUT STRING: 180 CHARACTERS

XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXX

XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

7XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXX xxxxxxxxxxxxxxxxxx XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

? I N PUT STRING TOO LONG. PLEASE REENTER.

?STOP

231
NBS-1 14A (REV. 7-73)

U.S. DEPT. OF COMM. BIBLIOGRAPHIC DATA

SHEET

1. PUBLICATION OR REPORT NO. NBS IR 78-1420-32. Gov’t Accession

No.

3. Recipient’s Accession No.

4. TITLE AND SUBTITLE NBS Minimal BASIC Test Programs - Version 1 User’s Manual

Volume 3 - Control Statements, Data Structure, Program Input

5. Publication Date January 1978

6. Performing Organization Code

7. AUTHOR(S)

David E. Gilsinn and Charles L, Sheppard

8. Performing Organ. Report No.

9. PERFORMING ORGANIZATION NAME AND ADDRESS

NATIONAL BUREAU OF STANDARDS

DEPARTMENT OF COMMERCE

WASHINGTON, D.C. 20234

10. Project/Task/Work Unit No. 6401121

11. Contract/Grant No.

12. Sponsoring Organization Name and Complete Address (Street, City, State, ZIP)

National Bureau of Standards

13. Type of Report & Period Covered Final

14. Sponsoring Agency Code

15. SUPPLEMENTARY NOTES

16. ABSTRACT (A 200-word or less tactual summary ol most significant information. II document includes a significant bibliography or literature survey, mention it here.) This volume is the third of four volumes that comprise the user's guide to the

NBS Minimal BASIC Test Programs. The programs test whether a BASIC processor accepts

the syntactical forms and produces semantically meaningful results according to the

specifications given in BSR X3.60 Proposed American National Standard for Minimal

BASIC . The object of this volume is to complete the testing of the control

structures, introduce new data structures, and test the user interactive capability

of the language. There are sixty individual programs in this volume that cover looping structures, array variables, exception tests, subroutines, multiway branch

structures, data declarations and interactive data inputs. The entire set of

programs is available on tape.

17. KEY WORDS (six to twelve entries ; alphabetical order; capitalize only the first letter of the first key word unless a proper name; separated by semicolons)

BASIC} BASIC standard; BASIC validation; compiler validation; computer programming

language; computer standards.

18. AVAILABILITY [L Unlimited

For Official Distribution. Do Not Release to NTIS

Order From Sup. of Doc., U.S. Government Printing Office Washington, D.C. 20402, SD ( at. No. Cl ^ Order From National Technical Information Service (N ITS) Springfield, Virginia 22151

19. SECURITY CLASS

(THIS REPORT)

UNCI. ASSUMED

20. SECURITY ( LASS

(THIS PAGE)

UNCLASSIFIED

21. NO. OF PAGES

239

22. Price

USCOMM.nC 2 904 .i P’4