OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [gfortran.dg/] [streamio_11.f90] - Blame information for rev 823

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 jeremybenn
! { dg-do run }
2
! PR29277 Stream IO test 11, tests formatted form.
3
! Contributed by Tobias Burnas.
4
program stream_test
5
    implicit none
6
    character(len=*), parameter :: rec1 = 'record1'
7
    character(len=*), parameter :: rec2 = 'record2'
8
    character(len=50) :: str1,str2
9
    integer           :: len, i
10
    real              :: r
11
 
12
    open(10,form='formatted',access='stream',&
13
         status='scratch',position='rewind')
14
    write(10,'(a)') rec1//new_line('a')//rec2
15
    rewind(10)
16
    read(10,*) str1
17
    read(10,*) str2
18
    if(str1 /= rec1 .or. str2 /= rec2) call abort()
19
    rewind(10)
20
    read(10,'(a)') str1
21
    read(10,'(a)') str2
22
    if(str1 /= rec1 .or. str2 /= rec2) call abort()
23
    close(10)
24
 
25
    open(10,form='formatted',access='stream',&
26
         status='scratch',position='rewind')
27
    write(10,*) '123 '//trim(rec1)//'  1e-12'
28
    write(10,*) '12345.6789'
29
    rewind(10)
30
    read(10,*) i,str1
31
    read(10,*) r
32
    if(i /= 123 .or. str1 /= rec1 .or. r /= 12345.6789) &
33
      call abort()
34
    close(10)
35
 
36
    open(unit=10,form='unformatted',access='stream', &
37
         status='scratch',position='rewind')
38
    write(10) rec1//new_line('a')//rec2
39
    len = len_trim(rec1//new_line('a')//rec2)
40
    rewind(10)
41
    read(10) str1(1:len)
42
    if(str1 /= rec1//new_line('a')//rec2) call abort()
43
end program stream_test

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.