This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
More fortran edit descriptor tests
- From: "Billinghurst, David (CRTS)" <David dot Billinghurst at riotinto dot com>
- To: <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 6 Feb 2002 23:56:05 +1100
- Subject: More fortran edit descriptor tests
Some further fortran edit descriptor tests. After reading up on how to
quote expect regular expressions in Libes, "Exploring Expect" I understand
the problems from the first batch. I hope I have avoided them this time,
but can't guarantee there won't be others.
Tested on i686-pc-cygwin
2002-02-06 David Billinghurst <David.Billinghurst@riotinto.com>
* g77.dg/f77-edit-apostrophe-out.f: New test
* g77.dg/f77-edit-h-in.f: New test
* g77.dg/f77-edit-t-in.f: New test
* g77.dg/f77-edit-t-out.f: New test
* g77.dg/f77-edit-x-out.f: New test
* g77.dg/f77-edit-slash-out: New test
* g77.dg/f77-edit-colon-out.f: New test
* g77.dg/f77-edit-s-out.f: New test
--- /dev/null Wed Feb 6 23:41:58 2002
+++ g77.dg/f77-edit-apostrophe-out.f Wed Feb 6 22:58:50 2002
@@ -0,0 +1,21 @@
+C Test Fortran 77 apostrophe edit descriptor
+C (ANSI X3.9-1978 Section 13.5.1)
+C
+C Origin: David Billinghurst <David.Billinghurst@riotinto.com>
+C
+C { dg-do run }
+C { dg-output "^" }
+ 10 format('abcde')
+ 20 format('and an apostrophe -''-')
+ 30 format('''a leading apostrophe')
+ 40 format('a trailing apostrophe''')
+ 50 format('''and all of the above -''-''')
+
+ write(*,10) ! { dg-output "abcde(\n|\r\n|\r)" }
+ write(*,20) ! { dg-output "and an apostrophe -'-(\n|\r\n|\r)" }
+ write(*,30) ! { dg-output "'a leading apostrophe(\n|\r\n|\r)" }
+ write(*,40) ! { dg-output "a trailing apostrophe'(\n|\r\n|\r)" }
+ write(*,50) ! { dg-output "'and all of the above -'-'(\n|\r\n|\r)" }
+
+C { dg-output "\$" }
+ end
--- /dev/null Wed Feb 6 23:41:58 2002
+++ g77.dg/f77-edit-colon-out.f Wed Feb 6 22:59:19 2002
@@ -0,0 +1,9 @@
+C Test Fortran 77 colon edit descriptor
+C (ANSI X3.9-1978 Section 13.5.5)
+C
+C Origin: David Billinghurst <David.Billinghurst@riotinto.com>
+C
+C { dg-do run }
+C { dg-output "^123(\n|\r\n|\r)45(\n|\r\n|\r)\$" }
+ write(*,'((3(I1:)))') (I,I=1,5)
+ end
--- /dev/null Wed Feb 6 23:41:58 2002
+++ g77.dg/f77-edit-s-out.f Wed Feb 6 23:29:37 2002
@@ -0,0 +1,20 @@
+C Test Fortran 77 S, SS and SP edit descriptors
+C (ANSI X3.9-1978 Section 13.5.6)
+C
+C Origin: David Billinghurst <David.Billinghurst@riotinto.com>
+C
+C { dg-do run }
+C ( dg-output "^" }
+ 10 format(SP,I3,1X,SS,I3)
+ 20 format(SP,I3,1X,SS,I3,SP,I3)
+ 30 format(SP,I3,1X,SS,I3,S,I3)
+ 40 format(SP,I3)
+ 50 format(SP,I2)
+ write(*,10) 10, 20 ! { dg-output "\\+10 20(\n|\r\n|\r)" }
+ write(*,20) 10, 20, 30 ! { dg-output "\\+10 20\\+30(\n|\r\n|\r)" }
+ write(*,30) 10, 20, 30 ! { dg-output "\\+10 20 30(\n|\r\n|\r)" }
+ write(*,40) 0 ! { dg-output " \\+0(\n|\r\n|\r)" }
+C 15.5.9 - Note 5: When SP editing is in effect, the plus sign is not optional
+ write(*,50) 11 ! { dg-output "\\*\\*(\n|\r\n|\r)" }
+C { dg-output "\$" }
+ end
--- /dev/null Wed Feb 6 23:41:58 2002
+++ g77.dg/f77-edit-slash-out.f Wed Feb 6 23:17:15 2002
@@ -0,0 +1,9 @@
+C Test Fortran 77 colon slash descriptor
+C (ANSI X3.9-1978 Section 13.5.4)
+C
+C Origin: David Billinghurst <David.Billinghurst@riotinto.com>
+C
+C { dg-do run }
+C { dg-output "^123(\n|\r\n|\r)45(\n|\r\n|\r)\$" }
+ write(*,'(3(I1)/2(I1))') (I,I=1,5)
+ end
--- /dev/null Wed Feb 6 23:41:58 2002
+++ g77.dg/f77-edit-t-in.f Mon Feb 4 01:23:08 2002
@@ -0,0 +1,31 @@
+C Test Fortran 77 T edit descriptor for input
+C (ANSI X3.9-1978 Section 13.5.3.2)
+C
+C Origin: David Billinghurst <David.Billinghurst@riotinto.com>
+C
+C { dg-do run }
+ integer i,j
+ real a,b,c,d,e
+ character*32 in
+
+ in = '1234 8'
+ read(in,'(T3,I1)') i
+ if ( i.ne.3 ) call abort()
+ read(in,'(5X,TL4,I2)') i
+ if ( i.ne.23 ) call abort()
+ read(in,'(3X,I1,TR3,I1)') i,j
+ if ( i.ne.4 ) call abort()
+ if ( j.ne.8 ) call abort()
+
+ in = ' 1.5 -12.62 348.75 1.0E-6'
+ 100 format(F6.0,TL6,I4,1X,I1,8X,I5,F3.0,T10,F5.0,T17,F6.0,TR2,F6.0)
+ read(in,100) a,i,j,k,b,c,d,e
+ if ( abs(a-1.5).gt.1.0e-5 ) call abort()
+ if ( i.ne.1 ) call abort()
+ if ( j.ne.5 ) call abort()
+ if ( k.ne.348 ) call abort()
+ if ( abs(b-0.75).gt.1.0e-5 ) call abort()
+ if ( abs(c-12.62).gt.1.0e-5 ) call abort()
+ if ( abs(d-348.75).gt.1.0e-4 ) call abort()
+ if ( abs(e-1.0e-6).gt.1.0e-11 ) call abort()
+ end
--- /dev/null Wed Feb 6 23:41:58 2002
+++ g77.dg/f77-edit-t-out.f Wed Feb 6 23:22:52 2002
@@ -0,0 +1,12 @@
+C Test Fortran 77 T edit descriptor
+C (ANSI X3.9-1978 Section 13.5.3.2)
+C
+C Origin: David Billinghurst <David.Billinghurst@riotinto.com>
+C
+C { dg-do run }
+C ( dg-output "^" }
+ write(*,'(I4,T8,I1)') 1234,8 ! { dg-output "1234 8(\n|\r\n|\r)" }
+ write(*,'(I4,TR3,I1)') 1234,8 ! { dg-output "1234 8(\n|\r\n|\r)" }
+ write(*,'(I4,5X,TL2,I1)') 1234,8 ! { dg-output "1234 8(\n|\r\n|\r)" }
+C ( dg-output "\$" }
+ end
--- /dev/null Wed Feb 6 23:41:58 2002
+++ g77.dg/f77-edit-x-out.f Wed Feb 6 23:26:51 2002
@@ -0,0 +1,12 @@
+C Test Fortran 77 X descriptor
+C (ANSI X3.9-1978 Section 13.5.3.2)
+C
+C Origin: David Billinghurst <David.Billinghurst@riotinto.com>
+C
+C { dg-do run }
+C ( dg-output "^" }
+ write(*,'(I1,1X,I1,2X,I1)') 1,2,3 ! { dg-output "1 2 3(\n|\r\n|\r)" }
+C Section 13.5.3 explains why there are no trailing blanks
+ write(*,'(I1,1X,I1,2X,I1,3X)') 1,2,3 ! { dg-output "1 2 3(\n|\r\n|\r)" }
+C { dg-output "\$" }
+ end
--- /dev/null Wed Feb 6 23:51:35 2002
+++ g77.dg/f77-edit-h-out.f Wed Feb 6 23:35:42 2002
@@ -0,0 +1,14 @@
+C Test Fortran 77 H edit descriptor
+C (ANSI X3.9-1978 Section 13.5.2)
+C
+C Origin: David Billinghurst <David.Billinghurst@riotinto.com>
+C
+C { dg-do run }
+C { dg-output "^" }
+ 10 format(1H1)
+ 20 format(6H 6)
+ write(*,10) ! { dg-output "1(\n|\r\n|\r)" }
+ write(*,20) ! { dg-output " 6(\n|\r\n|\r)" }
+ write(*,'(16H''apostrophe'' fun)') ! { dg-output "'apostrophe' fun(\n|\r\n|\r)" }
+C { dg-output "\$" }
+ end