xref: /original-bsd/usr.bin/f77/tests/tests/fm005.f (revision a95f03a8)
1c     comment section
2c
3c     fm005
4c
5c         this routine tests the basic assumptions regarding the simple
6c     formatted write statement of form
7c            write (u,f)     or
8c            write (u,f) l
9c     where      u is a logical unit number
10c                f is a format statement label, and
11c                l is a list of integer variables.
12c     the format statement f contains nh hollerith field descriptors,
13c     nx blank field descriptors and iw numeric field descriptors.
14c
15c         this routine tests whether the first character of a format
16c     record for printer output determines vertical spacing as follows
17c               blank  -  one line
18c                 1    -  advance to first line of next page
19c
20c      references
21c        american national standard programming language fortran,
22c              x3.9-1978
23c
24c        section 12.8.2, input/output lists
25c        section 12.9.5.2, read, write, and print statement
26c        section 12.9.5.2.3, printing of formatted records
27c        section 13.5.2, h editing
28c        section 13.5.3.2, x editing
29c        section 13.5.9.1, numeric editing
30c
31c         all of the results of this routine must be visually checked
32c     on the output report.  the usual test code for pass, fail, or
33c     delete does not apply to this routine.  if any test is to be
34c     deleted, change the offending write or format statement to a
35c     comment.  the person responsible for checking the output must also
36c     check the compiler listing to see if any statements have been
37c     changed to comments.
38c
39c      **********************************************************
40c
41c         a compiler validation system for the fortran language
42c     based on specifications as defined in american national standard
43c     programming language fortran x3.9-1978, has been developed by the
44c     federal cobol compiler testing service.  the fortran compiler
45c     validation system (fcvs) consists of audit routines, their related
46c     data, and an executive system.  each audit routine is a fortran
47c     program, subprogram or function which includes tests of specific
48c     language elements and supporting procedures indicating the result
49c     of executing these tests.
50c
51c         this particular program/subprogram/function contains features
52c     found only in the subset as defined in x3.9-1978.
53c
54c         suggestions and comments should be forwarded to -
55c
56c                  department of the navy
57c                  federal cobol compiler testing service
58c                  washington, d.c.  20376
59c
60c      **********************************************************
61c
62c
63c
64c     initialization section
65c
66c     initialize constants
67c      **************
68c     i01 contains the logical unit number for the card reader.
69      i01 = 5
70c     i02 contains the logical unit number for the printer.
71      i02 = 6
72c     system environment section
73c
74cx010    this card is replaced by contents of fexec x-010 control card.
75c     the cx010 card is for overriding the program default i01 = 5
76c     (unit number for card reader).
77cx011    this card is replaced by contents of fexec x-011 control card.
78c     the cx011 card is for systems which require additional
79c     fortran statements for files associated with cx010 above.
80c
81cx020    this card is replaced by contents of fexec x-020 control card.
82c     the cx020 card is for overriding the program default i02 = 6
83c     (unit number for printer).
84cx021    this card is replaced by contents of fexec x-021 control card.
85c     the cx021 card is for systems which require additional
86c     fortran statements for files associated with cx020 above.
87c
88      ivpass=0
89      ivfail=0
90      ivdele=0
91      iczero=0
92c
93c     write page headers
94      write (i02,90000)
95      write (i02,90001)
96      write (i02,90002)
97      write (i02, 90002)
98      write (i02,90003)
99      write (i02,90002)
100      write (i02,90004)
101      write (i02,90002)
102      write (i02,90011)
103      write (i02,90002)
104      write (i02,90002)
105      write (i02,90006)
106      write (i02,90002)
107  331 continue
108      ivtnum = 33
109c
110c      ****  test 033  ****
111c         test 33 - vertical spacing test
112c             1 in first character of formatted print record means
113c             record is first line at top of next page.
114c
115      write (i02,80001) ivtnum
116      write (i02,80331)
11780331 format (5x,22hlast line on this page)
118      write (i02,80330)
11980330 format (1h1,31h     this is first line on page)
120  341 continue
121      ivtnum = 34
122c
123c      ****  test 034  ****
124c         test 34 - vertical spacing test
125c         print blank lines
126c
127      write (i02,90002)
128      write (i02,80001) ivtnum
129      write (i02,80340)
13080340 format (1h , 10x)
131      write (i02,80341)
13280341 format (41h there is one blank line before this line)
133      write (i02,80342)
134      write (i02,80342)
13580342 format (11h           )
136      write (i02,80343)
13780343 format (43h there are two blank lines before this line)
138      write (i02,80344)
139      write (i02,80344)
140      write (i02,80344)
14180344 format (11x)
142      write (i02,80345)
14380345 format (45h there are three blank lines before this line)
144  351 continue
145      ivtnum = 35
146c
147c      ****  test 035  ****
148c         test 35 - print 54 characters
149c
150      write (i02,90002)
151      write (i02,80001)ivtnum
152      write (i02,80351)
15380351 format (33h next line contains 54 characters)
154      write (i02,80350)
15580350 format(55h 123456789012345678901234567890123456789012345678901234)
156  361 continue
157      ivtnum = 36
158c
159c      ****  test 036  ****
160c         test 36 - numeric field descriptor i1
161c
162      write (i02,90000)
163      write (i02,90002)
164      write (i02,80001) ivtnum
165      write (i02,80361)
16680361 format (1h ,10x,38hthis test prints 3 under i1 descriptor)
167      ivon01 = 3
168      write (i02,80360) ivon01
16980360 format (1h ,10x,i1)
170  371 continue
171      ivtnum = 37
172c
173c      ****  test 037  ****
174c         test 37 - numeric field descriptor i2
175c
176      write (i02,90002)
177      write (i02,80001) ivtnum
178      write (i02,80371)
17980371 format (11x,39hthis test prints 15 under i2 descriptor)
180      ivon01 = 15
181      write (i02,80370) ivon01
18280370 format (1h ,10x,i2)
183  381 continue
184      ivtnum = 38
185c
186c      ****  test 038  ****
187c         test 38 - numeric field descriptor i3
188c
189      write (i02,90002)
190      write (i02,80001) ivtnum
191      write (i02,80381)
19280381 format (11x,40hthis test prints 291 under i3 descriptor)
193      ivon01 = 291
194      write (i02,80380) ivon01
19580380 format (11x,i3)
196  391 continue
197      ivtnum = 39
198c
199c      ****  test 039  ****
200c         test 39 - numeric field descriptor i4
201c
202      write (i02,90002)
203      write (i02,80001) ivtnum
204      write (i02,80391)
20580391 format (11x,41hthis test prints 4321 under i4 descriptor)
206      ivon01 = 4321
207      write (i02,80390) ivon01
20880390 format (11x,i4)
209  401 continue
210      ivtnum = 40
211c
212c      ****  test 040  ****
213c         test 40 - numeric field descriptor i5
214c
215      write (i02,90002)
216      write (i02,80001) ivtnum
217      write (i02,80401)
21880401 format (1h ,10x,42hthis test prints 12345 under i5 descriptor)
219      ivon01 = 12345
220      write (i02,80400) ivon01
22180400 format (1h ,10x,i5)
222  411 continue
223      ivtnum = 41
224c
225c      ****  test 041  ****
226c         test 41 - numeric field descriptors, integer conversion
227c
228      ivon01 = 1
229      ivon02 = 22
230      ivon03 = 333
231      ivon04 = 4444
232      ivon05 = 25555
233      write (i02,90002)
234      write (i02,80001) ivtnum
235      write (i02,80411)
23680411 format (3x,50hthis test prints 1, 22, 333, 4444, and 25555 under)
237      write (i02,80412)
23880412 format (10x,32h(10x,i1,3x,i2,3x,i3,3x,i4,3x,i5))
239      write (i02,80410) ivon01, ivon02, ivon03, ivon04, ivon05
24080410 format (10x,i1,3x,i2,3x,i3,3x,i4,3x,i5)
241  421 continue
242      ivtnum = 42
243c
244c      ****  test 042  ****
245c         test 42 - hollerith, numeric and x field descriptors
246c            combine hollerith, numeric and x field descriptors in
247c            one format statement
248c
249      ivon01=113
250      ivon02=8
251      write (i02,90002)
252      write (i02,80001) ivtnum
253      write (i02,80421)
25480421 format (10x,28hnext two lines are identical)
255      write (i02,80422)
25680422 format (35h      ivon01 =  113   ivon02 =    8)
257      write (i02,80420) ivon01, ivon02
25880420 format (6x,8hivon01 =,i5,3x,8hivon02 =,i5)
259  431 continue
260      ivtnum=43
261c
262c      ****  test 043  ****
263c         test 43 - numeric field descriptor i2
264c           print negative integer
265c
266      ivon01 = -1
267      write (i02,90000)
268      write (i02,90002)
269      write (i02,80001)  ivtnum
270      write (i02,80431)
27180431 format (11x,39hthis test prints -1 under i2 descriptor)
272      write (i02,80430) ivon01
27380430 format (11x,i2)
274  441 continue
275      ivtnum = 44
276c
277c      ****  test 044  ****
278c         test 44 - numeric field descriptor i3
279c           print negative integer
280c
281      ivon01 = -22
282      write (i02,90002)
283      write (i02,80001) ivtnum
284      write (i02,80441)
28580441 format (11x,40hthis test prints -22 under i3 descriptor)
286      write (i02,80440) ivon01
28780440 format (11x,i3)
288  451 continue
289      ivtnum = 45
290c
291c      ****  test 045  ****
292c         test 45 - numeric field descriptor i4
293c           print negative integer
294c
295      ivon01 = -333
296      write (i02,90002)
297      write (i02,80001) ivtnum
298      write (i02,80451)
29980451 format (11x,41hthis test prints -333 under i4 descriptor)
300      write (i02,80450) ivon01
30180450 format (11x,i4)
302  461 continue
303      ivtnum = 46
304c
305c      ****  test 046  ****
306c         test 46 - numeric field descriptor i5
307c           print negative integer
308c
309      ivon01 = -4444
310      write (i02,90002)
311      write (i02,80001) ivtnum
312      write (i02,80461)
31380461 format (11x,42hthis test prints -4444 under i5 descriptor)
314      write (i02,80460) ivon01
31580460 format (11x,i5)
316  471 continue
317      ivtnum = 47
318c
319c      ****  test 047  ****
320c         test 47 - numeric field descriptor i6
321c           print negative integer
322c
323      ivon01 = -15555
324      write (i02,90002)
325      write (i02,80001) ivtnum
326      write (i02,80471)
32780471 format (11x,43hthis test prints -15555 under descriptor i6)
328      write (i02,80470) ivon01
32980470 format (11x,i6)
330  481 continue
331      ivtnum = 48
332c
333c      ****  test 048  ****
334c         test 48 - numeric field descriptors, integer conversion
335c           print negative integers
336c
337      ivon01 = -9
338      ivon02 = -88
339      ivon03 = -777
340      ivon04 = -6666
341      ivon05 = -25555
342      write (i02,90002)
343      write (i02,80001) ivtnum
344      write (i02,80481)
34580481 format (8x,49hthis test prints -9, -88, -777, -6666, and -25555)
346      write (i02,80482)
34780482 format (11x,43hunder format 10x,i2,3x,i3,3x,i4,3x,i5,3x,i6)
348      write (i02,80480) ivon01,ivon02,ivon03,ivon04,ivon05
34980480 format (10x,i2,3x,i3,3x,i4,3x,i5,3x,i6)
350  491 continue
351      ivtnum = 49
352c
353c      ****  test 049  ****
354c         test 49 - numeric field descriptor i5
355c            mix positive and negative integer output in one format
356c         statement all under i5 descriptor
357c
358      ivon01 =5
359      ivon02 = -54
360      ivon03 = 543
361      ivon04 = -5432
362      ivon05=32000
363      write (i02,90002)
364      write (i02,80001) ivtnum
365      write (i02,80491)
36680491 format (18x,46hthis test prints 5, -54, 543, -5432, and 32000)
367      write (i02,80492)
36880492 format (11x,33hunder i5 numeric field descriptor)
369      write (i02,80490) ivon01,ivon02,ivon03,ivon04,ivon05
37080490 format (11x,i5,3x,i5,3x,i5,3x,i5,3x,i5)
371c
372c     write page footings
37399999 continue
374      write (i02,90002)
375      write (i02,90006)
376      write (i02,90002)
377      write (i02,90007)
378c
379c     terminate routine execution
380      stop
381c
382c     format statements for page headers
38390000 format (1h1)
38490002 format (1h )
38590001 format (1h ,10x,34hfortran compiler validation system)
38690003 format (1h ,21x,11hversion 1.0)
38790004 format (1h ,10x,38hfor official use only - copyright 1978)
38890005 format (1h ,5x,4htest,5x,9hpass/fail, 5x,8hcomputed,8x,7hcorrect)
38990006 format (1h ,5x,46h----------------------------------------------)
39090011 format (1h ,18x,17hsubset level test)
391c     format statements for this routine
39280001 format (10x,5htest ,i2)
39390007 format (1h ,20x,20hend of program fm005)
394      end
395