File tree 2 files changed +25
-0
lines changed
2 files changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -111,8 +111,24 @@ module regex_module
111
111
module procedure re_matchp_nolength_noback
112
112
end interface regex
113
113
114
+ ! Override default constructor for ifort bug
115
+ interface regex_token
116
+ module procedure pat_from_char
117
+ end interface regex_token
118
+
119
+
114
120
contains
115
121
122
+ ! Construct a regex pattern from a single character
123
+ elemental type (regex_token) function pat_from_char(type,ccl) result(this)
124
+ integer , intent (in ) :: type
125
+ character (kind= RCK), intent (in ) :: ccl
126
+ call pat_destroy(this)
127
+ this% type = type
128
+ allocate (character (len= 1 ,kind= RCK) :: this% ccl)
129
+ this% ccl(1 :1 ) = ccl
130
+ end function pat_from_char
131
+
116
132
! Check that a pattern matches the expected result
117
133
logical function check_pattern (string ,pattern ,expected ) result(success)
118
134
character (len=* ,kind= RCK), intent (in ) :: string
Original file line number Diff line number Diff line change @@ -32,6 +32,7 @@ program tests
32
32
call add_test(test_bracket_space())
33
33
call add_test(test_end_anchor())
34
34
call add_test(test_end_anchor2())
35
+ call add_test(test_read_version())
35
36
36
37
! Test #2
37
38
call add_test(run_test2())
@@ -122,4 +123,12 @@ logical function test_end_anchor2() result(success)
122
123
123
124
end function test_end_anchor2
124
125
126
+ logical function test_read_version () result(success)
127
+ character (* ), parameter :: &
128
+ text = ' Intel(R) MPI Library 2021.8 for Linux*Copyright Intel Corporation.ifort version 2021.8.0'
129
+
130
+ success = check_pattern(text,' \d+\.\d+\.\d+' ,expected= " 2021.8.0" )
131
+
132
+ end function test_read_version
133
+
125
134
end program tests
You can’t perform that action at this time.
0 commit comments