@@ -68,39 +68,30 @@ pure subroutine assert_error_stop_interface(stop_code_char)
68
68
#endif
69
69
logical , parameter :: enforce_assertions= USE_ASSERTIONS
70
70
71
- interface
72
71
73
- pure module subroutine assert(assertion, description)
72
+ contains
73
+
74
+ pure subroutine assert (assertion , description )
74
75
! ! If assertion is .false. and enforcement is enabled (e.g. via -DASSERTIONS=1),
75
76
! ! then error-terminate with a character stop code that contains the description argument if present
76
77
implicit none
77
78
logical , intent (in ) :: assertion
78
79
! ! Most assertions will be expressions such as i>0
79
80
character (len=* ), intent (in ) :: description
80
81
! ! A brief statement of what is being asserted such as "i>0" or "positive i"
81
- end subroutine
82
-
83
- pure module subroutine assert_always(assertion, description)
84
- ! ! Same as above but always enforces the assertion (regardless of ASSERTIONS)
85
- implicit none
86
- logical , intent (in ) :: assertion
87
- character (len=* ), intent (in ) :: description
88
- end subroutine
89
-
90
- end interface
91
-
92
- contains
93
-
94
- module procedure assert
95
82
96
83
toggle_assertions: &
97
84
if (enforce_assertions) then
98
85
call assert_always(assertion, description)
99
86
end if toggle_assertions
100
87
101
- end procedure
88
+ end subroutine
102
89
103
- module procedure assert_always
90
+ pure module subroutine assert_always(assertion, description)
91
+ ! ! Same as above but always enforces the assertion (regardless of ASSERTIONS)
92
+ implicit none
93
+ logical , intent (in ) :: assertion
94
+ character (len=* ), intent (in ) :: description
104
95
character (len= :), allocatable :: message
105
96
integer me
106
97
@@ -153,7 +144,7 @@ pure function string(numeric) result(number_as_string)
153
144
154
145
end function string
155
146
156
- end procedure
147
+ end subroutine
157
148
158
149
end module assert_subroutine_m
159
150
0 commit comments