TITLE 'SNOSTORM TEST PROGRAM' -- this comment should be at the left margin -- this comment should be indented &STLIMIT = 100000 A = ARRAY('10,10') OUTPUT("SERCOM","SERCOM") INITIAL X -- comment 1/3 + = -- comment 2/3 + 0 - 0 -- comment 3/3 Y "--" '--' -- there should be two strings in this pattern match AND = ARRAY(1) -- to catch logical expression errors OR = ARRAY(1) -- ditto ENDINITIAL *** IF TEST *** SERCOM = ' IF TESTS' IFT IF TRUE(), X = 101 C(X,101) IF TRUE() AND TRUE(), X = 102 C(X,102) IF FALSE() OR TRUE(), X = 103 C(X,103) IF TRUE() OR FALSE(), X = 104 C(X,104) IF NOT FALSE(), X = 105 C(X,105) IF FALSE() OR NOT FALSE(), X = 106 C(X,106) IF (FALSE() OR TRUE()) + AND NOT (FALSE() OR FALSE()), X = 107 C(X,107) X = -1 IF TRUE() X = 108 ENDIF C(X,108) X = 109 IF FALSE() X = -1 ENDIF C(X,109) *** IF ELSE TEST *** IF TRUE() X = 110 ELSE X = -1 ENDIF C(X,110) IF FALSE() X = -1 ELSE X = 111 ENDIF C(X,111) *** NESTED IFS *** IF TRUE() IF FALSE() X = -1 ELSE IF FALSE() X = -2 ELSE X = 112 ENDIF ENDIF ELSE X = -3 ENDIF C(X,112) X = -1 IF TRUE() IF TRUE() IF TRUE() IF TRUE() IF TRUE() IF TRUE() IF TRUE() IF TRUE() X = 113 ENDIF ENDIF ENDIF ENDIF ENDIF ENDIF ENDIF ENDIF C(X,113) *** IF ELSEIF *** IF FALSE() X = -1 ELSEIF FALSE() X = -2 ELSEIF TRUE() X = 114 ELSEIF TRUE() X = -3 ENDIF C(X,114) IF TRUE() X = 115 ELSEIF TRUE() X = -1 ENDIF C(X,115) IF TRUE() X = 116 ELSEIF FALSE() X = -1 ENDIF C(X,116) X = 117 IF FALSE() X = -1 ELSEIF FALSE() X = -2 ELSEIF FALSE() X = -3 ENDIF C(X,117) *** IF ELSEIF ELSE TEST *** IF TRUE() X = 118 ELSEIF FALSE() X = -1 ELSE X = -2 ENDIF C(X,118) IF TRUE() X = 119 ELSEIF TRUE() X = -1 ELSE X = -2 ENDIF C(X,119) IF FALSE() X = -1 ELSEIF TRUE() X = 120 ELSE X = -2 ENDIF C(X,120) IF FALSE() X = -1 ELSEIF FALSE() X = -2 ELSE X = 121 ENDIF C(X,121) IF NOT A<1,1> ',', X = 122 C(X,122) IF (FALSE() OR (FALSE() OR FALSE()) ) -- trailing blanks caused confusion X = -1 ELSE X = 123 ENDIF C(X,123) SUBTITLE '*** CASE STATEMENT TESTING ***' SERCOM = ' CASE TESTS' S = 'ABC' DO CASE (S) CASE ('ABC') X = 201 CASE ('QQSV') X = -1 ELSECASE X = -2 ENDCASE C(X,201) S = 3 DO CASE (S) CASE ('3') X = -1 CASE ('C') X = -2 CASE 3,"THIRD",'THREE' X = 202 ELSECASE X = -3 ENDCASE C(X,202) S = 'C' DO CASE S CASE ('A','D') X = -1 CASE ('B','E') X = -2 CASE 'F','C' X = 203 CASE ('G') X = -3 ELSECASE X = -4 ENDCASE C(X,203) SUBTITLE '*** OLD LOOP TESTING *** ' SERCOM = ' OLD LOOP TESTS' X = 301 DO WHILE LT(X,301 + 4) X = X + 1 ENDWHILE C(X - 4,301) X = 302 DO EXITDO IDENT(X,302) X = 0 ENDDO C(X,302) X = 303 DO UNTIL LT(X,303 + 4) X = X + 1 ENDUNTIL C(X - 1,303) SUBTITLE '*** NEW LOOP TESTING *** ' SERCOM = ' NEW LOOP TESTS' X = 401 :(LOOP1) LOOP1 LOOP WHILE LT(X,401 + 4) X = X + 1 ENDLOOP C(X - 4,401) X = 402 LOOP IF EQ(X,402) ,EXITLOOP X = 0 ENDLOOP C(X,402) LOOP FOR X = 401 TO 403 NOTHING ENDLOOP C(X - 1,403) LOOP FOR X=410 TO 405 BY -1 NOTHING ENDLOOP C(X,404) LOOP FOR X = 400 IF EQ(X,405), EXITLOOP ENDLOOP C(X,405) LOOP FOR X = 400 BY 1 UNTIL EQ(X,406) ENDLOOP C(X,406) LOOP WHILE GT(X,0) AND GT(X,-1) UNTIL GT(X,406) FOR X = 400 ENDLOOP C(X,407) X = 408 LOOP FOR X=X BY X = X + 3 UNTIL GT(X,425) ENDLOOP C(X - 18,408) SUBTITLE '*** INITIAL TESTING /////////////////////////////////***' SERCOM = ' INITIAL TEST' C(INIT,501) INITIAL INIT = 501 ENDINITIAL SUBTITLE '*** INTERNAL PROCEDURE TESTING //////////////////////***' SERCOM = ' PROCEDURE TEST' X = 601 PROC_A() C(X - 1,601) PROC_A PROC () X = X + 1 ENDPROC X = 602 PROC_B() C(X,602) PROC_B PROC () X *** MAKE SURE BLANKS ARE OK IN PROTOTYPE *** X = X + 1 ENDPROC X = 603 X = X + PROC_C(3) C(X - 7,603) PROC_C PROC (A)I *** MAKE SURE THAT LOCAL VARIABLES THAT ARE GENERATED *** ARE ADDED TO THE LIST OF LOCAL VARIABLES OF THE *** ENCLOSING PROCEDURE. OTHERWISE, RECURSIVE CALLS *** COULD SCREWUP. LOOP FOR I = 1 TO A PROC_C = PROC_C + 1 + PROC_C(I - 1) ENDLOOP ENDPROC TRUE PROC ENDPROC FALSE PROC ( ) :(FRETURN) ENDPROC SPACE 2 *** THIS SHOULD BE SPACED 2 LINES DOWN *** EJECT 60 *** THIS SHOULD BE AT THE TOP OF A NEW PAGE *** EJECT 20,3 *** THIS SHOULD BE 3 LINES DOWN SPACE 20,3 *** THIS SHOULD ALSO BE 3 LINES DOWN. SPACE 55,3 *** THIS SHOULD BE AT THE TOP OF A PAGE C PROC (ACTUAL,CORECT) IF NE(ACTUAL,CORECT) SERCOM = '*** ERROR IN TEST ' CORECT ', ERROR ' ACTUAL ELSE SERCOM = '*** TEST ' CORECT ' IS OK.' ENDIF ENDPROC SERCOM = ' SNOSTORM TESTING COMPLETED.' END