xref: /original-bsd/usr.bin/f77/tests/tests/fm036.f (revision 3839ed90)
1c     comment section
2c
3c     fm036
4c
5c         this routine tests arithmetic asignment statements of the
6c     form
7c              integer variable = arithmetic expression
8c     where the arithmetic expression is formed with the arithmetic
9c     operator / and integer constants.  both positive and negative
10c     constants are used in the arithmetic expression.
11c
12c         there are tests which require no truncation of the result
13c     and tests where the result must be truncated before being stored
14c     in the resultant integer variable.  the standard states 'the value
15c     of an integer factor or term is the nearest integer whose
16c     magnitude does not exceed the magnitude of the mathematical value
17c     represented by that factor or term.'
18c
19c         there are tests where the arithmetic expression contains
20c             (1)  integer constant/integer constant
21c                      no truncation required,
22c             (2)  integer constant/integer constant
23c                      truncation required.
24c
25c      references
26c        american national standard programming language fortran,
27c              x3.9-1978
28c
29c        section 4.3, integer type
30c        section 4.3.1, integer constant
31c        section 6.1, arithmetic expressions
32c        section 6.6, evaluation of expressions
33c        section 10.1, arithmetic assignment statement
34c
35c      **********************************************************
36c
37c         a compiler validation system for the fortran language
38c     based on specifications as defined in american national standard
39c     programming language fortran x3.9-1978, has been developed by the
40c     federal cobol compiler testing service.  the fortran compiler
41c     validation system (fcvs) consists of audit routines, their related
42c     data, and an executive system.  each audit routine is a fortran
43c     program, subprogram or function which includes tests of specific
44c     language elements and supporting procedures indicating the result
45c     of executing these tests.
46c
47c         this particular program/subprogram/function contains features
48c     found only in the subset as defined in x3.9-1978.
49c
50c         suggestions and comments should be forwarded to -
51c
52c                  department of the navy
53c                  federal cobol compiler testing service
54c                  washington, d.c.  20376
55c
56c      **********************************************************
57c
58c
59c
60c     initialization section
61c
62c     initialize constants
63c      **************
64c     i01 contains the logical unit number for the card reader.
65      i01 = 5
66c     i02 contains the logical unit number for the printer.
67      i02 = 6
68c     system environment section
69c
70cx010    this card is replaced by contents of fexec x-010 control card.
71c     the cx010 card is for overriding the program default i01 = 5
72c     (unit number for card reader).
73cx011    this card is replaced by contents of fexec x-011 control card.
74c     the cx011 card is for systems which require additional
75c     fortran statements for files associated with cx010 above.
76c
77cx020    this card is replaced by contents of fexec x-020 control card.
78c     the cx020 card is for overriding the program default i02 = 6
79c     (unit number for printer).
80cx021    this card is replaced by contents of fexec x-021 control card.
81c     the cx021 card is for systems which require additional
82c     fortran statements for files associated with cx020 above.
83c
84      ivpass=0
85      ivfail=0
86      ivdele=0
87      iczero=0
88c
89c     write page headers
90      write (i02,90000)
91      write (i02,90001)
92      write (i02,90002)
93      write (i02, 90002)
94      write (i02,90003)
95      write (i02,90002)
96      write (i02,90004)
97      write (i02,90002)
98      write (i02,90011)
99      write (i02,90002)
100      write (i02,90002)
101      write (i02,90005)
102      write (i02,90006)
103      write (i02,90002)
104c
105c     test section
106c         arithmetic assignment statement
107c
108c     test 462 through test 490 contain two integer constants and
109c     operator / in an arithmetic expression.  the form tested is
110c            integer variable = integer constant/integer constant
111c
112c     test 462 through test 469 - positive constants
113c              no truncation required
114c
115 4621 continue
116      ivtnum = 462
117c
118c      ****  test 462  ****
119c
120      if (iczero) 34620, 4620, 34620
121 4620 continue
122      ivcomp = 4/2
123      go to 44620
12434620 ivdele = ivdele + 1
125      write (i02,80003) ivtnum
126      if (iczero) 44620, 4631, 44620
12744620 if (ivcomp - 2) 24620,14620,24620
12814620 ivpass = ivpass + 1
129      write (i02,80001) ivtnum
130      go to 4631
13124620 ivfail = ivfail + 1
132      ivcorr = 2
133      write (i02,80004) ivtnum, ivcomp ,ivcorr
134 4631 continue
135      ivtnum = 463
136c
137c      ****  test 463  ****
138c
139      if (iczero) 34630, 4630, 34630
140 4630 continue
141      ivcomp = 75 / 25
142      go to 44630
14334630 ivdele = ivdele + 1
144      write (i02,80003) ivtnum
145      if (iczero) 44630, 4641, 44630
14644630 if (ivcomp - 3) 24630,14630,24630
14714630 ivpass = ivpass + 1
148      write (i02,80001) ivtnum
149      go to 4641
15024630 ivfail = ivfail + 1
151      ivcorr = 3
152      write (i02,80004) ivtnum, ivcomp ,ivcorr
153 4641 continue
154      ivtnum = 464
155c
156c      ****  test 464  ****
157c
158      if (iczero) 34640, 4640, 34640
159 4640 continue
160      ivcomp = 3575/143
161      go to 44640
16234640 ivdele = ivdele + 1
163      write (i02,80003) ivtnum
164      if (iczero) 44640, 4651, 44640
16544640 if (ivcomp - 25) 24640,14640,24640
16614640 ivpass = ivpass + 1
167      write (i02,80001) ivtnum
168      go to 4651
16924640 ivfail = ivfail + 1
170      ivcorr = 25
171      write (i02,80004) ivtnum, ivcomp ,ivcorr
172 4651 continue
173      ivtnum = 465
174c
175c      ****  test 465  ****
176c
177      if (iczero) 34650, 4650, 34650
178 4650 continue
179      ivcomp = 3575/25
180      go to 44650
18134650 ivdele = ivdele + 1
182      write (i02,80003) ivtnum
183      if (iczero) 44650, 4661, 44650
18444650 if (ivcomp - 143) 24650,14650,24650
18514650 ivpass = ivpass + 1
186      write (i02,80001) ivtnum
187      go to 4661
18824650 ivfail = ivfail + 1
189      ivcorr = 143
190      write (i02,80004) ivtnum, ivcomp ,ivcorr
191 4661 continue
192      ivtnum = 466
193c
194c      ****  test 466  ****
195c
196      if (iczero) 34660, 4660, 34660
197 4660 continue
198      ivcomp = 6170/1234
199      go to 44660
20034660 ivdele = ivdele + 1
201      write (i02,80003) ivtnum
202      if (iczero) 44660, 4671, 44660
20344660 if (ivcomp - 5) 24660,14660,24660
20414660 ivpass = ivpass + 1
205      write (i02,80001) ivtnum
206      go to 4671
20724660 ivfail = ivfail + 1
208      ivcorr = 5
209      write (i02,80004) ivtnum, ivcomp ,ivcorr
210 4671 continue
211      ivtnum = 467
212c
213c      ****  test 467  ****
214c
215      if (iczero) 34670, 4670, 34670
216 4670 continue
217      ivcomp = 28600/8
218      go to 44670
21934670 ivdele = ivdele + 1
220      write (i02,80003) ivtnum
221      if (iczero) 44670, 4681, 44670
22244670 if (ivcomp - 3575) 24670,14670,24670
22314670 ivpass = ivpass + 1
224      write (i02,80001) ivtnum
225      go to 4681
22624670 ivfail = ivfail + 1
227      ivcorr = 3575
228      write (i02,80004) ivtnum, ivcomp ,ivcorr
229 4681 continue
230      ivtnum = 468
231c
232c      ****  test 468  ****
233c
234      if (iczero) 34680, 4680, 34680
235 4680 continue
236      ivcomp = 32766/2
237      go to 44680
23834680 ivdele = ivdele + 1
239      write (i02,80003) ivtnum
240      if (iczero) 44680, 4691, 44680
24144680 if (ivcomp - 16383) 24680,14680,24680
24214680 ivpass = ivpass + 1
243      write (i02,80001) ivtnum
244      go to 4691
24524680 ivfail = ivfail + 1
246      ivcorr = 16383
247      write (i02,80004) ivtnum, ivcomp ,ivcorr
248 4691 continue
249      ivtnum = 469
250c
251c      ****  test 469  ****
252c
253      if (iczero) 34690, 4690, 34690
254 4690 continue
255      ivcomp = 32767/1
256      go to 44690
25734690 ivdele = ivdele + 1
258      write (i02,80003) ivtnum
259      if (iczero) 44690, 4701, 44690
26044690 if (ivcomp - 32767) 24690,14690,24690
26114690 ivpass = ivpass + 1
262      write (i02,80001) ivtnum
263      go to 4701
26424690 ivfail = ivfail + 1
265      ivcorr = 32767
266      write (i02,80004) ivtnum, ivcomp ,ivcorr
267c
268c     test 470 through test 478 - positive constants
269c               truncation required
270c
271 4701 continue
272      ivtnum = 470
273c
274c      ****  test 470  ****
275c
276      if (iczero) 34700, 4700, 34700
277 4700 continue
278      ivcomp = 5/2
279      go to 44700
28034700 ivdele = ivdele + 1
281      write (i02,80003) ivtnum
282      if (iczero) 44700, 4711, 44700
28344700 if (ivcomp - 2) 24700,14700,24700
28414700 ivpass = ivpass + 1
285      write (i02,80001) ivtnum
286      go to 4711
28724700 ivfail = ivfail + 1
288      ivcorr = 2
289      write (i02,80004) ivtnum, ivcomp ,ivcorr
290 4711 continue
291      ivtnum = 471
292c
293c      ****  test 471  ****
294c
295      if (iczero) 34710, 4710, 34710
296 4710 continue
297      ivcomp = 2/3
298      go to 44710
29934710 ivdele = ivdele + 1
300      write (i02,80003) ivtnum
301      if (iczero) 44710, 4721, 44710
30244710 if (ivcomp - 0) 24710,14710,24710
30314710 ivpass = ivpass + 1
304      write (i02,80001) ivtnum
305      go to 4721
30624710 ivfail = ivfail + 1
307      ivcorr = 0
308      write (i02,80004) ivtnum, ivcomp ,ivcorr
309 4721 continue
310      ivtnum = 472
311c
312c      ****  test 472  ****
313c
314      if (iczero) 34720, 4720, 34720
315 4720 continue
316      ivcomp = 80/15
317      go to 44720
31834720 ivdele = ivdele + 1
319      write (i02,80003) ivtnum
320      if (iczero) 44720, 4731, 44720
32144720 if (ivcomp - 5) 24720,14720,24720
32214720 ivpass = ivpass + 1
323      write (i02,80001) ivtnum
324      go to 4731
32524720 ivfail = ivfail + 1
326      ivcorr = 5
327      write (i02,80004) ivtnum, ivcomp ,ivcorr
328 4731 continue
329      ivtnum = 473
330c
331c      ****  test 473  ****
332c
333      if (iczero) 34730, 4730, 34730
334 4730 continue
335      ivcomp = 959/120
336      go to 44730
33734730 ivdele = ivdele + 1
338      write (i02,80003) ivtnum
339      if (iczero) 44730, 4741, 44730
34044730 if (ivcomp - 7) 24730,14730,24730
34114730 ivpass = ivpass + 1
342      write (i02,80001) ivtnum
343      go to 4741
34424730 ivfail = ivfail + 1
345      ivcorr = 7
346      write (i02,80004) ivtnum, ivcomp ,ivcorr
347 4741 continue
348      ivtnum = 474
349c
350c      ****  test 474  ****
351c
352      if (iczero) 34740, 4740, 34740
353 4740 continue
354      ivcomp = 959 / 12
355      go to 44740
35634740 ivdele = ivdele + 1
357      write (i02,80003) ivtnum
358      if (iczero) 44740, 4751, 44740
35944740 if (ivcomp - 79) 24740,14740,24740
36014740 ivpass = ivpass + 1
361      write (i02,80001) ivtnum
362      go to 4751
36324740 ivfail = ivfail + 1
364      ivcorr = 79
365      write (i02,80004) ivtnum, ivcomp ,ivcorr
366 4751 continue
367      ivtnum = 475
368c
369c      ****  test 475  ****
370c
371      if (iczero) 34750, 4750, 34750
372 4750 continue
373      ivcomp = 959/6
374      go to 44750
37534750 ivdele = ivdele + 1
376      write (i02,80003) ivtnum
377      if (iczero) 44750, 4761, 44750
37844750 if (ivcomp - 159) 24750,14750,24750
37914750 ivpass = ivpass + 1
380      write (i02,80001) ivtnum
381      go to 4761
38224750 ivfail = ivfail + 1
383      ivcorr = 159
384      write (i02,80004) ivtnum, ivcomp ,ivcorr
385 4761 continue
386      ivtnum = 476
387c
388c      ****  test 476  ****
389c
390      if (iczero) 34760, 4760, 34760
391 4760 continue
392      ivcomp = 28606/8
393      go to 44760
39434760 ivdele = ivdele + 1
395      write (i02,80003) ivtnum
396      if (iczero) 44760, 4771, 44760
39744760 if (ivcomp - 3575) 24760,14760,24760
39814760 ivpass = ivpass + 1
399      write (i02,80001) ivtnum
400      go to 4771
40124760 ivfail = ivfail + 1
402      ivcorr = 3575
403      write (i02,80004) ivtnum, ivcomp ,ivcorr
404 4771 continue
405      ivtnum = 477
406c
407c      ****  test 477  ****
408c
409      if (iczero) 34770, 4770, 34770
410 4770 continue
411      ivcomp = 25603/2
412      go to 44770
41334770 ivdele = ivdele + 1
414      write (i02,80003) ivtnum
415      if (iczero) 44770, 4781, 44770
41644770 if (ivcomp - 12801) 24770,14770,24770
41714770 ivpass = ivpass + 1
418      write (i02,80001) ivtnum
419      go to 4781
42024770 ivfail = ivfail + 1
421      ivcorr = 12801
422      write (i02,80004) ivtnum, ivcomp ,ivcorr
423 4781 continue
424      ivtnum = 478
425c
426c      ****  test 478  ****
427c
428      if (iczero) 34780, 4780, 34780
429 4780 continue
430      ivcomp = 25603/10354
431      go to 44780
43234780 ivdele = ivdele + 1
433      write (i02,80003) ivtnum
434      if (iczero) 44780, 4791, 44780
43544780 if (ivcomp - 2) 24780,14780,24780
43614780 ivpass = ivpass + 1
437      write (i02,80001) ivtnum
438      go to 4791
43924780 ivfail = ivfail + 1
440      ivcorr = 2
441      write (i02,80004) ivtnum, ivcomp ,ivcorr
442c
443c     test 479 through test 482 - negative constants included
444c                no truncation required
445c
446 4791 continue
447      ivtnum = 479
448c
449c      ****  test 479  ****
450c
451      if (iczero) 34790, 4790, 34790
452 4790 continue
453      ivcomp = -4/2
454      go to 44790
45534790 ivdele = ivdele + 1
456      write (i02,80003) ivtnum
457      if (iczero) 44790, 4801, 44790
45844790 if (ivcomp + 2) 24790,14790,24790
45914790 ivpass = ivpass + 1
460      write (i02,80001) ivtnum
461      go to 4801
46224790 ivfail = ivfail + 1
463      ivcorr = -2
464      write (i02,80004) ivtnum, ivcomp ,ivcorr
465 4801 continue
466      ivtnum = 480
467c
468c      ****  test 480  ****
469c
470      if (iczero) 34800, 4800, 34800
471 4800 continue
472      ivcomp = 75 / (-25)
473      go to 44800
47434800 ivdele = ivdele + 1
475      write (i02,80003) ivtnum
476      if (iczero) 44800, 4811, 44800
47744800 if (ivcomp + 3) 24800,14800,24800
47814800 ivpass = ivpass + 1
479      write (i02,80001) ivtnum
480      go to 4811
48124800 ivfail = ivfail + 1
482      ivcorr = -3
483      write (i02,80004) ivtnum, ivcomp ,ivcorr
484 4811 continue
485      ivtnum = 481
486c
487c      ****  test 481  ****
488c
489      if (iczero) 34810, 4810, 34810
490 4810 continue
491      ivcomp= (-6170) / (-1234)
492      go to 44810
49334810 ivdele = ivdele + 1
494      write (i02,80003) ivtnum
495      if (iczero) 44810, 4821, 44810
49644810 if (ivcomp - 5) 24810,14810,24810
49714810 ivpass = ivpass + 1
498      write (i02,80001) ivtnum
499      go to 4821
50024810 ivfail = ivfail + 1
501      ivcorr = 5
502
503      write (i02,80004) ivtnum, ivcomp ,ivcorr
504 4821 continue
505      ivtnum = 482
506c
507c      ****  test 482  ****
508c
509      if (iczero) 34820, 4820, 34820
510 4820 continue
511      ivcomp = -32766/(-2)
512      go to 44820
51334820 ivdele = ivdele + 1
514      write (i02,80003) ivtnum
515      if (iczero) 44820, 4831, 44820
51644820 if (ivcomp - 16383) 24820,14820,24820
51714820 ivpass = ivpass + 1
518      write (i02,80001) ivtnum
519      go to 4831
52024820 ivfail = ivfail + 1
521      ivcorr = 16383
522      write (i02,80004) ivtnum, ivcomp ,ivcorr
523c
524c     test 483 through test 490 - negative constants included
525c                truncation required
526c
527 4831 continue
528      ivtnum = 483
529c
530c      ****  test 483  ****
531c
532      if (iczero) 34830, 4830, 34830
533 4830 continue
534      ivcomp = -5/2
535      go to 44830
53634830 ivdele = ivdele + 1
537      write (i02,80003) ivtnum
538      if (iczero) 44830, 4841, 44830
53944830 if (ivcomp +2) 24830,14830,24830
54014830 ivpass = ivpass + 1
541      write (i02,80001) ivtnum
542      go to 4841
54324830 ivfail = ivfail + 1
544      ivcorr = -2
545      write (i02,80004) ivtnum, ivcomp ,ivcorr
546 4841 continue
547      ivtnum = 484
548c
549c      ****  test 484  ****
550c
551      if (iczero) 34840, 4840, 34840
552 4840 continue
553      ivcomp = -2/3
554      go to 44840
55534840 ivdele = ivdele + 1
556      write (i02,80003) ivtnum
557      if (iczero) 44840, 4851, 44840
55844840 if (ivcomp) 24840,14840,24840
55914840 ivpass = ivpass + 1
560      write (i02,80001) ivtnum
561      go to 4851
56224840 ivfail = ivfail + 1
563      ivcorr = 0
564      write (i02,80004) ivtnum, ivcomp ,ivcorr
565 4851 continue
566      ivtnum = 485
567c
568c      ****  test 485  ****
569c
570      if (iczero) 34850, 4850, 34850
571 4850 continue
572      ivcomp = 80/(-15)
573      go to 44850
57434850 ivdele = ivdele + 1
575      write (i02,80003) ivtnum
576      if (iczero) 44850, 4861, 44850
57744850 if (ivcomp +5) 24850,14850,24850
57814850 ivpass = ivpass + 1
579      write (i02,80001) ivtnum
580      go to 4861
58124850 ivfail = ivfail + 1
582      ivcorr = -5
583      write (i02,80004) ivtnum, ivcomp ,ivcorr
584 4861 continue
585      ivtnum = 486
586c
587c      ****  test 486  ****
588c
589      if (iczero) 34860, 4860, 34860
590 4860 continue
591      ivcomp = -959/(-120)
592      go to 44860
59334860 ivdele = ivdele + 1
594      write (i02,80003) ivtnum
595      if (iczero) 44860, 4871, 44860
59644860 if (ivcomp - 7) 24860,14860,24860
59714860 ivpass = ivpass + 1
598      write (i02,80001) ivtnum
599      go to 4871
60024860 ivfail = ivfail + 1
601      ivcorr = 7
602      write (i02,80004) ivtnum, ivcomp ,ivcorr
603 4871 continue
604      ivtnum = 487
605c
606c      ****  test 487  ****
607c
608      if (iczero) 34870, 4870, 34870
609 4870 continue
610      ivcomp = -959/6
611      go to 44870
61234870 ivdele = ivdele + 1
613      write (i02,80003) ivtnum
614      if (iczero) 44870, 4881, 44870
61544870 if (ivcomp + 159) 24870,14870,24870
61614870 ivpass = ivpass + 1
617      write (i02,80001) ivtnum
618      go to 4881
61924870 ivfail = ivfail + 1
620      ivcorr = -159
621      write (i02,80004) ivtnum, ivcomp ,ivcorr
622 4881 continue
623      ivtnum = 488
624c
625c      ****  test 488  ****
626c
627      if (iczero) 34880, 4880, 34880
628 4880 continue
629      ivcomp = -28606/(-8)
630      go to 44880
63134880 ivdele = ivdele + 1
632      write (i02,80003) ivtnum
633      if (iczero) 44880, 4891, 44880
63444880 if (ivcomp - 3575) 24880,14880,24880
63514880 ivpass = ivpass + 1
636      write (i02,80001) ivtnum
637      go to 4891
63824880 ivfail = ivfail + 1
639      ivcorr = 3575
640      write (i02,80004) ivtnum, ivcomp ,ivcorr
641 4891 continue
642      ivtnum = 489
643c
644c      ****  test 489  ****
645c
646      if (iczero) 34890, 4890, 34890
647 4890 continue
648      ivcomp = -25603/2
649      go to 44890
65034890 ivdele = ivdele + 1
651      write (i02,80003) ivtnum
652      if (iczero) 44890, 4901, 44890
65344890 if (ivcomp + 12801) 24890,14890,24890
65414890 ivpass = ivpass + 1
655      write (i02,80001) ivtnum
656      go to 4901
65724890 ivfail = ivfail + 1
658      ivcorr = -12801
659      write (i02,80004) ivtnum, ivcomp ,ivcorr
660 4901 continue
661      ivtnum = 490
662c
663c      ****  test 490  ****
664c
665      if (iczero) 34900, 4900, 34900
666 4900 continue
667      ivcomp = -25603/(-10354)
668      go to 44900
66934900 ivdele = ivdele + 1
670      write (i02,80003) ivtnum
671      if (iczero) 44900, 4911, 44900
67244900 if (ivcomp - 2) 24900,14900,24900
67314900 ivpass = ivpass + 1
674      write (i02,80001) ivtnum
675      go to 4911
67624900 ivfail = ivfail + 1
677      ivcorr = 2
678      write (i02,80004) ivtnum, ivcomp ,ivcorr
679c
680c      ****    end of tests    ****
681 4911 continue
682c
683c     write page footings and run summaries
68499999 continue
685      write (i02,90002)
686      write (i02,90006)
687      write (i02,90002)
688      write (i02,90002)
689      write (i02,90007)
690      write (i02,90002)
691      write (i02,90008)  ivfail
692      write (i02,90009) ivpass
693      write (i02,90010) ivdele
694c
695c
696c     terminate routine execution
697      stop
698c
699c     format statements for page headers
70090000 format (1h1)
70190002 format (1h )
70290001 format (1h ,10x,34hfortran compiler validation system)
70390003 format (1h ,21x,11hversion 1.0)
70490004 format (1h ,10x,38hfor official use only - copyright 1978)
70590005 format (1h ,5x,4htest,5x,9hpass/fail, 5x,8hcomputed,8x,7hcorrect)
70690006 format (1h ,5x,46h----------------------------------------------)
70790011 format (1h ,18x,17hsubset level test)
708c
709c     format statements for run summaries
71090008 format (1h ,15x,i5,19h errors encountered)
71190009 format (1h ,15x,i5,13h tests passed)
71290010 format (1h ,15x,i5,14h tests deleted)
713c
714c     format statements for test results
71580001 format (1h ,4x,i5,7x,4hpass)
71680002 format (1h ,4x,i5,7x,4hfail)
71780003 format (1h ,4x,i5,7x,7hdeleted)
71880004 format (1h ,4x,i5,7x,4hfail,10x,i6,9x,i6)
71980005 format (1h ,4x,i5,7x,4hfail,4x,e12.5,3x,e12.5)
720c
72190007 format (1h ,20x,20hend of program fm036)
722      end
723