OSDN Git Service

2010-06-07 Tobias Burnus <burnus@net-b.de>
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gfortran.dg / f2003_io_7.f03
1 ! { dg-do run }
2 ! Test case prepared by Jerry DeLisle  <jvdelisle@gcc.gnu.org>
3 ! Test of sign=, decimal=, and blank= .
4 program iotests
5   implicit none
6   character(len=45) :: a
7   character(len=4) :: mode = "what"
8   real, parameter :: pi = 3.14159265358979323846
9   real(kind=8), dimension(3) :: b
10   !
11   write(a,'(f10.3,s,f10.3,sp,f10.3,ss,f10.3)',SIGN='PLUS') pi, pi, pi, pi
12   if (a /= "    +3.142     3.142    +3.142     3.142") call abort
13   !
14   open(8,sign="plus")
15   write(8,'(f10.3,dc,f10.3,dp,f10.3)',DECIMAL='COMMA',&
16         & sign="suppress") pi, pi, pi
17   rewind(8)
18   read(8,'(a)') a
19   if (a /= "     3,142     3,142     3.142") call abort
20   close(8,status="delete")
21   !
22   !              "123456789 123456789  12345678901
23   write(a,'(a)') "53 256.84, 2 2 2.  ; 33.3 3   1  "
24   read(a, '(f9.2,1x,f8.2,2x,f11.7)', blank="zero") b(1),b(2),b(3)
25   if (any(abs(b - [530256.84, 20202.00, 33.3030001]) > .03)) call abort
26 end program iotests
27