xref: /original-bsd/usr.bin/f77/tests/tests/fm011.f (revision 7c3db03c)
1c      comment section.
2c
3c      fm011
4c
5c     this routine is a test of blank characters (section 3.1.6)
6c         which should have no meaning when embedded in fortran reserved
7c         words.
8c      references
9c        american national standard programming language fortran,
10c              x3.9-1978
11c
12c        section 3.1.6, blank character
13      dim en sion  iadn11(3),iadn12(3)
14      in teger  rvtni1
15      rea  l   ivtnr1
16      log  ical   lvtnl1,lvtnl2
17      com  mon  iace11(3)
18      equ ival ence  (iace11(1),iadn11(1))
19      d   a  t  a   iadn12/3*3/
20c
21c      **********************************************************
22c
23c         a compiler validation system for the fortran language
24c     based on specifications as defined in american national standard
25c     programming language fortran x3.9-1978, has been developed by the
26c     federal cobol compiler testing service.  the fortran compiler
27c     validation system (fcvs) consists of audit routines, their related
28c     data, and an executive system.  each audit routine is a fortran
29c     program, subprogram or function which includes tests of specific
30c     language elements and supporting procedures indicating the result
31c     of executing these tests.
32c
33c         this particular program/subprogram/function contains features
34c     found only in the subset as defined in x3.9-1978.
35c
36c         suggestions and comments should be forwarded to -
37c
38c                  department of the navy
39c                  federal cobol compiler testing service
40c                  washington, d.c.  20376
41c
42c      **********************************************************
43c
44c
45c
46c     initialization section
47c
48c     initialize constants
49c      **************
50c     i01 contains the logical unit number for the card reader.
51      i01 = 5
52c     i02 contains the logical unit number for the printer.
53      i02 = 6
54c     system environment section
55c
56cx010    this card is replaced by contents of fexec x-010 control card.
57c     the cx010 card is for overriding the program default i01 = 5
58c     (unit number for card reader).
59cx011    this card is replaced by contents of fexec x-011 control card.
60c     the cx011 card is for systems which require additional
61c     fortran statements for files associated with cx010 above.
62c
63cx020    this card is replaced by contents of fexec x-020 control card.
64c     the cx020 card is for overriding the program default i02 = 6
65c     (unit number for printer).
66cx021    this card is replaced by contents of fexec x-021 control card.
67c     the cx021 card is for systems which require additional
68c     fortran statements for files associated with cx020 above.
69c
70      ivpass=0
71      ivfail=0
72      ivdele=0
73      iczero=0
74c
75c     write page headers
76      write (i02,90000)
77      write (i02,90001)
78      write (i02,90002)
79      write (i02, 90002)
80      write (i02,90003)
81      write (i02,90002)
82      write (i02,90004)
83      write (i02,90002)
84      write (i02,90011)
85      write (i02,90002)
86      write (i02,90002)
87      write (i02,90005)
88      write (i02,90006)
89      write (i02,90002)
90      ivtnum = 103
91c
92c      ****  test  103  ****
93c     test 103  -  this test has blanks embedded in a dimension
94c           statement.  also the do statement with an embedded blank
95c           will be tested to initialize values in an array.  the
96c           continue and if statements have embedded blanks as well.
97c
98      if (iczero) 31030, 1030, 31030
99 1030 continue
100      d o  1  ivon01 =1 , 3 ,  1
101      iadn11(ivon01) = ivon01
102    1 c on t in ue
103      go to 41030
10431030 ivdele = ivdele + 1
105      write (i02,80003) ivtnum
106      if (iczero) 41030, 1041, 41030
10741030 i   f  (iadn11(2) - 2)  21030,11030,21030
10811030 ivpass = ivpass + 1
109      write (i02,80001) ivtnum
110      go to 1041
11121030 ivfail = ivfail + 1
112      ivcomp = iadn11(2)
113      ivcorr = 2
114      write (i02,80004) ivtnum, ivcomp ,ivcorr
115 1041 continue
116      ivtnum = 104
117c
118c      ****  test  104  ****
119c     test 104  -  this tests embedded blanks in an integer type
120c           statement.  fraction 1/2 should become 0 as an integer.
121c           integer to real * 2. back to integer conversion should be 0.
122c
123      if (iczero) 31040, 1040, 31040
124 1040 continue
125      rvtni1 = 2
126      rvon01 = 1/rvtni1
127      ivon02 = rvon01 * 2.
128      go to 41040
12931040 ivdele = ivdele + 1
130      write (i02,80003) ivtnum
131      if (iczero) 41040, 1051, 41040
13241040 if( ivon02 - 0 ) 21040,11040,21040
13311040 ivpass = ivpass + 1
134      write (i02,80001) ivtnum
135      go to 1051
13621040 ivfail = ivfail + 1
137      ivcomp = ivon02
138      ivcorr = 0
139      write (i02,80004) ivtnum, ivcomp ,ivcorr
140 1051 continue
141      ivtnum = 105
142c
143c      ****  test  105  ****
144c     test 105  -  test of embedded blanks in a real type statement.
145c           real to real*2. to integer conversion is performed.  result
146c           is 1 if the type of the test variable(ivtnr1) was real.
147c
148      if (iczero) 31050, 1050, 31050
149 1050 continue
150      ivtnr1 = .5
151      rvon03 = ivtnr1*2.
152      ivon03 = rvon03 +.3
153      go to 41050
15431050 ivdele = ivdele + 1
155      write (i02,80003) ivtnum
156      if (iczero) 41050, 1061, 41050
15741050 if(ivon03 - 1) 21050,  11050, 21050
15811050 ivpass = ivpass + 1
159      write (i02,80001) ivtnum
160      go to 1061
16121050 ivfail = ivfail + 1
162      ivcomp = ivon03
163      ivcorr = 1
164      write (i02,80004) ivtnum, ivcomp ,ivcorr
165 1061 continue
166      ivtnum = 106
167c
168c      ****  test  106  ****
169c     test 106  -  test the logical type with embedded blanks by a
170c           logic assignment (v = .true.) section 4.7.1 and 10.2
171c
172      if (iczero) 31060, 1060, 31060
173 1060 continue
174      lvtnl1 = .true.
175      go to 41060
17631060 ivdele = ivdele + 1
177      write (i02,80003) ivtnum
178      if (iczero) 41060, 1071, 41060
17941060 if(iczero) 21060,11060,21060
18011060 ivpass = ivpass + 1
181      write (i02,80001) ivtnum
182      go to 1071
18321060 ivfail = ivfail + 1
184      write (i02,80002) ivtnum, ivcomp ,ivcorr
185 1071 continue
186      ivtnum = 107
187c
188c      ****  test  107  ****
189c     test 107  -  a second test of the logical type statement with
190c           embedded blanks.  the test is again made by a logical
191c           assignment (section 4.7.1 and 10.2).
192c
193      if (iczero) 31070, 1070, 31070
194 1070 continue
195      lvtnl2 = .false.
196      go to 41070
19731070 ivdele = ivdele + 1
198      write (i02,80003) ivtnum
199      if (iczero) 41070, 1081, 41070
20041070 if(iczero) 21070,11070,21070
20111070 ivpass = ivpass + 1
202      write (i02,80001) ivtnum
203      go to 1081
20421070 ivfail = ivfail + 1
205      write (i02,80002) ivtnum, ivcomp ,ivcorr
206 1081 continue
207      ivtnum = 108
208c
209c      ****  test  108  ****
210c     test 108  -  this is a test of blanks embedded in the common,
211c           dimension and equivalence statements (section 8.1,
212c           8.3. and 8.2.).
213c
214      if (iczero) 31080, 1080, 31080
215 1080 continue
216      iadn11(3) = 4
217      go to 41080
21831080 ivdele = ivdele + 1
219      write (i02,80003) ivtnum
220      if (iczero) 41080, 1091, 41080
22141080 if(iace11(3) - 4)  21080,11080,21080
22211080 ivpass = ivpass + 1
223      write (i02,80001) ivtnum
224      go to 1091
22521080 ivfail = ivfail + 1
226      ivcomp = iace11(3)
227      ivcorr = 4
228      write (i02,80004) ivtnum, ivcomp ,ivcorr
229 1091 continue
230      ivtnum = 109
231c
232c      ****  test  109  ****
233c     test 109  -  this tests the effect of blanks embedded in the
234c           data statement by checking the initialization of array
235c           element values (section 9).
236c
237      if (iczero) 31090, 1090, 31090
238 1090 continue
239      ivon04    = iadn12(1) + iadn12(2) + iadn12(3)
240      go to 41090
24131090 ivdele = ivdele + 1
242      write (i02,80003) ivtnum
243      if (iczero) 41090, 1101, 41090
24441090 if(ivon04 - 9) 21090,11090,21090
24511090 ivpass = ivpass + 1
246      write (i02,80001) ivtnum
247      go to 1101
24821090 ivfail = ivfail + 1
249      ivcomp = ivon04
250      ivcorr = 9
251      write (i02,80004) ivtnum, ivcomp ,ivcorr
252 1101 continue
253c
254c     write page footings and run summaries
25599999 continue
256      write (i02,90002)
257      write (i02,90006)
258      write (i02,90002)
259      write (i02,90002)
260      write (i02,90007)
261      write (i02,90002)
262      write (i02,90008)  ivfail
263      write (i02,90009) ivpass
264      write (i02,90010) ivdele
265c
266c
267c     terminate routine execution
268      stop
269c
270c     format statements for page headers
27190000 format (1h1)
27290002 format (1h )
27390001 format (1h ,10x,34hfortran compiler validation system)
27490003 format (1h ,21x,11hversion 1.0)
27590004 format (1h ,10x,38hfor official use only - copyright 1978)
27690005 format (1h ,5x,4htest,5x,9hpass/fail, 5x,8hcomputed,8x,7hcorrect)
27790006 format (1h ,5x,46h----------------------------------------------)
27890011 format (1h ,18x,17hsubset level test)
279c
280c     format statements for run summaries
28190008 format (1h ,15x,i5,19h errors encountered)
28290009 format (1h ,15x,i5,13h tests passed)
28390010 format (1h ,15x,i5,14h tests deleted)
284c
285c     format statements for test results
28680001 format (1h ,4x,i5,7x,4hpass)
28780002 format (1h ,4x,i5,7x,4hfail)
28880003 format (1h ,4x,i5,7x,7hdeleted)
28980004 format (1h ,4x,i5,7x,4hfail,10x,i6,9x,i6)
29080005 format (1h ,4x,i5,7x,4hfail,4x,e12.5,3x,e12.5)
291c
29290007 format (1h ,20x,20hend of program fm011)
293      end
294