| Directory: | ./ |
|---|---|
| File: | misc/assert_m.f90 |
| Date: | 2022-01-11 19:19:34 |
| Exec | Total | Coverage | |
|---|---|---|---|
| Lines: | 9 | 35 | 25.7% |
| Branches: | 8 | 28 | 28.6% |
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | ! $Id$ | ||
| 2 | MODULE assert_m | ||
| 3 | |||
| 4 | implicit none | ||
| 5 | |||
| 6 | INTERFACE assert | ||
| 7 | MODULE PROCEDURE assert1,assert2,assert3,assert4,assert_v | ||
| 8 | END INTERFACE | ||
| 9 | |||
| 10 | private assert1,assert2,assert3,assert4,assert_v | ||
| 11 | |||
| 12 | CONTAINS | ||
| 13 | |||
| 14 | 9 | SUBROUTINE assert1(n1,string) | |
| 15 | CHARACTER(LEN=*), INTENT(IN) :: string | ||
| 16 | LOGICAL, INTENT(IN) :: n1 | ||
| 17 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 9 times.
|
9 | if (.not. n1) then |
| 18 | ✗ | write (*,*) 'nrerror: an assertion failed with this tag:', & | |
| 19 | ✗ | string | |
| 20 | ✗ | print *, 'program terminated by assert1' | |
| 21 | ✗ | stop 1 | |
| 22 | end if | ||
| 23 | 9 | END SUBROUTINE assert1 | |
| 24 | !BL | ||
| 25 | 120 | SUBROUTINE assert2(n1,n2,string) | |
| 26 | CHARACTER(LEN=*), INTENT(IN) :: string | ||
| 27 | LOGICAL, INTENT(IN) :: n1,n2 | ||
| 28 |
2/4✓ Branch 0 taken 120 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 120 times.
|
120 | if (.not. (n1 .and. n2)) then |
| 29 | ✗ | write (*,*) 'nrerror: an assertion failed with this tag:', & | |
| 30 | ✗ | string | |
| 31 | ✗ | print *, 'program terminated by assert2' | |
| 32 | ✗ | stop 1 | |
| 33 | end if | ||
| 34 | 120 | END SUBROUTINE assert2 | |
| 35 | !BL | ||
| 36 | ✗ | SUBROUTINE assert3(n1,n2,n3,string) | |
| 37 | CHARACTER(LEN=*), INTENT(IN) :: string | ||
| 38 | LOGICAL, INTENT(IN) :: n1,n2,n3 | ||
| 39 | ✗ | if (.not. (n1 .and. n2 .and. n3)) then | |
| 40 | ✗ | write (*,*) 'nrerror: an assertion failed with this tag:', & | |
| 41 | ✗ | string | |
| 42 | ✗ | print *, 'program terminated by assert3' | |
| 43 | ✗ | stop 1 | |
| 44 | end if | ||
| 45 | ✗ | END SUBROUTINE assert3 | |
| 46 | !BL | ||
| 47 | ✗ | SUBROUTINE assert4(n1,n2,n3,n4,string) | |
| 48 | CHARACTER(LEN=*), INTENT(IN) :: string | ||
| 49 | LOGICAL, INTENT(IN) :: n1,n2,n3,n4 | ||
| 50 | ✗ | if (.not. (n1 .and. n2 .and. n3 .and. n4)) then | |
| 51 | ✗ | write (*,*) 'nrerror: an assertion failed with this tag:', & | |
| 52 | ✗ | string | |
| 53 | ✗ | print *, 'program terminated by assert4' | |
| 54 | ✗ | stop 1 | |
| 55 | end if | ||
| 56 | ✗ | END SUBROUTINE assert4 | |
| 57 | !BL | ||
| 58 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1445 times.
|
1445 | SUBROUTINE assert_v(n,string) |
| 59 | CHARACTER(LEN=*), INTENT(IN) :: string | ||
| 60 | LOGICAL, DIMENSION(:), INTENT(IN) :: n | ||
| 61 |
4/6✓ Branch 0 taken 486250 times.
✓ Branch 1 taken 1445 times.
✓ Branch 2 taken 486250 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1445 times.
|
487695 | if (.not. all(n)) then |
| 62 | ✗ | write (*,*) 'nrerror: an assertion failed with this tag:', & | |
| 63 | ✗ | string | |
| 64 | ✗ | print *, 'program terminated by assert_v' | |
| 65 | ✗ | stop 1 | |
| 66 | end if | ||
| 67 | 1445 | END SUBROUTINE assert_v | |
| 68 | |||
| 69 | END MODULE assert_m | ||
| 70 |