2 !TODO: Move these testcases to gfortran testsuite
3 ! once compilation with pthreads is supported there
4 ! Check basic functionality of async I/O
7 integer:: i
=1, j
=2, k
, l
9 character(3), parameter:: yes
="yes"
12 integer, dimension(4):: is
= [0, 1, 2, 3]
13 integer, dimension(4):: res
16 open (10, file
='a.dat', asynchronous
=yes
)
18 inquire (10,asynchronous
=inq
)
19 if (inq
/= "YES") stop 1
20 write (10,*,asynchronous
=yes
) 4, 3
21 write (10,*,asynchronous
=yes
) 2, 1
22 write (10,*,asynchronous
=yes
) 1.0, 3.0
23 write (10,'(A)', asynchronous
=yes
) 'asdf'
24 write (10,*, asynchronous
=yes
) cc
26 open (20, file
='a.dat', asynchronous
=yes
)
27 read (20, *, asynchronous
=yes
) i
, j
28 read (20, *, asynchronous
=yes
) k
, l
29 read (20, *, asynchronous
=yes
) a
, b
30 read (20,'(A4)',asynchronous
=yes
) str
31 read (20,*, asynchronous
=yes
) dd
33 if (i
/= 4 .or
. j
/= 3) stop 2
34 if (k
/= 2 .or
. l
/= 1) stop 3
35 if (a
/= 1.0 .or
. b
/= 3.0) stop 4
36 if (str
/= 'asdf') stop 5
38 close (20,status
="delete")
40 open(10, file
='c.dat', asynchronous
=yes
)
41 write(10, *, asynchronous
=yes
) is
43 open(20, file
='c.dat', asynchronous
=yes
)
44 read(20, *, asynchronous
=yes
) res
46 if (any(res
/= is
)) stop 7
47 close (20,status
="delete")