aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/fgetc_3.f90
blob: 3706b67a81fc0fcd99ad17c14adcd365697da6f2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
! Testcase for the FGETC and FPUTC intrinsics
! { dg-do compile }
  character(len=5) s
  integer st

  s = "12345"
  open(status="scratch")
  write(*,"(A)") "abcde"
  rewind(10)
  st = fget(s)
  if ((st /= 0) .or. (s /= "a    ")) call abort
  st = fget(s)
  close(10)

  open(status="scratch")
  s = "12345"
  st = fput(s)
  if (st /= 0) call abort
  st = fput("2")
  if (st /= 0) call abort
  st = fput("3 ")
  if (st /= 0) call abort
  rewind(10)
  st = fget(s)
  if (s(1:1) /= "1") call abort
  st = fget(s)
  if (s(1:1) /= "2") call abort
  st = fget(s)
  if ((s(1:1) /= "3") .or. (st /= 0)) call abort
  st = fget(s)
  if (st /= -1) call abort
  close (10)

  end