xref: /original-bsd/usr.bin/f77/tests/tests/fm010.f (revision 8b225582)
1c     comment section.
2c
3c      fm010
4c
5c             this routine tests reference format of fortran statements
6c     and statement numbers.  the use of the blank character is tested
7c     both within the statement number field and within the fortran
8c     statements themselves.  leading zero is tested for statements and
9c     integer constants.  variable names which look very much like
10c     fortran reserved words are tested in arithmetic assignment
11c     statements.  naming conventions used throughout the fcvs are
12c     tested also in arithmetic assignment statements.
13c
14c      references
15c        american national standard programming language fortran,
16c              x3.9-1978
17c
18c        section 2.5, variables
19c        section 3.1.6, blank character
20c        section 3.2.2, initial lines
21c        section 3.4, statement labels
22c
23c
24c      **********************************************************
25c
26c         a compiler validation system for the fortran language
27c     based on specifications as defined in american national standard
28c     programming language fortran x3.9-1978, has been developed by the
29c     federal cobol compiler testing service.  the fortran compiler
30c     validation system (fcvs) consists of audit routines, their related
31c     data, and an executive system.  each audit routine is a fortran
32c     program, subprogram or function which includes tests of specific
33c     language elements and supporting procedures indicating the result
34c     of executing these tests.
35c
36c         this particular program/subprogram/function contains features
37c     found only in the subset as defined in x3.9-1978.
38c
39c         suggestions and comments should be forwarded to -
40c
41c                  department of the navy
42c                  federal cobol compiler testing service
43c                  washington, d.c.  20376
44c
45c      **********************************************************
46c
47c
48c
49c     initialization section
50c
51c     initialize constants
52c      **************
53c     i01 contains the logical unit number for the card reader.
54      i01 = 5
55c     i02 contains the logical unit number for the printer.
56      i02 = 6
57c     system environment section
58c
59cx010    this card is replaced by contents of fexec x-010 control card.
60c     the cx010 card is for overriding the program default i01 = 5
61c     (unit number for card reader).
62cx011    this card is replaced by contents of fexec x-011 control card.
63c     the cx011 card is for systems which require additional
64c     fortran statements for files associated with cx010 above.
65c
66cx020    this card is replaced by contents of fexec x-020 control card.
67c     the cx020 card is for overriding the program default i02 = 6
68c     (unit number for printer).
69cx021    this card is replaced by contents of fexec x-021 control card.
70c     the cx021 card is for systems which require additional
71c     fortran statements for files associated with cx020 above.
72c
73      ivpass=0
74      ivfail=0
75      ivdele=0
76      iczero=0
77c
78c     write page headers
79      write (i02,90000)
80      write (i02,90001)
81      write (i02,90002)
82      write (i02, 90002)
83      write (i02,90003)
84      write (i02,90002)
85      write (i02,90004)
86      write (i02,90002)
87      write (i02,90011)
88      write (i02,90002)
89      write (i02,90002)
90      write (i02,90005)
91      write (i02,90006)
92      write (i02,90002)
93 1001 continue
94      ivtnum = 100
95c
96c      ****  test  100  ****
97c
98c     test 100  -  to check the various combinations of forming variable
99c           names.  these are actually symbolic names (ansi x3.9-1978
100c           section 2.2).  this is basically a syntax check using a
101c           combination of from one to six alphanumeric characters with
102c           the first character always alphabetic.  reference format is
103c           also checked by having each assignment statement an initial
104c           line (section 3.2.2).  this means zero may appear in column
105c           six without effect, that lines may begin anywhere from
106c           column seven to column 72, and blanks may be used freely
107c           without meaning (3.1.6 blank characters).
108c
109      if (iczero) 31000, 1000, 31000
110 1000 continue
111      a=1.
112      b =2.
113      c =3.
114      d   =4.
115      e     =5.
116      f      =6.
117     0g                      =                   7.
118                                        h=8.
119                                                                     i=9
120      j  =  10
121          k        =          11
122      l                                 =                             12
123     0m=13
124      n=14
125      o=15.
126      p=16.
127      q=17.
128      r=18.
129      s=19.
130      t=20.
131      u=21.
132      v=22.
133      w=23.
134      x=24.
135      y=25.
136      z=26.
137      aaaaaa=27.
138      bbbbb=28.
139      cccc=29.
140      ddd=30
141      ee=31.
142      f0=32.
143      g12=33.
144      h345 = 34.
145      i6789 = 35
146      j01234 = 36
147      k 5 6 78  9=37
148       l 2 l 2 l 2 =38
149        m  3   m           3                      m3   =              39
150         n         40        =                   4                     0
151     0    omy    =           4                                        1.
152      i   pm   h =           4                                         2
153      go to 1 = 4 3.
154      if 3 = 44
155      do 3 =   53.
156      call fl =62.
157      type i = 63.
158      true   =71.
159      false  = 72.
160      go to 41000
16131000 ivdele = ivdele + 1
162      write (i02,80003) ivtnum
163      if (iczero) 41000, 1011, 41000
16441000 if (ipmh - 42) 21000,11000,21000
16511000 ivpass = ivpass + 1
166      write (i02,80001) ivtnum
167      go to 1011
16821000 ivfail = ivfail + 1
169      ivcomp = ipmh
170      ivcorr = 42
171      write (i02,80004) ivtnum, ivcomp ,ivcorr
172 1011 continue
173      ivtnum = 101
174c
175c      ****  test  101  ****
176c     test 101  -  checks the fcvs naming conventions for integer and
177c           real variables in assignment statements: variable = constant
178c           basically a syntax check on six character variable names.
179c
180      if (iczero) 31010, 1010, 31010
181 1010 continue
182      iace11 = 1
183      iace21 = 2
184      iace31 = 3
185      iacn11 = 4
186      iadn11 = 5
187      iate31 = 6
188      race11 = 7.
189      race21 = 8.
190      racn31 = 9.
191      rade31 = 10.
192      ivte69 = 11
193      ivon78 = 12
194      rvtnaz = 13.
195      rvoez9 = 14.
196      icte96 = 15
197      icon84 = 16
198      rcon48 = 17.
199      rcte54 = 18.
200      idony4 = 19
201      idoeb6 = 20
202      rdon46 = 21.
203      ifons3 = 22
204      rfon77 = 23.
205      go to 41010
20631010 ivdele = ivdele + 1
207      write (i02,80003) ivtnum
208      if (iczero) 41010, 1021, 41010
20941010 if (ivte69 - 11) 21010,11010,21010
21011010 ivpass = ivpass + 1
211      write (i02,80001) ivtnum
212      go to 1021
21321010 ivfail = ivfail + 1
214      ivcomp = ivte69
215      ivcorr = 11
216      write (i02,80004) ivtnum, ivcomp ,ivcorr
217 1021 continue
218      ivtnum = 102
219c
220c      ****  test  102  ****
221c     test 102  -  reference format check on statement labels (section
222c           3.4). these are non-zero integers, from 1 to 5 digits,
223c           may begin anywhere from cols. 1 to 5, and leading zeros are
224c           not significant.  blanks will be imbedded in some of the
225c           statement labels and these should have no effect.  the
226c           continue statement (section 11.11) is used for this test.
227c           a basic fcvs assumption is that the logic will fall thru a
228c           series of continue statements (normal execution sequence).
229c
230      if (iczero) 31020, 1020, 31020
231 1020 continue
2321     continue
233 2    continue
234  3   continue
235   4  continue
236    5 continue
23706    continue
238 007  continue
239 0008 continue
24000009 continue
241 010  continue
2421   1 continue
243 0 12 continue
2440 1 3 continue
24500 14 continue
2460 15  continue
2470 016 continue
248100   continue
2491 0 1 continue
25010  2 ivon01 = 1
2511  03 continue
252 1 04 continue
25301 05 continue
254010 6 continue
2550107  continue
25600108 continue
2571 1 1 continue
2581 111 continue
259  99  continue
2609 9 9 continue
26199 99 continue
262      go to 41020
26331020 ivdele = ivdele + 1
264      write (i02,80003) ivtnum
265      if (iczero) 41020, 1031, 41020
26641020 if (ivon01 - 1) 21020,11020,21020
26711020 ivpass = ivpass + 1
268      write (i02,80001) ivtnum
269      go to 1031
27021020 ivfail = ivfail + 1
271      ivcomp = ivon01
272      ivcorr = 1
273      write (i02,80004) ivtnum, ivcomp ,ivcorr
274 1031 continue
275c
276c     write page footings and run summaries
27799999 continue
278      write (i02,90002)
279      write (i02,90006)
280      write (i02,90002)
281      write (i02,90002)
282      write (i02,90007)
283      write (i02,90002)
284      write (i02,90008)  ivfail
285      write (i02,90009) ivpass
286      write (i02,90010) ivdele
287c
288c
289c     terminate routine execution
290      stop
291c
292c     format statements for page headers
29390000 format (1h1)
29490002 format (1h )
29590001 format (1h ,10x,34hfortran compiler validation system)
29690003 format (1h ,21x,11hversion 1.0)
29790004 format (1h ,10x,38hfor official use only - copyright 1978)
29890005 format (1h ,5x,4htest,5x,9hpass/fail, 5x,8hcomputed,8x,7hcorrect)
29990006 format (1h ,5x,46h----------------------------------------------)
30090011 format (1h ,18x,17hsubset level test)
301c
302c     format statements for run summaries
30390008 format (1h ,15x,i5,19h errors encountered)
30490009 format (1h ,15x,i5,13h tests passed)
30590010 format (1h ,15x,i5,14h tests deleted)
306c
307c     format statements for test results
30880001 format (1h ,4x,i5,7x,4hpass)
30980002 format (1h ,4x,i5,7x,4hfail)
31080003 format (1h ,4x,i5,7x,7hdeleted)
31180004 format (1h ,4x,i5,7x,4hfail,10x,i6,9x,i6)
31280005 format (1h ,4x,i5,7x,4hfail,4x,e12.5,3x,e12.5)
313c
31490007 format (1h ,20x,20hend of program fm010)
315      end
316