1 | MODULE assert_eq_m |
---|
2 | |
---|
3 | implicit none |
---|
4 | |
---|
5 | INTERFACE assert_eq |
---|
6 | MODULE PROCEDURE assert_eq2,assert_eq3,assert_eq4,assert_eqn |
---|
7 | END INTERFACE |
---|
8 | |
---|
9 | private assert_eq2,assert_eq3,assert_eq4,assert_eqn |
---|
10 | |
---|
11 | CONTAINS |
---|
12 | |
---|
13 | FUNCTION assert_eq2(n1,n2,string) |
---|
14 | CHARACTER(LEN=*), INTENT(IN) :: string |
---|
15 | INTEGER, INTENT(IN) :: n1,n2 |
---|
16 | INTEGER assert_eq2 |
---|
17 | if (n1 == n2) then |
---|
18 | assert_eq2=n1 |
---|
19 | else |
---|
20 | write (*,*) 'nrerror: an assert_eq failed with this tag: ', & |
---|
21 | string |
---|
22 | print *, 'program terminated by assert_eq2' |
---|
23 | stop 1 |
---|
24 | end if |
---|
25 | END FUNCTION assert_eq2 |
---|
26 | !BL |
---|
27 | FUNCTION assert_eq3(n1,n2,n3,string) |
---|
28 | CHARACTER(LEN=*), INTENT(IN) :: string |
---|
29 | INTEGER, INTENT(IN) :: n1,n2,n3 |
---|
30 | INTEGER assert_eq3 |
---|
31 | if (n1 == n2 .and. n2 == n3) then |
---|
32 | assert_eq3=n1 |
---|
33 | else |
---|
34 | write (*,*) 'nrerror: an assert_eq failed with this tag: ', & |
---|
35 | string |
---|
36 | print *, 'program terminated by assert_eq3' |
---|
37 | stop 1 |
---|
38 | end if |
---|
39 | END FUNCTION assert_eq3 |
---|
40 | !BL |
---|
41 | FUNCTION assert_eq4(n1,n2,n3,n4,string) |
---|
42 | CHARACTER(LEN=*), INTENT(IN) :: string |
---|
43 | INTEGER, INTENT(IN) :: n1,n2,n3,n4 |
---|
44 | INTEGER assert_eq4 |
---|
45 | if (n1 == n2 .and. n2 == n3 .and. n3 == n4) then |
---|
46 | assert_eq4=n1 |
---|
47 | else |
---|
48 | write (*,*) 'nrerror: an assert_eq failed with this tag: ', & |
---|
49 | string |
---|
50 | print *, 'program terminated by assert_eq4' |
---|
51 | stop 1 |
---|
52 | end if |
---|
53 | END FUNCTION assert_eq4 |
---|
54 | !BL |
---|
55 | FUNCTION assert_eqn(nn,string) |
---|
56 | CHARACTER(LEN=*), INTENT(IN) :: string |
---|
57 | INTEGER, DIMENSION(:), INTENT(IN) :: nn |
---|
58 | INTEGER assert_eqn |
---|
59 | if (all(nn(2:) == nn(1))) then |
---|
60 | assert_eqn=nn(1) |
---|
61 | else |
---|
62 | write (*,*) 'nrerror: an assert_eq failed with this tag: ', & |
---|
63 | string |
---|
64 | print *, 'program terminated by assert_eqn' |
---|
65 | stop 1 |
---|
66 | end if |
---|
67 | END FUNCTION assert_eqn |
---|
68 | |
---|
69 | END MODULE assert_eq_m |
---|