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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.2.2/] [gcc/] [testsuite/] [gfortran.dg/] [fgetc_1.f90] - Diff between revs 149 and 154

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 149 Rev 154
! Testcase for the FGETC and FPUTC intrinsics
! Testcase for the FGETC and FPUTC intrinsics
! { dg-do run }
! { dg-do run }
  character(len=5) s
  character(len=5) s
  integer st
  integer st
  s = "12345"
  s = "12345"
  open(10,status="scratch")
  open(10,status="scratch")
  write(10,"(A)") "abcde"
  write(10,"(A)") "abcde"
  rewind(10)
  rewind(10)
  call fgetc(10,s,st)
  call fgetc(10,s,st)
  if ((st /= 0) .or. (s /= "a    ")) call abort
  if ((st /= 0) .or. (s /= "a    ")) call abort
  call fgetc(10,s,st)
  call fgetc(10,s,st)
  close(10)
  close(10)
  open(10,status="scratch")
  open(10,status="scratch")
  s = "12345"
  s = "12345"
  call fputc(10,s,st)
  call fputc(10,s,st)
  if (st /= 0) call abort
  if (st /= 0) call abort
  call fputc(10,"2",st)
  call fputc(10,"2",st)
  if (st /= 0) call abort
  if (st /= 0) call abort
  call fputc(10,"3 ",st)
  call fputc(10,"3 ",st)
  if (st /= 0) call abort
  if (st /= 0) call abort
  rewind(10)
  rewind(10)
  call fgetc(10,s)
  call fgetc(10,s)
  if (s(1:1) /= "1") call abort
  if (s(1:1) /= "1") call abort
  call fgetc(10,s)
  call fgetc(10,s)
  if (s(1:1) /= "2") call abort
  if (s(1:1) /= "2") call abort
  call fgetc(10,s,st)
  call fgetc(10,s,st)
  if ((s(1:1) /= "3") .or. (st /= 0)) call abort
  if ((s(1:1) /= "3") .or. (st /= 0)) call abort
  call fgetc(10,s,st)
  call fgetc(10,s,st)
  if (st /= -1) call abort
  if (st /= -1) call abort
  close (10)
  close (10)
! FGETC and FPUTC on units not opened should not work
! FGETC and FPUTC on units not opened should not work
  call fgetc(12,s,st)
  call fgetc(12,s,st)
  if (st /= -1) call abort
  if (st /= -1) call abort
  call fputc(12,s,st)
  call fputc(12,s,st)
  if (st /= -1) call abort
  if (st /= -1) call abort
  end
  end
 
 

powered by: WebSVN 2.1.0

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