File: read_08.f90

package info (click to toggle)
lfortran 0.60.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 58,412 kB
  • sloc: cpp: 173,406; f90: 80,491; python: 17,586; ansic: 9,610; yacc: 2,356; sh: 1,401; fortran: 895; makefile: 37; javascript: 15
file content (25 lines) | stat: -rw-r--r-- 620 bytes parent folder | download
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
program read_08
    ! Test reading logical values with T/F format
    implicit none
    logical :: val1, val2, val3, val4

    open(10, status='scratch')
    write(10, '(A)') 'T'
    write(10, '(A)') 'F'
    write(10, '(A)') 't'
    write(10, '(A)') 'f'
    rewind(10)

    read(10, *) val1
    read(10, *) val2
    read(10, *) val3
    read(10, *) val4
    close(10)

    if (.not. val1) error stop "Expected T to be .true."
    if (val2) error stop "Expected F to be .false."
    if (.not. val3) error stop "Expected t to be .true."
    if (val4) error stop "Expected f to be .false."

    print *, "PASS"
end program