640 PRINT "00000000011111111112222222222333333333344444444445"; 650 PRINT "5555555556" 660 PRINT "12345678901234567890123456789012345678901234567890"; 670 PRINT "1234567890" 680 LET A=.4 690 PRINT TAB(A); "X" 700 PRINT 710 PRINT "*** TEST PASSED IF AN X IS PRINTED IN COLUMN 1, AFTER A" 1) A MESSAGE IDENTIFYING THE EXCEPTIONS MUST BE 2) THE ARGUMENT TO TAB MUST BE REPLACED WITH A SECTION 8.1: TAB ARGUMENT IS 0. BEGIN TEST. 000000000111111111122222222223333333333444444444455555555556 123456789012345678901234567890123456789012345678901234567890 % TAB OUT OF RANGE IN LINE 190 X *** TEST PASSED IF AN X IS PRINTED IN COLUMN 1, AFTER A SYSTEM MESSAGE IDENTIFYING THE EXCEPTION 黃黃黃 END TEST. SECTION 8.2: TAB ARGUMENT IS NEGATIVE. BEGIN TEST. 000000000111111111122222222223333333333444444444455555555556 123456789012345678901234567890123456789012345678901234567890 %TAB OUT OF RANGE IN LINE 340 X *** TEST PASSED IF AN X IS PRINTED IN COLUMN 1, AFTER A SYSTEM MESSAGE IDENTIFYING THE EXCEPTION 黃黃黃 END TEST. SECTION 8.3: ROUNDED TAB ARGUMENT EQUAL TO ONE. BEGIN TEST. 000000000111111111122222222223333333333444444444455555555556 123456789012345678901234567890123456789012345678901234567890 X *** TEST PASSED IF AN X IS PRINTED IN COLUMN 1 AND NO EXCEPTION REPORTED *** END TEST. SECTION 8.4: FRACTIONAL TAB ARGUMENT LESS THAN ONE AFTER BEGIN TEST. 000000000111111111122222222223333333333444444444455555555556 123456789012345678901234567890123456789012345678901234567890 % TAB OUT OF RANGE IN LINE 690 X *** TEST PASSED IF AN X IS PRINTED IN COLUMN 1, AFTER A SYSTEM MESSAGE IDENTIFYING THE EXCEPTION *** END PROGRAM 8 END TEST. 10 PRINT "PROGRAM FILE 9: PRINTING NR1 AND NR2 NUMERIC CONSTANTS." 20 PRINT " ANSI STANDARD 5.2, 5.4, 12.4" 30 PRINT 60 PRINT "SECTION 9.1: CONSTANTS IN NR1 FORM (INTEGERS)." 70 PRINT 80 PRINT "COLUMNS 1 AND 3 SHOW THE OUTPUT AS IT SHOULD BE." 100 PRINT "COLUMNS 2 AND 4 SHOW THE ACTUAL OUTPUT." 120 PRINT 130 PRINT " BEGIN TEST." 140 PRINT 150 PRINT "00000000011111111112222222222333333333344444444445"; 160 PRINT "5555555556666666666777" 170 PRINT "12345678901234567890123456789012345678901234567890"; 180 PRINT "1234567890123456789012" 190 PRINT "SHOULD BE","ACTUAL","SHOULD BE","ACTUAL" 200 PRINT " 0",+0," 0",-0 210 PRINT " 1",+1,"-1",-1 220 PRINT " 12", 12,"-12",-12 *** ** 230 PRINT "123",+123,"-123",-123 240 PRINT "1234", 1234,"-1234",-1234 250 PRINT " 12345",+12345,"-12345",-12345 260 PRINT " 123456", 123456,"-123456",-123456 270 PRINT " 999999", +999999,"-999999", -999999 280 PRINT 290 PRINT "*** TEST PASSED IF COLUMNS 1 & 2, AND 3 & 4 CONTAIN THE SAME" 300 PRINT " NUMERIC REPRESENTATION FOR EACH PAIR OF INTEGERS ***" 310 PRINT 320 PRINT " 330 PRINT END TEST." 340 PRINT "SECTION 9.2: NR1 CONSTANTS SEPARATED BY COMMAS TO PRODUCE" 350 PRINT " TABULAR OUTPUT." 360 PRINT 370 PRINT " 380 PRINT BEGIN TEST." 390 PRINT "O0000000011111111112222222222333333333344444444445"; 400 PRINT "5555555556666666666777" 410 PRINT "12345678901234567890123456789012345678901234567890"; 420 PRINT "1234567890123456789012" 430 PRINT 1,-12, 123 440 PRINT -1234, 12345,-123456 450 PRINT 123456,-1234, 123 460 PRINT 470 PRINT 480 PRINT " 490 PRINT 500 PRINT " 510 PRINT TEST PASSED IF THE FIRST THREE PRINT ZONES EACH CONTAIN" END TEST." 520 PRINT "SECTION 9.3: SPACE ALLOTTED FOR PRINTED INTEGER CONSTANTS." 530 PRINT 540 PRINT "PRINTED INTEGER CONSTANTS ARE PRECEDED BY A SPACE IF" 550 PRINT "POSITIVE, A MINUS IF NEGATIVE AND FOLLOWED BY A SPACE." 560 PRINT "THE SPACE FOR THE CONSTANT IS DELIMITED BY ASTERISKS." 570 PRINT 580 PRINT " 590 PRINT BEGIN TEST." 600 PRINT "00000000011111111112222222222333333333344444444445"; 610 PRINT "5555555556666666666777" 620 PRINT "12345678901234567890123456789012345678901234567890"; 630 PRINT "1234567890123456789012" 640 PRINT "SHOULD BE:", 1 *","*-23 毫ㄇ "* 456 *"1 650 PRINT " ACTUAL:" 11 #11 · 660 PRINT 1 "" ;-23; "*","*";456;"*" 670 PRINT "SHOULD BE:","* 7890 *","*-12345 *","* 678901 *" 680 PRINT " ACTUAL:" ","*";7890;"*","*";-12345;"*","*";+678901;"*" 710 PRINT 720 PRINT "*** TEST PASSED IF 'ACTUAL' LINES MATCH CORRESPONDING" 730 PRINT " 740 PRINT 750 PRINT " 'SHOULD BE' LINES **** END TEST." 760 PRINT 770 PRINT "SECTION 9.4: NR1 CONSTANTS SEPARATED BY SEMICOLONS." 780 PRINT 790 PRINT "PRINTED INTEGER CONSTANTS ARE PRECEDED BY A SPACE IF" 800 PRINT "POSITIVE OR A MINUS IF NEGATIVE AND ARE FOLLOWED BY A SPACE." 810 PRINT "THE SEMICOLON SEPARATOR PRODUCES A NULL STRING." 820 PRINT 830 PRINT " 840 PRINT BEGIN TEST." 850 PRINT "00000000011111111112222222222333333333344444444445": 870 PRINT "12345678901234567890123456789012345678901234567890"; 123-1234 12345 -123456" 890 PRINT " ACTUAL:";0;-0;1;-12; 123;-1234; 12345;-123456 900 PRINT 910 PRINT "*** TEST PASSED IF 'ACTUAL' LINE MATCHES CORRESPONDING" 920 PRINT " 'SHOULD BE' LINE ***"1 930 PRINT 940 PRINT 950 PRINT END TEST." 960 PRINT "SECTION 9.5: CONSTANTS IN NR2 FORM." 970 PRINT 980 PRINT "COLUMNS 1 AND 3 SHOW THE OUTPUT AS IT SHOULD BE." 995 PRINT "COLUMNS 2 AND 4 SHOW THE ACTUAL OUTPUT." 1001 PRINT 1002 PRINT "EXPECTED OUTPUT IS DISPLAYED WITH TRAILING ZEROS" 1003 PRINT "SUPPRESSED. IMPLEMENTATIONS MAY ADD TRAILING ZEROS UP TO" 1004 PRINT "THEIR SIGNIFICAND-WIDTH, D. THUS .12 MAY BE DISPLAYED AS" 1005 PRINT "'.1200' OR '.1200000' IF, FOR INSTANCE, D = 7." 1040 PRINT "00000000011111111112222222222333333333344444444445"; 1050 PRINT "5555555556666666666777" 1060 PRINT "12345678901234567890123456789012345678901234567890"; 1070 PRINT "1234567890123456789012" 1080 PRINT "SHOULD BE","ACTUAL","SHOULD BE","ACTUAL" 1100 PRINT " .1 ",.1,"-.1 ",-.1 1110 PRINT " .12 ",+.12,"-.12 ",-.12 1120 PRINT 11 .123",.123,"-.123",-. 123 1130 PRINT .1234",+.1234,"-.1234 ",-.1234 1140 PRINT " .12345",. 12345,"-.12345 ",-.12345 1240 PRINT "0",0.0,"0",-0.0 1250 PRINT " 1.23456 ", 1.23456,"-1.23456",-1.23456 1260 PRINT " 9.876 ",+9.87600,"-9.876 ",-9.87600 1270 PRINT " 12.3456", 12.3456,"-12.3456 ",-12.3456 1280 PRINT " 123.456 ",+123.456,"-123.456 ",-123.456 1290 PRINT " 1234.56 ", 1234.56,"-1234.56 ",-1234.56 1300 PRINT " 12345.6",+12345.6,"-12345.6 ",-12345.6 1310 PRINT" 23456.7",23456.7,"-23456.7",-23456.7 1320 PRINT" 34567.8 ",+34567.8,"-34567.8 ",-34567.8 1330 PRINT " 45678.9",45678.9,"-45678.9",-45678.9 1340 PRINT " 56789.1",+56789.1,"-56789.1 ",-56789.1 1350 PRINT " 67891.2 ",67891.2,"-67891.2 ",-67891.2 1360 PRINT " 78912.3 ",+78912.3,"-78912.3 ",-78912.3 1370 PRINT " 89123.4 ",89123.4,"-89123.4 ",-89123.4 1380 PRINT " 91234.5 ", +91234.5,"-91234.5 ",-91234.5 1390 PRINT " 99999.9",99999.9,"-99999.9",-99999.9 1400 PRINT 1410 PRINT "*** TEST PASSED IF COLUMNS 1 & 2, AND 3 & 4 CONTAIN THE " 1420 PRINT " SAME REPRESENTATION FOR EACH PAIR OF NUMBERS "1 1425 PRINT " 1440 PRINT "SECTION 9.6: USING NR2 INSTEAD OF NR3 FORMAT FOR" 1490 PRINT "NUMBERS THAT CAN BE REPRESENTED IN THE UNSCALED" 1500 PRINT "REPRESENTATION NO LESS ACCURATELY THAN AS IN" 1510 PRINT "SCALED FORMAT, SHALL BE OUTPUT USING THE UNSCALED FORMAT." 1520 PRINT 1540 PRINT "SHOULD BE","ACTUAL","SHOULD BE","ACTUAL" 1550 PRINT 1560 PRINT " .022222 ",+.022222, "-.022222 11 1600 PRINT " .000002 ",+.000002,"-.000002 ",-.000002 1610 PRINT 1620 PRINT "*** TEST PASSED IF COLUMNS 1 & 2, AND 3 & 4 CONTAIN THE " 1630 PRINT " SAME REPRESENTATION FOR EACH PAIR OF NUMBERS (ALLOWING FOR OPTIONAL TRAILING ZEROS) ***11 1635 PRINT " 1640 PRINT 1650 PRINT " 1660 PRINT END TEST." 1670 PRINT "SECTION 9.7: NR2 CONSTANTS SEPARATED BY COMMAS TO PRODUCE" 1720 PRINT "00000000011111111112222222222333333333344444444445"; 1730 PRINT "5555555556666666666777" 1740 PRINT "12345678901234567890123456789012345678901234567890"; 1750 PRINT "1234567890123456789012" 1760 PRINT .123456,-99999.9,91234.5 |