xref: /original-bsd/usr.bin/f77/tests/tests/fm004.f (revision a425a1c9)
1c     comment section
2c
3c     fm004
4c
5c         this routine contains basic arithmetic if statement tests.
6c     the statement format is
7c                if  (e)  k1, k2, k3
8c     where e is a simple integer expression of form
9c                variable - constant
10c                variable + constant
11c     and k1, k2 and k3 are statement labels.  only the statements in
12c     the basic assumptions are included in these tests.
13c         execution of an if statement causes evaluation of the
14c     expression e following which the statement label k1, k2 or k3
15c     is executed next as the value of e is less than zero, zero, or
16c     greater than zero, respectively.
17c
18c         the basic unconditional go to statement is tested in this
19c     routine. the statement is of the form
20c               go to k
21c     where k is a statement label.
22c         execution of an unconditional go to statement causes the
23c     statement identified by statement label k to be executed next.
24c
25c      references
26c        american national standard programming language fortran,
27c              x3.9-1978
28c
29c        section 3.6, normal execution sequence and transfer of control
30c        section 11.1, go to statement
31c        section 11.4, arithmetic if statement
32c
33c      **********************************************************
34c
35c         a compiler validation system for the fortran language
36c     based on specifications as defined in american national standard
37c     programming language fortran x3.9-1978, has been developed by the
38c     federal cobol compiler testing service.  the fortran compiler
39c     validation system (fcvs) consists of audit routines, their related
40c     data, and an executive system.  each audit routine is a fortran
41c     program, subprogram or function which includes tests of specific
42c     language elements and supporting procedures indicating the result
43c     of executing these tests.
44c
45c         this particular program/subprogram/function contains features
46c     found only in the subset as defined in x3.9-1978.
47c
48c         suggestions and comments should be forwarded to -
49c
50c                  department of the navy
51c                  federal cobol compiler testing service
52c                  washington, d.c.  20376
53c
54c      **********************************************************
55c
56c
57c
58c     initialization section
59c
60c     initialize constants
61c      **************
62c     i01 contains the logical unit number for the card reader.
63      i01 = 5
64c     i02 contains the logical unit number for the printer.
65      i02 = 6
66c     system environment section
67c
68cx010    this card is replaced by contents of fexec x-010 control card.
69c     the cx010 card is for overriding the program default i01 = 5
70c     (unit number for card reader).
71cx011    this card is replaced by contents of fexec x-011 control card.
72c     the cx011 card is for systems which require additional
73c     fortran statements for files associated with cx010 above.
74c
75cx020    this card is replaced by contents of fexec x-020 control card.
76c     the cx020 card is for overriding the program default i02 = 6
77c     (unit number for printer).
78cx021    this card is replaced by contents of fexec x-021 control card.
79c     the cx021 card is for systems which require additional
80c     fortran statements for files associated with cx020 above.
81c
82      ivpass=0
83      ivfail=0
84      ivdele=0
85      iczero=0
86c
87c     write page headers
88      write (i02,90000)
89      write (i02,90001)
90      write (i02,90002)
91      write (i02, 90002)
92      write (i02,90003)
93      write (i02,90002)
94      write (i02,90004)
95      write (i02,90002)
96      write (i02,90011)
97      write (i02,90002)
98      write (i02,90002)
99      write (i02,90005)
100      write (i02,90006)
101      write (i02,90002)
102c          test section
103c
104c         tests 21, 22, and 23 contain the same if statement but the
105c     expected branch is to the first, second or third statement label
106c     as the integer expression is less than zero, equal to zero, or
107c     greater than zero respectively.
108c
109  211 continue
110      ivtnum =  21
111c
112c      ****  test 021  ****
113c     test 21 - arithmetic if statement test
114c         less than zero branch expected.
115c
116      if (iczero) 30210,  210, 30210
117  210 continue
118      ivon01=2
119      if (ivon01 - 3) 212,213,214
120  212 ivon02 = -1
121      go to 40210
122  213 ivon02 = 0
123      go to 40210
124  214 ivon02 = 1
125      go to 40210
12630210 ivdele = ivdele + 1
127      write (i02,80003) ivtnum
128      if (iczero) 40210,  221, 40210
12940210 if (ivon02) 10210, 20210, 20210
13010210 ivpass = ivpass + 1
131      write (i02,80001) ivtnum
132      go to  221
13320210 ivfail = ivfail + 1
134      ivcomp=ivon02
135      ivcorr=-1
136      write (i02,80004) ivtnum, ivcomp ,ivcorr
137  221 continue
138      ivtnum =  22
139c
140c      ****  test 022  ****
141c     test 22 - arithmetic if statement test
142c         equal to zero branch expected
143c
144      if (iczero) 30220,  220, 30220
145  220 continue
146      ivon01 = 3
147      if (ivon01 - 3) 222,223,224
148  222 ivon02 = -1
149      go to 40220
150  223 ivon02 = 0
151      go to 40220
152  224 ivon02 = 1
153      go to 40220
15430220 ivdele = ivdele + 1
155      write (i02,80003) ivtnum
156      if (iczero) 40220,  231, 40220
15740220 if (ivon02) 20220, 10220, 20220
15810220 ivpass = ivpass + 1
159      write (i02,80001) ivtnum
160      go to  231
16120220 ivfail = ivfail + 1
162      ivcomp=ivon02
163      ivcorr= 0
164      write (i02,80004) ivtnum, ivcomp ,ivcorr
165  231 continue
166      ivtnum =  23
167c
168c      ****  test 023  ****
169c     test 23 - arithmetic if statement test
170c         greater than zero branch expected
171c
172      if (iczero) 30230,  230, 30230
173  230 continue
174      ivon01 = 4
175      if (ivon01 - 3) 232,233,234
176  232 ivon02 = -1
177      go to 40230
178  233 ivon02 = 0
179      go to 40230
180  234 ivon02 = 1
181      go to 40230
18230230 ivdele = ivdele + 1
183      write (i02,80003) ivtnum
184      if (iczero) 40230,  241, 40230
18540230 if (ivon02) 20230, 20230, 10230
18610230 ivpass = ivpass + 1
187      write (i02,80001) ivtnum
188      go to  241
18920230 ivfail = ivfail + 1
190      ivcomp=ivon02
191      ivcorr = 1
192      write (i02,80004) ivtnum, ivcomp ,ivcorr
193c
194c         tests 24 through 29 contain an if statement with two of the
195c     three branch statement labels equal.
196c
197  241 continue
198      ivtnum =  24
199c
200c      ****  test 024  ****
201c     test 24 - arithmetic if statement test
202c         less than zero branch expected
203c
204      if (iczero) 30240,  240, 30240
205  240 continue
206      ivon01=2
207      if (ivon01 - 3) 242,243,242
208  242 ivon02=-1
209      go to 40240
210  243 ivon02=0
211      go to 40240
21230240 ivdele = ivdele + 1
213      write (i02,80003) ivtnum
214      if (iczero) 40240,  251, 40240
21540240 if (ivon02) 10240, 20240, 20240
21610240 ivpass = ivpass + 1
217      write (i02,80001) ivtnum
218      go to  251
21920240 ivfail = ivfail + 1
220      ivcomp=ivon02
221      ivcorr=-1
222      write (i02,80004) ivtnum, ivcomp ,ivcorr
223  251 continue
224      ivtnum =  25
225c
226c      ****  test 025  ****
227c     test 25 - arithmetic if statement test
228c         equal to zero branch expected
229c
230      if (iczero) 30250,  250, 30250
231  250 continue
232      ivon01=3
233      if (ivon01 - 3) 252,253,252
234  252 ivon02= -1
235      go to 40250
236  253 ivon02 = 0
237      go to 40250
23830250 ivdele = ivdele + 1
239      write (i02,80003) ivtnum
240      if (iczero) 40250,  261, 40250
24140250 if (ivon02) 20250,10250,20250
24210250 ivpass = ivpass + 1
243      write (i02,80001) ivtnum
244      go to  261
24520250 ivfail = ivfail + 1
246      ivcomp=ivon02
247      ivcorr=0
248      write (i02,80004) ivtnum, ivcomp ,ivcorr
249  261 continue
250      ivtnum =  26
251c
252c      ****  test 026  ****
253c     test 26 - arithmetic if statement test
254c         greater than zero branch expected
255c
256      if (iczero) 30260,  260, 30260
257  260 continue
258      ivon01=4
259      if (ivon01-3) 262, 263, 262
260  262 ivon02= 1
261      go to 40260
262  263 ivon02 = 0
263      go to 40260
26430260 ivdele = ivdele + 1
265      write (i02,80003) ivtnum
266      if (iczero) 40260,  271, 40260
26740260 if (ivon02) 20260, 20260, 10260
26810260 ivpass = ivpass + 1
269      write (i02,80001) ivtnum
270      go to  271
27120260 ivfail = ivfail + 1
272      ivcomp=ivon02
273      ivcorr = 1
274      write (i02,80004) ivtnum, ivcomp ,ivcorr
275  271 continue
276      ivtnum =  27
277c
278c      ****  test 027  ****
279c     test 27 - arithmetic if statement test
280c         less than zero branch expected
281c
282      if (iczero) 30270,  270, 30270
283  270 continue
284      ivon01 = -4
285      if (ivon01 + 3) 272, 272, 273
286  272 ivon02= -1
287      go to 40270
288  273 ivon02 = 1
289      go to 40270
29030270 ivdele = ivdele + 1
291      write (i02,80003) ivtnum
292      if (iczero) 40270,  281, 40270
29340270 if (ivon02) 10270, 20270, 20270
29410270 ivpass = ivpass + 1
295      write (i02,80001) ivtnum
296      go to  281
29720270 ivfail = ivfail + 1
298      ivcomp=ivon02
299      ivcorr= -1
300      write (i02,80004) ivtnum, ivcomp ,ivcorr
301  281 continue
302      ivtnum =  28
303c
304c      ****  test 028  ****
305c     test 28 - arithmetic if statement test
306c         equal to zero branch expected
307c
308      if (iczero) 30280,  280, 30280
309  280 continue
310      ivon01 = -3
311      if (ivon01 + 3) 282, 282, 283
312  282 ivon02 = 0
313      go to 40280
314  283 ivon02 = 1
315      go to 40280
31630280 ivdele = ivdele + 1
317      write (i02,80003) ivtnum
318      if (iczero) 40280,  291, 40280
31940280 if (ivon02) 20280, 10280, 20280
32010280 ivpass = ivpass + 1
321      write (i02,80001) ivtnum
322      go to  291
32320280 ivfail = ivfail + 1
324      ivcomp=ivon02
325      ivcorr= 0
326      write (i02,80004) ivtnum, ivcomp ,ivcorr
327  291 continue
328      ivtnum =  29
329c
330c      ****  test 029  ****
331c     test 29 - arithmetic if statement test
332c         greater than zero branch expected
333c
334      if (iczero) 30290,  290, 30290
335  290 continue
336      ivon01 = -2
337      if (ivon01 + 3) 292,292,293
338  292 ivon02 = -1
339      go to 40290
340  293 ivon02 = 1
341      go to 40290
34230290 ivdele = ivdele + 1
343      write (i02,80003) ivtnum
344      if (iczero) 40290,  301, 40290
34540290 if (ivon02) 20290, 20290, 10290
34610290 ivpass = ivpass + 1
347      write (i02,80001) ivtnum
348      go to  301
34920290 ivfail = ivfail + 1
350      ivcomp= ivon02
351      ivcorr = 1
352      write (i02,80004) ivtnum, ivcomp ,ivcorr
353c
354c         tests 30 and 31 contain the basic go to statement tests.
355c
356  301 continue
357      ivtnum =  30
358c
359c      ****  test 030  ****
360c     test 30 - unconditional go to statement test
361c
362      if (iczero) 30300,  300, 30300
363  300 continue
364      ivon01 = 1
365      go to 302
366  303 ivon01 = 2
367      go to 304
368  302 ivon01 = 3
369      go to 303
370  304 go to 40300
37130300 ivdele = ivdele + 1
372      write (i02,80003) ivtnum
373      if (iczero) 40300,  311, 40300
37440300 if (ivon01 - 2) 20300,10300,20300
37510300 ivpass = ivpass + 1
376      write (i02,80001) ivtnum
377      go to  311
37820300 ivfail = ivfail + 1
379      ivcomp = ivon01
380      ivcorr = 2
381      write (i02,80004) ivtnum, ivcomp ,ivcorr
382  311 continue
383      ivtnum =  31
384c
385c      ****  test 031  ****
386c     test 31 - unconditional go to statement test
387c
388      if (iczero) 30310,  310, 30310
389  310 continue
390      ivon01 = 1
391      go to 316
392  313 go to 317
393  314 ivon01 = 3
394      go to 40310
395  315 go to 313
396  316 go to 315
397  317 go to 314
39830310 ivdele = ivdele + 1
399      write (i02,80003) ivtnum
400      if (iczero) 40310,  321, 40310
40140310 if (ivon01 - 3) 20310, 10310, 20310
40210310 ivpass = ivpass + 1
403      write (i02,80001) ivtnum
404      go to  321
40520310 ivfail = ivfail + 1
406      ivcomp=ivon01
407      ivcorr = 3
408      write (i02,80004) ivtnum, ivcomp ,ivcorr
409  321 continue
410      ivtnum =  32
411c
412c      ****  test 032  ****
413c         test 32 - arithmetic if statement and unconditional go to
414c                   statement
415c     this test combines the basic arithmetic if statements and
416c     unconditional go to statements in one test.
417c
418      if (iczero) 30320,  320, 30320
419  320 continue
420      ivon01 = 1
421      go to 322
422  324 ivon01 = 2
423      if (ivon01 -1) 323, 323, 325
424  327 ivon01 = 5
425      go to 328
426  326 ivon01 = -4
427      if (ivon01 + 4) 323, 327, 323
428  322 if (ivon01 - 1) 323, 324, 323
429  323 go to 20320
430  325 ivon01 = 3
431      if (ivon01 -4) 326,323,323
432  328 go to 40320
43330320 ivdele = ivdele + 1
434      write (i02,80003) ivtnum
435      if (iczero) 40320,  331, 40320
43640320 if (ivon01 - 5) 20320, 10320, 20320
43710320 ivpass = ivpass + 1
438      write (i02,80001) ivtnum
439      go to  331
44020320 ivfail = ivfail + 1
441      ivcomp=ivon01
442      ivcorr=5
443      write (i02,80004) ivtnum, ivcomp ,ivcorr
444  331 continue
445c
446c     write page footings and run summaries
44799999 continue
448      write (i02,90002)
449      write (i02,90006)
450      write (i02,90002)
451      write (i02,90002)
452      write (i02,90007)
453      write (i02,90002)
454      write (i02,90008)  ivfail
455      write (i02,90009) ivpass
456      write (i02,90010) ivdele
457c
458c
459c     terminate routine execution
460      stop
461c
462c     format statements for page headers
46390000 format (1h1)
46490002 format (1h )
46590001 format (1h ,10x,34hfortran compiler validation system)
46690003 format (1h ,21x,11hversion 1.0)
46790004 format (1h ,10x,38hfor official use only - copyright 1978)
46890005 format (1h ,5x,4htest,5x,9hpass/fail, 5x,8hcomputed,8x,7hcorrect)
46990006 format (1h ,5x,46h----------------------------------------------)
47090011 format (1h ,18x,17hsubset level test)
471c
472c     format statements for run summaries
47390008 format (1h ,15x,i5,19h errors encountered)
47490009 format (1h ,15x,i5,13h tests passed)
47590010 format (1h ,15x,i5,14h tests deleted)
476c
477c     format statements for test results
47880001 format (1h ,4x,i5,7x,4hpass)
47980002 format (1h ,4x,i5,7x,4hfail)
48080003 format (1h ,4x,i5,7x,7hdeleted)
48180004 format (1h ,4x,i5,7x,4hfail,10x,i6,9x,i6)
48280005 format (1h ,4x,i5,7x,4hfail,4x,e12.5,3x,e12.5)
483c
48490007 format (1h ,20x,20hend of program fm004)
485      end
486