OSDN Git Service

2006-09-15 Jerry DeLisle <jvdelisle@gcc.gnu.org>
authorjvdelisle <jvdelisle@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 15 Sep 2006 13:32:12 +0000 (13:32 +0000)
committerjvdelisle <jvdelisle@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 15 Sep 2006 13:32:12 +0000 (13:32 +0000)
PR libgfortran/29053
* gfortran.dg/streamio_9.f90: New test.
* gfortran.dg/streamio_10.f90: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@116971 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/streamio_10.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/streamio_9.f90 [new file with mode: 0644]

index fd06af6..cc431da 100644 (file)
@@ -1,3 +1,9 @@
+2006-09-15  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
+
+       PR libgfortran/29053
+       * gfortran.dg/streamio_9.f90: New test.
+       * gfortran.dg/streamio_10.f90: New test.
+
 2006-09-14  Andrew Pinski  <pinskia@physics.uc.edu>
 
        PR C++/29002
diff --git a/gcc/testsuite/gfortran.dg/streamio_10.f90 b/gcc/testsuite/gfortran.dg/streamio_10.f90
new file mode 100644 (file)
index 0000000..e49617e
--- /dev/null
@@ -0,0 +1,37 @@
+! { dg-do run }
+! PR25093 Stream IO test 10
+! Contributed by Jerry DeLisle <jvdelisle@gcc.gnu.org>.
+! Test case derived from that given in PR by Steve Kargl.
+program stream_io_10
+  implicit none
+  integer :: a(4), b(4)
+  integer(kind=8) :: thepos
+  a = (/ 1, 2, 3, 4 /)
+  b = a
+  open(10, file="teststream", access="stream")
+  write(10) a
+  inquire(10, pos=thepos)
+  if (thepos.ne.17) call abort()
+
+  read(10, pos=1)
+  inquire(10, pos=thepos)
+  if (thepos.ne.1) call abort()
+
+  write(10, pos=15)
+  inquire(10, pos=thepos)
+  if (thepos.ne.15) call abort()
+
+  read(10, pos=3)
+  inquire(10, pos=thepos)
+  if (thepos.ne.3) call abort()
+
+  write(10, pos=1)
+  inquire(10, pos=thepos)
+  if (thepos.ne.1) call abort()
+
+  a = 0
+  read(10) a
+  if (any(a /= b)) call abort()
+
+  close(10, status="delete")
+end program stream_io_10
diff --git a/gcc/testsuite/gfortran.dg/streamio_9.f90 b/gcc/testsuite/gfortran.dg/streamio_9.f90
new file mode 100644 (file)
index 0000000..150c1c6
--- /dev/null
@@ -0,0 +1,31 @@
+! { dg-do run }
+! PR29053 Stream IO test 9.
+! Contributed by Jerry DeLisle <jvdelisle@gcc.gnu.org>.
+! Test case derived from that given in PR by Steve Kargl.
+program pr29053
+   implicit none
+   real dt, t, u, a(10), b(10)
+   integer i, place
+   dt = 1.e-6
+   a = real( (/ (i, i=1, 10) /) )
+   b = a
+   open(unit=11, file='a.dat', access='stream')
+   open(unit=12, file='b.dat', access='stream')
+   do i = 1, 10
+      t = i * dt
+      write(11) t
+      write(12) a
+   end do
+   rewind(11)
+   rewind(12)
+   do i = 1, 10
+      t = i * dt
+      read(12) a
+      if (any(a.ne.b)) call abort()
+      read(11) u
+      if (u.ne.t) call abort()
+   end do
+   close(11, status="delete")
+   close(12, status="delete")
+end program pr29053
+