@@ -163,27 +163,34 @@ subroutine test_slice_string
163
163
end subroutine test_slice_string
164
164
165
165
subroutine test_find
166
- type (string_type) :: test_string, test_pattern
167
- test_string = " qwqwqwqwqwqwqw"
168
- test_pattern = " qwq"
169
- call check(find(test_string, test_pattern, 4 ) == 7 , &
170
- & ' Find: test_string, test_pattern, 4' )
171
- call check(find(test_string, test_pattern, 3 , .false. ) == 9 , &
172
- & ' Find: test_string, test_pattern, 3' )
173
- call check(find(test_string, test_pattern, 7 ) == 0 , &
174
- & ' Find: test_string, test_pattern, 7' )
175
- call check(find(" qwqwqwqwqwqwqw" , test_pattern) == 1 , &
176
- & ' Find: "qwqwqwqwqwqwqw", test_pattern' )
177
- call check(find(test_string, " qwq" , 2 ) == 3 , &
178
- & ' Find: test_string, "qwq", 2' )
166
+ type (string_type) :: test_string_1, test_string_2, test_pattern_1, test_pattern_2
167
+ test_string_1 = " qwqwqwqwqwqwqw"
168
+ test_string_2 = " abccbabccbabc"
169
+ test_pattern_1 = " qwq"
170
+ test_pattern_2 = " abccbabc"
171
+
172
+ call check(all (find([test_string_1, test_string_2], test_pattern_1, 4 ) == [7 , 0 ]), &
173
+ & ' Find: [test_string_1, test_string_2], test_pattern_1, 4' )
174
+ call check(all (find(test_string_1, [test_pattern_1, test_pattern_2], 3 , .false. ) == [9 , 0 ]), &
175
+ & ' Find: test_string_1, [test_pattern_1, test_pattern_2], 3, .false.' )
176
+ call check(find(test_string_1, test_pattern_1, 7 ) == 0 , &
177
+ & ' Find: test_string_1, test_pattern_1, 7' )
178
+ call check(all (find([test_string_1, test_string_2, test_string_2], [test_pattern_1, &
179
+ & test_pattern_2, test_pattern_2], [7 , 2 , 2 ], [.true. , .false. , .true. ]) == [0 , 0 , 6 ]), &
180
+ & ' Find: [test_string_1, test_string_2, test_string_2], [test_pattern_1, &
181
+ & test_pattern_2, test_pattern_2], [7, 2, 2], [.true., .false., .true.]' )
182
+ call check(find(" qwqwqwqwqwqwqw" , test_pattern_1) == 1 , &
183
+ & ' Find: "qwqwqwqwqwqwqw", test_pattern_1' )
184
+ call check(all (find(test_string_1, [" qwq" , " wqw" ], 2 ) == [3 , 4 ]), &
185
+ & ' Find: test_string_1, ["qwq", "wqw"], 2' )
179
186
call check(find(" qwqwqwqwqwqwqw" , " qwq" , 2 , .false. ) == 5 , &
180
187
& ' Find: "qwqwqwqwqwqwqw", "qwq", 2, .false.' )
181
188
call check(find(" " , " " ) == 0 , &
182
189
& ' Find: "", ""' )
183
- call check(find(" " , test_pattern ) == 0 , &
184
- & ' Find: "", test_pattern ' )
185
- call check(find(test_string , " " ) == 0 , &
186
- & ' Find: test_string , ""' )
190
+ call check(find(" " , test_pattern_1 ) == 0 , &
191
+ & ' Find: "", test_pattern_1 ' )
192
+ call check(find(test_string_1 , " " ) == 0 , &
193
+ & ' Find: test_string_1 , ""' )
187
194
188
195
end subroutine test_find
189
196
0 commit comments