xref: /original-bsd/usr.bin/f77/tests/tests/fm002.f (revision c4347674)
1c     comment section
2c
3c     fm002
4c
5c         this routine checks that comment lines which have valid
6c     fortran statements do not affect the execution of the program
7c     in any way.
8c
9c      references
10c        american national standard programming language fortran,
11c              x3.9-1978
12c
13c                   section 3.2.1, comment line
14c
15c      **********************************************************
16c
17c         a compiler validation system for the fortran language
18c     based on specifications as defined in american national standard
19c     programming language fortran x3.9-1978, has been developed by the
20c     federal cobol compiler testing service.  the fortran compiler
21c     validation system (fcvs) consists of audit routines, their related
22c     data, and an executive system.  each audit routine is a fortran
23c     program, subprogram or function which includes tests of specific
24c     language elements and supporting procedures indicating the result
25c     of executing these tests.
26c
27c         this particular program/subprogram/function contains features
28c     found only in the subset as defined in x3.9-1978.
29c
30c         suggestions and comments should be forwarded to -
31c
32c                  department of the navy
33c                  federal cobol compiler testing service
34c                  washington, d.c.  20376
35c
36c      **********************************************************
37c
38c
39c
40c     initialization section
41c
42c     initialize constants
43c      **************
44c     i01 contains the logical unit number for the card reader.
45      i01 = 5
46c     i02 contains the logical unit number for the printer.
47      i02 = 6
48c     system environment section
49c
50cx010    this card is replaced by contents of fexec x-010 control card.
51c     the cx010 card is for overriding the program default i01 = 5
52c     (unit number for card reader).
53cx011    this card is replaced by contents of fexec x-011 control card.
54c     the cx011 card is for systems which require additional
55c     fortran statements for files associated with cx010 above.
56c
57cx020    this card is replaced by contents of fexec x-020 control card.
58c     the cx020 card is for overriding the program default i02 = 6
59c     (unit number for printer).
60cx021    this card is replaced by contents of fexec x-021 control card.
61c     the cx021 card is for systems which require additional
62c     fortran statements for files associated with cx020 above.
63c
64      ivpass=0
65      ivfail=0
66      ivdele=0
67      iczero=0
68c
69c     write page headers
70      write (i02,90000)
71      write (i02,90001)
72      write (i02,90002)
73      write (i02, 90002)
74      write (i02,90003)
75      write (i02,90002)
76      write (i02,90004)
77      write (i02,90002)
78      write (i02,90011)
79      write (i02,90002)
80      write (i02,90002)
81      write (i02,90005)
82      write (i02,90006)
83      write (i02,90002)
84c     test section
85c
86   41 continue
87      ivtnum=4
88c
89c      ****  test 004  ****
90c     test 004  -  blank comment line
91c
92      if (iczero) 30040,40,30040
93   40 continue
94      ivon01=4
95c
96      go to 40040
9730040 ivdele=ivdele+1
98      write (i02,80003) ivtnum
99      if (iczero) 40040, 51, 40040
10040040 if (ivon01 - 4) 20040, 10040, 20040
10110040 ivpass=ivpass+1
102      write (i02,80001) ivtnum
103      go to 51
10420040 ivfail=ivfail+1
105      ivcomp=ivon01
106      ivcorr=4
107      write (i02,80004) ivtnum,ivcomp,ivcorr
108   51 continue
109      ivtnum=5
110c
111c      ****  test 005  ****
112c     test 005  - go to in comment line
113c
114      if (iczero) 30050, 50, 30050
115   50 continue
116      ivon01 = 3
117c     go to 20050
118      ivon01=5
119      go to 40050
12030050 ivdele=ivdele+1
121      write (i02,80003) ivtnum
122      if (iczero) 40050, 61, 40050
12340050 if (ivon01 - 5) 20050,10050,20050
12410050 ivpass=ivpass+1
125      write (i02,80001) ivtnum
126      go to 61
12720050 ivfail=ivfail+1
128      ivcomp=ivon01
129      ivcorr=5
130      write (i02,80004) ivtnum,ivcomp,ivcorr
131   61 continue
132      ivtnum=6
133c
134c      ****  test 006  ****
135c     test 006 - integer assignment statement in comment line
136c
137      if (iczero) 30060,60,30060
138   60 continue
139      ivon01=6
140c     ivon01=1
141      go to 40060
14230060 ivdele=ivdele+1
143      write (i02,80003) ivtnum
144      if (iczero) 40060,71,40060
14540060 if (ivon01-6) 20060,10060,20060
14610060 ivpass=ivpass+1
147      write (i02,80001) ivtnum
148      go to 71
14920060 ivfail=ivfail+1
150      ivcomp=ivon01
151      ivcorr=6
152      write (i02,80004) ivtnum,ivcomp,ivcorr
153   71 continue
154      ivtnum=7
155c
156c      ****  test  007  ****
157c     test 007 - integer assignment statement in comment line
158c                integer expression to right of =
159c
160      if (iczero) 30070,70,30070
161   70 continue
162      ivon02=6
163      ivon01=7
164c     ivon01= 3*ivon02
165      go to 40070
16630070 ivdele=ivdele+1
167      write (i02,80003) ivtnum
168      if (iczero) 40070,81,40070
16940070 if (ivon01-7) 20070,10070,20070
17010070 ivpass=ivpass+1
171      write (i02,80001) ivtnum
172      go to 81
17320070 ivfail=ivfail+1
174      ivcomp=ivon01
175      ivcorr=7
176      write (i02,80004) ivtnum,ivcomp,ivcorr
177   81 continue
178      ivtnum=8
179c
180c      ****  test 008  ****
181c     test 008 - if statement in comment line
182c
183      if (iczero) 30080,80,30080
184   80 continue
185      ivon01=300
186c     if (ivon01) 20080,20080,20080
187      ivon01=8
188      go to 40080
18930080 ivdele=ivdele+1
190      write (i02,80003) ivtnum
191      if (iczero) 40080,91,40080
19240080 if (ivon01-8) 20080,10080,20080
19310080 ivpass=ivpass+1
194      write (i02,80001) ivtnum
195      go to 91
19620080 ivfail=ivfail+1
197      ivcomp=ivon01
198      ivcorr=8
199      write (i02,80004) ivtnum,ivcomp,ivcorr
200   91 continue
201      ivtnum=9
202c
203c      ****  test 009  ****
204c     test 009 - write statement in a comment line
205c
206      if (iczero) 30090,90,30090
207   90 continue
208      ivon01=200
209c  92 write (i02,80002)  ivtnum
210      ivon01=9
211      go to 40090
21230090 ivdele=ivdele+1
213      write (i02,80003) ivtnum
214      if (iczero) 40090,101,40090
21540090 if (ivon01-9) 20090,10090,20090
21610090 ivpass=ivpass+1
217      write (i02,80001) ivtnum
218      go to 101
21920090 ivfail=ivfail+1
220      ivcomp=ivon01
221      ivcorr=9
222      write (i02,80004) ivtnum,ivcomp,ivcorr
223  101 ivtnum=10
224c
225c      ****  test 010  ****
226c     test 010 - statement label in comment line
227c
228      if (iczero) 30100,100,30100
229  100 continue
230      go to 102
231c 102 write (i02,80002)
232c     go to 111
233  102 ivon01=10
234      go to 40100
23530100 ivdele=ivdele+1
236      write (i02,80003) ivtnum
237      if (iczero) 40100,111,40100
23840100 if (ivon01-10) 20100,10100,20100
23910100 ivpass=ivpass+1
240      write (i02,80001) ivtnum
241      go to 111
24220100 ivfail=ivfail+1
243      ivcomp=ivon01
244      ivcorr=10
245      write (i02,80004) ivtnum,ivcomp,ivcorr
246  111 continue
247      ivtnum=11
248c
249c      ****  test 011  ****
250c     test 011 - continue in comment line
251c                followed by integer assignment statement in comment
252c
253      if (iczero) 30110,110,30110
254  110 ivon01=11
255c     continue
256c     ivon01=7000
257      go to 40110
25830110 ivdele=ivdele+1
259      write (i02,80003) ivtnum
260      if (iczero) 40110,121,40110
26140110 if (ivon01 -11) 20110,10110,20110
26210110 ivpass=ivpass+1
263      write (i02,80001) ivtnum
264      go to 121
26520110 ivfail=ivfail+1
266      ivcomp=ivon01
267      ivcorr=11
268      write (i02,80004) ivtnum,ivcomp,ivcorr
269  121 continue
270      ivtnum=12
271c
272c      ****  test 012  ****
273c     test 012 - integer assignment statement in comment line
274c
275      if (iczero) 30120,120,30120
276  120 continue
277      ivon01=12
278c     ivon01=ivon01+1
279      go to 40120
28030120 ivdele=ivdele+1
281      write (i02,80003) ivtnum
282      if (iczero) 40120,99999,40120
28340120 if (ivon01 - 12) 20120,10120,20120
28410120 ivpass=ivpass+1
285      write (i02,80001) ivtnum
286      go to 99999
28720120 ivfail=ivfail+1
288      ivcomp=ivon01
289      ivcorr=12
290      write (i02,80004) ivtnum,ivcomp,ivcorr
291c
292c     write page footings and run summaries
29399999 continue
294      write (i02,90002)
295      write (i02,90006)
296      write (i02,90002)
297      write (i02,90002)
298      write (i02,90007)
299      write (i02,90002)
300      write (i02,90008)  ivfail
301      write (i02,90009) ivpass
302      write (i02,90010) ivdele
303c
304c
305c     terminate routine execution
306      stop
307c
308c     format statements for page headers
30990000 format (1h1)
31090002 format (1h )
31190001 format (1h ,10x,34hfortran compiler validation system)
31290003 format (1h ,21x,11hversion 1.0)
31390004 format (1h ,10x,38hfor official use only - copyright 1978)
31490005 format (1h ,5x,4htest,5x,9hpass/fail, 5x,8hcomputed,8x,7hcorrect)
31590006 format (1h ,5x,46h----------------------------------------------)
31690011 format (1h ,18x,17hsubset level test)
317c
318c     format statements for run summaries
31990008 format (1h ,15x,i5,19h errors encountered)
32090009 format (1h ,15x,i5,13h tests passed)
32190010 format (1h ,15x,i5,14h tests deleted)
322c
323c     format statements for test results
32480001 format (1h ,4x,i5,7x,4hpass)
32580002 format (1h ,4x,i5,7x,4hfail)
32680003 format (1h ,4x,i5,7x,7hdeleted)
32780004 format (1h ,4x,i5,7x,4hfail,10x,i6,9x,i6)
32880005 format (1h ,4x,i5,7x,4hfail,4x,e12.5,3x,e12.5)
329c
33090007 format (1h ,20x,20hend of program fm002)
331c     comment line before end statement
332      end
333