File: arrays_intrin_02.f90

package info (click to toggle)
lfortran 0.45.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 46,332 kB
  • sloc: cpp: 137,068; f90: 51,260; python: 6,444; ansic: 4,277; yacc: 2,285; fortran: 806; sh: 524; makefile: 30; javascript: 15
file content (28 lines) | stat: -rw-r--r-- 971 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
26
27
28
program arrays_intrin_02
  logical l1(3), l2(3), l3(3)
  integer m1(2,3), m2(2,3)
  l1 = [.true., .true., .true.]
  l2 = [.true., .true., .false.]
  l3 = [.false., .false., .false.]
  if (.not. all(l1)) error stop
  if (all(l2)) error stop
  if (all(l3)) error stop
  if (.not. any(l1)) error stop
  if (.not. any(l2)) error stop
  if (any(l3)) error stop
  m1 = 1 
  m2 = 1
  m2(1,2) = 2
  m2(2,2) = 2
  call matrixCheck(m1, m2)
  contains
    subroutine matrixCheck(m1, m2)
      integer, intent(in) :: m1(2,3), m2(2,3)
      if (all(m1 == m2)) error stop
      if (.not. all(all(m1 == m2, 1) .eqv. [.true., .false., .true.])) error stop
      if (.not. all(all(m1 == m2, 2) .eqv. [.false., .false.])) error stop
      if (.not. any(m1 == m2)) error stop
      if (.not. all(any(m1 == m2, 1) .eqv. [.true., .false., .true.])) error stop
      if (.not. all(any(m1 == m2, 2) .eqv. [.true., .true.])) error stop
    end subroutine matrixCheck
end program arrays_intrin_02