xref: /original-bsd/usr.bin/f77/tests/tests/fm045.f (revision e59fb703)
1c     comment section
2c
3c     fm045
4c
5c         this routine tests arithmetic assignments using integer
6c     variables connected by a series of arithmetic operators.
7c     different combinations of parenthetical notation are exercized.
8c
9c
10c      references
11c        american national standard programming language fortran,
12c              x3.9-1978
13c
14c        section 4.3, integer type
15c        section 4.3.1, integer constant
16c        section 6.1, arithmetic expressions
17c        section 6.6, evaluation of expressions
18c        section 10.1, arithmetic assignment statement
19c
20c
21c
22c      **********************************************************
23c
24c         a compiler validation system for the fortran language
25c     based on specifications as defined in american national standard
26c     programming language fortran x3.9-1978, has been developed by the
27c     federal cobol compiler testing service.  the fortran compiler
28c     validation system (fcvs) consists of audit routines, their related
29c     data, and an executive system.  each audit routine is a fortran
30c     program, subprogram or function which includes tests of specific
31c     language elements and supporting procedures indicating the result
32c     of executing these tests.
33c
34c         this particular program/subprogram/function contains features
35c     found only in the subset as defined in x3.9-1978.
36c
37c         suggestions and comments should be forwarded to -
38c
39c                  department of the navy
40c                  federal cobol compiler testing service
41c                  washington, d.c.  20376
42c
43c      **********************************************************
44c
45c
46c
47c     initialization section
48c
49c     initialize constants
50c      **************
51c     i01 contains the logical unit number for the card reader.
52      i01 = 5
53c     i02 contains the logical unit number for the printer.
54      i02 = 6
55c     system environment section
56c
57cx010    this card is replaced by contents of fexec x-010 control card.
58c     the cx010 card is for overriding the program default i01 = 5
59c     (unit number for card reader).
60cx011    this card is replaced by contents of fexec x-011 control card.
61c     the cx011 card is for systems which require additional
62c     fortran statements for files associated with cx010 above.
63c
64cx020    this card is replaced by contents of fexec x-020 control card.
65c     the cx020 card is for overriding the program default i02 = 6
66c     (unit number for printer).
67cx021    this card is replaced by contents of fexec x-021 control card.
68c     the cx021 card is for systems which require additional
69c     fortran statements for files associated with cx020 above.
70c
71      ivpass=0
72      ivfail=0
73      ivdele=0
74      iczero=0
75c
76c     write page headers
77      write (i02,90000)
78      write (i02,90001)
79      write (i02,90002)
80      write (i02, 90002)
81      write (i02,90003)
82      write (i02,90002)
83      write (i02,90004)
84      write (i02,90002)
85      write (i02,90011)
86      write (i02,90002)
87      write (i02,90002)
88      write (i02,90005)
89      write (i02,90006)
90      write (i02,90002)
91c
92c
93c     test section
94c
95c         arithmetic assignment statement
96c
97c
98c     tests 747 through 755 use the same string of variables and
99c     operators, but use different combinations of parenthetical
100c     notation  to alter priorities in order of evaluation.
101c
102c     tests 756 through 759 check the capability to enclose the entire
103c     right hand side of an assignment statement in parentheses or sets
104c     of nested parentheses.
105c
106c
107c
108c
109c
110c
111c
112      ivtnum = 747
113c
114c      ****  test 747  ****
115c
116      if (iczero) 37470, 7470, 37470
117 7470 continue
118      ivon01 = 15
119      ivon02 =  9
120      ivon03 =  4
121      ivon04 = 18
122      ivon05 =  6
123      ivon06 =  2
124      ivcomp = ivon01 + ivon02 - ivon03 * ivon04 / ivon05 ** ivon06
125      go to 47470
12637470 ivdele = ivdele + 1
127      write (i02,80003) ivtnum
128      if (iczero) 47470, 7481, 47470
12947470 if (ivcomp - 22) 27470,17470,27470
13017470 ivpass = ivpass + 1
131      write (i02,80001) ivtnum
132      go to 7481
13327470 ivfail = ivfail + 1
134      ivcorr = 22
135      write (i02,80004) ivtnum, ivcomp, ivcorr
136 7481 continue
137      ivtnum = 748
138c
139c      ****  test 748  ****
140c
141      if (iczero) 37480, 7480, 37480
142 7480 continue
143      ivon01 = 15
144      ivon02 =  9
145      ivon03 =  4
146      ivon04 = 18
147      ivon05 =  6
148      ivon06 =  2
149      ivcomp = ((((ivon01 + ivon02) - ivon03) * ivon04) / ivon05)
150     *         ** ivon06
151      go to 47480
15237480 ivdele = ivdele + 1
153      write (i02,80003) ivtnum
154      if (iczero) 47480, 7491, 47480
15547480 if (ivcomp - 3600) 27480,17480,27480
15617480 ivpass = ivpass + 1
157      write (i02,80001) ivtnum
158      go to 7491
15927480 ivfail = ivfail + 1
160      ivcorr = 3600
161      write (i02,80004) ivtnum, ivcomp, ivcorr
162 7491 continue
163      ivtnum = 749
164c
165c      ****  test 749  ****
166c
167      if (iczero) 37490, 7490, 37490
168 7490 continue
169      ivon01 = 15
170      ivon02 =  9
171      ivon03 =  4
172      ivon04 = 36
173      ivon05 =  6
174      ivon06 =  2
175      ivcomp = (ivon01 + ivon02 - ivon03) * (ivon04 / ivon05 ** ivon06)
176      go to 47490
17737490 ivdele = ivdele + 1
178      write (i02,80003) ivtnum
179      if (iczero) 47490, 7501, 47490
18047490 if (ivcomp - 20) 27490,17490,27490
18117490 ivpass = ivpass + 1
182      write (i02,80001) ivtnum
183      go to 7501
18427490 ivfail = ivfail + 1
185      ivcorr = 20
186      write (i02,80004) ivtnum, ivcomp, ivcorr
187 7501 continue
188      ivtnum = 750
189c
190c      ****  test 750  ****
191c
192      if (iczero) 37500, 7500, 37500
193 7500 continue
194      ivon01 = 15
195      ivon02 =  9
196      ivon03 =  4
197      ivon04 = 36
198      ivon05 =  6
199      ivon06 =  2
200      ivcomp = (ivon01 + ivon02) - (ivon03 * ivon04) / (ivon05 **
201     *         ivon06)
202      go to 47500
20337500 ivdele = ivdele + 1
204      write (i02,80003) ivtnum
205      if (iczero) 47500, 7511, 47500
20647500 if (ivcomp - 20) 27500,17500,27500
20717500 ivpass = ivpass + 1
208      write (i02,80001) ivtnum
209      go to 7511
21027500 ivfail = ivfail + 1
211      ivcorr = 20
212      write (i02,80004) ivtnum, ivcomp, ivcorr
213 7511 continue
214      ivtnum = 751
215c
216c      ****  test 751  ****
217c
218      if (iczero) 37510, 7510, 37510
219 7510 continue
220      ivon01 = 15
221      ivon02 =  9
222      ivon03 =  4
223      ivon04 = 36
224      ivon05 =  6
225      ivon06 =  2
226      ivcomp = ((ivon01 + ivon02) - (ivon03 * ivon04)) / (ivon05 **
227     *         ivon06)
228      go to 47510
22937510 ivdele = ivdele + 1
230      write (i02,80003) ivtnum
231      if (iczero)  47510, 7521, 47510
23247510 if (ivcomp + 3)  27510,17510,27510
23317510 ivpass = ivpass + 1
234      write (i02,80001) ivtnum
235      go to 7521
23627510 ivfail = ivfail + 1
237      ivcorr = -3
238c     actual answer is  -3.333333...     truncation is necessary
239      write (i02,80004) ivtnum, ivcomp, ivcorr
240 7521 continue
241      ivtnum = 752
242c
243c      ****  test 752  ****
244c
245      if (iczero) 37520, 7520, 37520
246 7520 continue
247      ivon01 = 15
248      ivon02 =  9
249      ivon03 =  4
250      ivon04 = 36
251      ivon05 =  6
252      ivon06 =  2
253      ivcomp = (ivon01 + ivon02) - (ivon03 * ivon04 / ivon05) ** ivon06
254      go to 47520
25537520 ivdele = ivdele + 1
256      write (i02,80003) ivtnum
257      if (iczero) 47520, 7531, 47520
25847520 if (ivcomp + 552) 27520,17520,27520
25917520 ivpass = ivpass + 1
260      write (i02,80001) ivtnum
261      go to 7531
26227520 ivfail = ivfail + 1
263      ivcorr = -552
264      write (i02,80004) ivtnum, ivcomp, ivcorr
265 7531 continue
266      ivtnum = 753
267c
268c      ****  test 753  ****
269c
270      if (iczero) 37530, 7530, 37530
271 7530 continue
272      ivon01 = 15
273      ivon02 =  9
274      ivon03 =  4
275      ivon04 = 36
276      ivon05 =  6
277      ivon06 =  2
278      ivcomp = ivon01 + (ivon02 - ivon03 * ivon04) / ivon05 ** ivon06
279      go to 47530
28037530 ivdele = ivdele + 1
281      write (i02,80003) ivtnum
282      if (iczero) 47530, 7541, 47530
28347530 if (ivcomp - 12) 27530,17530,27530
28417530 ivpass = ivpass + 1
285      write (i02,80001) ivtnum
286      go to 7541
28727530 ivfail = ivfail + 1
288      ivcorr = 12
289c     actual answer is  11.25            truncation is necessary
290c                                        during an intermediate step
291      write (i02,80004) ivtnum, ivcomp, ivcorr
292 7541 continue
293      ivtnum = 754
294c
295c      ****  test 754  ****
296c
297      if (iczero) 37540, 7540, 37540
298 7540 continue
299      ivon01 = 15
300      ivon02 =  9
301      ivon03 =  4
302      ivon04 = 36
303      ivon05 =  6
304      ivon06 =  2
305      ivcomp = ivon01 + (ivon02 - ivon03) * (ivon04 / ivon05) ** ivon06
306      go to 47540
30737540 ivdele = ivdele + 1
308      write (i02,80003) ivtnum
309      if (iczero) 47540, 7551, 47540
31047540 if (ivcomp - 195) 27540,17540,27540
31117540 ivpass = ivpass + 1
312      write (i02,80001) ivtnum
313      go to 7551
31427540 ivfail = ivfail + 1
315      ivcorr = 195
316      write (i02,80004) ivtnum, ivcomp, ivcorr
317 7551 continue
318      ivtnum = 755
319c
320c      ****  test 755  ****
321c
322      if (iczero) 37550, 7550, 37550
323 7550 continue
324      ivon01 = 15
325      ivon02 =  9
326      ivon03 =  4
327      ivon04 = 36
328      ivon05 =  6
329      ivon06 =  2
330      ivcomp = ((ivon01 + (ivon02 - ivon03) * ivon04) / ivon05) **
331     *         ivon06
332      go to 47550
33337550 ivdele = ivdele + 1
334      write (i02,80003) ivtnum
335      if (iczero) 47550, 7561, 47550
33647550 if (ivcomp - 1024)  27550,17550,27550
33717550 ivpass = ivpass + 1
338      write (i02,80001) ivtnum
339      go to 7561
34027550 ivfail = ivfail + 1
341      ivcorr = 1024
342c     actual answer is  1056.25         truncation is necessary
343c                                       during an intermediate step
344      write (i02,80004) ivtnum, ivcomp, ivcorr
345 7561 continue
346      ivtnum = 756
347c
348c      ****  test 756  ****
349c          single parentheses
350c
351      if (iczero) 37560, 7560, 37560
352 7560 continue
353      ivon01 = 13
354      ivon02 = 37
355      ivcomp = (ivon01 + ivon02)
356      go to 47560
35737560 ivdele = ivdele + 1
358      write (i02,80003) ivtnum
359      if (iczero) 47560, 7571, 47560
36047560 if (ivcomp - 50) 27560,17560,27560
36117560 ivpass = ivpass + 1
362      write (i02,80001) ivtnum
363      go to 7571
36427560 ivfail = ivfail + 1
365      ivcorr = 50
366      write (i02,80004) ivtnum, ivcomp, ivcorr
367 7571 continue
368      ivtnum = 757
369c
370c      ****  test 757  ****
371c          nested parentheses (two sets)
372c
373      if (iczero) 37570, 7570, 37570
374 7570 continue
375      ivon01 = 13
376      ivon02 = 37
377      ivcomp = ((ivon01 - ivon02))
378      go to 47570
37937570 ivdele = ivdele + 1
380      write (i02,80003) ivtnum
381      if (iczero) 47570, 7581, 47570
38247570 if (ivcomp + 24) 27570,17570,27570
38317570 ivpass = ivpass + 1
384      write (i02,80001) ivtnum
385      go to 7581
38627570 ivfail = ivfail + 1
387      ivcorr = -24
388      write (i02,80004) ivtnum, ivcomp, ivcorr
389 7581 continue
390      ivtnum = 758
391c
392c      ****  test 758  ****
393c          nested parentheses (21 sets - same line)
394c
395      if (iczero) 37580, 7580, 37580
396 7580 continue
397      ivon01 = 13
398      ivon02 = 37
399      ivcomp = (((((((((((((((((((((ivon01 * ivon02)))))))))))))))))))))
400      go to 47580
40137580 ivdele = ivdele + 1
402      write (i02,80003) ivtnum
403      if (iczero) 47580, 7591, 47580
40447580 if (ivcomp - 481) 27580,17580,27580
40517580 ivpass = ivpass + 1
406      write (i02,80001) ivtnum
407      go to 7591
40827580 ivfail = ivfail + 1
409      ivcorr = 481
410      write (i02,80004) ivtnum, ivcomp, ivcorr
411 7591 continue
412      ivtnum = 759
413c
414c      ****  test 759  ****
415c          nested parentheses (57 sets - multiple lines)
416c
417      if (iczero) 37590, 7590, 37590
418 7590 continue
419      ivon01 = 13
420      ivon02 = 37
421      ivcomp = (((((((((((((((((((((((((((((((((((((((((((((((((((((((((
422     *         ivon01 / ivon02
423     *         )))))))))))))))))))))))))))))))))))))))))))))))))))))))))
424      go to 47590
42537590 ivdele = ivdele + 1
426      write (i02,80003) ivtnum
427      if (iczero) 47590, 7601, 47590
42847590 if (ivcomp) 27590,17590,27590
42917590 ivpass = ivpass + 1
430      write (i02,80001) ivtnum
431      go to 7601
43227590 ivfail = ivfail + 1
433      ivcorr = 0
434      write (i02,80004) ivtnum, ivcomp, ivcorr
435 7601 continue
436c
437c     write page footings and run summaries
43899999 continue
439      write (i02,90002)
440      write (i02,90006)
441      write (i02,90002)
442      write (i02,90002)
443      write (i02,90007)
444      write (i02,90002)
445      write (i02,90008)  ivfail
446      write (i02,90009) ivpass
447      write (i02,90010) ivdele
448c
449c
450c     terminate routine execution
451      stop
452c
453c     format statements for page headers
45490000 format (1h1)
45590002 format (1h )
45690001 format (1h ,10x,34hfortran compiler validation system)
45790003 format (1h ,21x,11hversion 1.0)
45890004 format (1h ,10x,38hfor official use only - copyright 1978)
45990005 format (1h ,5x,4htest,5x,9hpass/fail, 5x,8hcomputed,8x,7hcorrect)
46090006 format (1h ,5x,46h----------------------------------------------)
46190011 format (1h ,18x,17hsubset level test)
462c
463c     format statements for run summaries
46490008 format (1h ,15x,i5,19h errors encountered)
46590009 format (1h ,15x,i5,13h tests passed)
46690010 format (1h ,15x,i5,14h tests deleted)
467c
468c     format statements for test results
46980001 format (1h ,4x,i5,7x,4hpass)
47080002 format (1h ,4x,i5,7x,4hfail)
47180003 format (1h ,4x,i5,7x,7hdeleted)
47280004 format (1h ,4x,i5,7x,4hfail,10x,i6,9x,i6)
47380005 format (1h ,4x,i5,7x,4hfail,4x,e12.5,3x,e12.5)
474c
47590007 format (1h ,20x,20hend of program fm045)
476      end
477