Skip to content

Commit 7035422

Browse files
committed
changed Replace_all to replace_all, Find to find and Slice to slice
1 parent 8873624 commit 7035422

File tree

1 file changed

+65
-65
lines changed

1 file changed

+65
-65
lines changed

src/tests/string/test_string_functions.f90

Lines changed: 65 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -63,102 +63,102 @@ subroutine test_slice_string
6363
! Only one argument is given
6464
! Valid
6565
call check(slice(test_string, first=10) == "jklmnopqrstuvwxyz", &
66-
"Slice, Valid arguments: first=10") ! last=+inf
66+
"slice, Valid arguments: first=10") ! last=+inf
6767
call check(slice(test_string, last=10) == "abcdefghij", &
68-
"Slice, Valid arguments: last=10") ! first=-inf
68+
"slice, Valid arguments: last=10") ! first=-inf
6969
call check(slice(test_string, stride=3) == "adgjmpsvy", &
70-
"Slice, Valid arguments: stride=3") ! first=-inf, last=+inf
70+
"slice, Valid arguments: stride=3") ! first=-inf, last=+inf
7171
call check(slice(test_string, stride=-3) == "zwtqnkheb", &
72-
"Slice, Valid arguments: stride=-3") ! first=+inf, last=-inf
72+
"slice, Valid arguments: stride=-3") ! first=+inf, last=-inf
7373

7474
! Invalid
7575
call check(slice(test_string, first=27) == "", &
76-
"Slice, Invalid arguments: first=27") ! last=+inf
76+
"slice, Invalid arguments: first=27") ! last=+inf
7777
call check(slice(test_string, first=-10) == "abcdefghijklmnopqrstuvwxyz", &
78-
"Slice, Invalid arguments: first=-10") ! last=+inf
78+
"slice, Invalid arguments: first=-10") ! last=+inf
7979
call check(slice(test_string, last=-2) == "", &
80-
"Slice, Invalid arguments: last=-2") ! first=-inf
80+
"slice, Invalid arguments: last=-2") ! first=-inf
8181
call check(slice(test_string, last=30) == "abcdefghijklmnopqrstuvwxyz", &
82-
"Slice, Invalid arguments: last=30") ! first=-inf
82+
"slice, Invalid arguments: last=30") ! first=-inf
8383
call check(slice(test_string, stride=0) == "abcdefghijklmnopqrstuvwxyz", &
84-
"Slice, Invalid arguments: stride=0") ! stride=1
84+
"slice, Invalid arguments: stride=0") ! stride=1
8585

8686
! Only two arguments are given
8787
! Valid
8888
call check(slice(test_string, first=10, last=20) == "jklmnopqrst", &
89-
"Slice, Valid arguments: first=10, last=20")
89+
"slice, Valid arguments: first=10, last=20")
9090
call check(slice(test_string, first=7, last=2) == "gfedcb", &
91-
"Slice, Valid arguments: first=7, last=2") ! stride=-1
91+
"slice, Valid arguments: first=7, last=2") ! stride=-1
9292
call check(slice(test_string, first=10, stride=-2) == "jhfdb", &
93-
"Slice, Valid arguments: first=10, stride=-2") ! last=-inf
93+
"slice, Valid arguments: first=10, stride=-2") ! last=-inf
9494
call check(slice(test_string, last=21, stride=-2) == "zxv", &
95-
"Slice, Valid arguments: last=21, stride=-2") ! first=+inf
95+
"slice, Valid arguments: last=21, stride=-2") ! first=+inf
9696

9797
! Atleast one argument is invalid
9898
call check(slice(test_string, first=30, last=-3) == "zyxwvutsrqponmlkjihgfedcba", &
99-
"Slice, Invalid arguments: first=30, last=-3")
99+
"slice, Invalid arguments: first=30, last=-3")
100100
call check(slice(test_string, first=1, last=-20) == "a", &
101-
"Slice, Invalid arguments: first=1, last=-20")
101+
"slice, Invalid arguments: first=1, last=-20")
102102
call check(slice(test_string, first=7, last=-10) == "gfedcba", &
103-
"Slice, Invalid arguments: first=7, last=-10")
103+
"slice, Invalid arguments: first=7, last=-10")
104104
call check(slice(test_string, first=500, last=22) == "zyxwv", &
105-
"Slice, Invalid arguments: first=500, last=22")
105+
"slice, Invalid arguments: first=500, last=22")
106106
call check(slice(test_string, first=50, last=27) == "", &
107-
"Slice, Invalid arguments: first=50, last=27")
107+
"slice, Invalid arguments: first=50, last=27")
108108
call check(slice(test_string, first=-20, last=0) == "", &
109-
"Slice, Invalid arguments: first=-20, last=0")
109+
"slice, Invalid arguments: first=-20, last=0")
110110
call check(slice(test_string, last=-3, stride=-2) == "zxvtrpnljhfdb", &
111-
"Slice, Invalid arguments: last=-3, stride=-2") ! first=+inf
111+
"slice, Invalid arguments: last=-3, stride=-2") ! first=+inf
112112
call check(slice(test_string, last=10, stride=0) == "abcdefghij", &
113-
"Slice, Invalid arguments: last=10, stride=0") ! stride=1
113+
"slice, Invalid arguments: last=10, stride=0") ! stride=1
114114
call check(slice(test_string, first=-2, stride=-2) == "", &
115-
"Slice, Invalid arguments: first=-2, stride=-2") ! last=-inf
115+
"slice, Invalid arguments: first=-2, stride=-2") ! last=-inf
116116
call check(slice(test_string, first=27, stride=2) == "", &
117-
"Slice, Invalid arguments: first=27, stride=2") ! last=+inf
117+
"slice, Invalid arguments: first=27, stride=2") ! last=+inf
118118
call check(slice(test_string, last=27, stride=-1) == "", &
119-
"Slice, Invalid arguments: last=27, stride=-1") ! first=+inf
119+
"slice, Invalid arguments: last=27, stride=-1") ! first=+inf
120120

121121
! All three arguments are given
122122
! Valid
123123
call check(slice(test_string, first=2, last=16, stride=3) == "behkn", &
124-
"Slice, Valid arguments: first=2, last=16, stride=3")
124+
"slice, Valid arguments: first=2, last=16, stride=3")
125125
call check(slice(test_string, first=16, last=2, stride=-3) == "pmjgd", &
126-
"Slice, Valid arguments: first=16, last=2, stride=-3")
126+
"slice, Valid arguments: first=16, last=2, stride=-3")
127127
call check(slice(test_string, first=7, last=7, stride=-4) == "g", &
128-
"Slice, Valid arguments: first=7, last=7, stride=-4")
128+
"slice, Valid arguments: first=7, last=7, stride=-4")
129129
call check(slice(test_string, first=7, last=7, stride=3) == "g", &
130-
"Slice, Valid arguments: first=7, last=7, stride=3")
130+
"slice, Valid arguments: first=7, last=7, stride=3")
131131
call check(slice(test_string, first=2, last=6, stride=-1) == "", &
132-
"Slice, Valid arguments: first=2, last=6, stride=-1")
132+
"slice, Valid arguments: first=2, last=6, stride=-1")
133133
call check(slice(test_string, first=20, last=10, stride=2) == "", &
134-
"Slice, Valid arguments: first=20, last=10, stride=2")
134+
"slice, Valid arguments: first=20, last=10, stride=2")
135135

136136
! Atleast one argument is invalid
137137
call check(slice(test_string, first=20, last=30, stride=2) == "tvxz", &
138-
"Slice, Invalid arguments: first=20, last=30, stride=2")
138+
"slice, Invalid arguments: first=20, last=30, stride=2")
139139
call check(slice(test_string, first=-20, last=30, stride=2) == "acegikmoqsuwy", &
140-
"Slice, Invalid arguments: first=-20, last=30, stride=2")
140+
"slice, Invalid arguments: first=-20, last=30, stride=2")
141141
call check(slice(test_string, first=26, last=30, stride=1) == "z", &
142-
"Slice, Invalid arguments: first=26, last=30, stride=1")
142+
"slice, Invalid arguments: first=26, last=30, stride=1")
143143
call check(slice(test_string, first=1, last=-20, stride=-1) == "a", &
144-
"Slice, Invalid arguments: first=1, last=-20, stride=-1")
144+
"slice, Invalid arguments: first=1, last=-20, stride=-1")
145145
call check(slice(test_string, first=26, last=20, stride=1) == "", &
146-
"Slice, Invalid arguments: first=26, last=20, stride=1")
146+
"slice, Invalid arguments: first=26, last=20, stride=1")
147147
call check(slice(test_string, first=1, last=20, stride=-1) == "", &
148-
"Slice, Invalid arguments: first=1, last=20, stride=-1")
148+
"slice, Invalid arguments: first=1, last=20, stride=-1")
149149

150150
test_string = ""
151151
! Empty string input
152152
call check(slice(test_string, first=-2, last=6) == "", &
153-
"Slice, Empty string: first=-2, last=6")
153+
"slice, Empty string: first=-2, last=6")
154154
call check(slice(test_string, first=6, last=-2) == "", &
155-
"Slice, Empty string: first=6, last=-2")
155+
"slice, Empty string: first=6, last=-2")
156156
call check(slice(test_string, first=-10) == "", &
157-
"Slice, Empty string: first=-10") ! last=+inf
157+
"slice, Empty string: first=-10") ! last=+inf
158158
call check(slice(test_string, last=10) == "", &
159-
"Slice, Empty string: last=10") ! first=-inf
159+
"slice, Empty string: last=10") ! first=-inf
160160
call check(slice(test_string) == "", &
161-
"Slice, Empty string: no arguments provided")
161+
"slice, Empty string: no arguments provided")
162162

163163
end subroutine test_slice_string
164164

@@ -170,27 +170,27 @@ subroutine test_find
170170
test_pattern_2 = "abccbabc"
171171

172172
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')
173+
& 'find: [test_string_1, test_string_2], test_pattern_1, 4')
174174
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.')
175+
& 'find: test_string_1, [test_pattern_1, test_pattern_2], 3, .false.')
176176
call check(find(test_string_1, test_pattern_1, 7) == 0, &
177-
& 'Find: test_string_1, test_pattern_1, 7')
177+
& 'find: test_string_1, test_pattern_1, 7')
178178
call check(all(find([test_string_1, test_string_2, test_string_2], [test_pattern_1, &
179179
& 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, &
180+
& 'find: [test_string_1, test_string_2, test_string_2], [test_pattern_1, &
181181
& test_pattern_2, test_pattern_2], [7, 2, 2], [.true., .false., .true.]')
182182
call check(find("qwqwqwqwqwqwqw", test_pattern_1) == 1, &
183-
& 'Find: "qwqwqwqwqwqwqw", test_pattern_1')
183+
& 'find: "qwqwqwqwqwqwqw", test_pattern_1')
184184
call check(all(find(test_string_1, ["qwq", "wqw"], 2) == [3, 4]), &
185-
& 'Find: test_string_1, ["qwq", "wqw"], 2')
185+
& 'find: test_string_1, ["qwq", "wqw"], 2')
186186
call check(find("qwqwqwqwqwqwqw", "qwq", 2, .false.) == 5, &
187-
& 'Find: "qwqwqwqwqwqwqw", "qwq", 2, .false.')
187+
& 'find: "qwqwqwqwqwqwqw", "qwq", 2, .false.')
188188
call check(find("", "") == 0, &
189-
& 'Find: "", ""')
189+
& 'find: "", ""')
190190
call check(find("", test_pattern_1) == 0, &
191-
& 'Find: "", test_pattern_1')
191+
& 'find: "", test_pattern_1')
192192
call check(find(test_string_1, "") == 0, &
193-
& 'Find: test_string_1, ""')
193+
& 'find: test_string_1, ""')
194194

195195
end subroutine test_find
196196

@@ -331,50 +331,50 @@ subroutine test_replace_all
331331
! all 3 as string_type
332332
call check(replace_all(test_string_1, test_pattern_1, test_replacement_1) == &
333333
& "mutate DNA sequence: GTATACGATAGCCGTAATATA", &
334-
& "Replace_all: all 3 string_type, test case 1")
334+
& "replace_all: all 3 string_type, test case 1")
335335
call check(replace_all(test_string_2, test_pattern_2, test_replacement_2) == &
336336
& "mutate DNA sequence: agaGAGCCTagaGagaG", &
337-
& "Replace_all: all 3 string_type, test case 2")
337+
& "replace_all: all 3 string_type, test case 2")
338338
call check(replace_all(test_string_2, test_pattern_2, test_replacement_1) == &
339339
& "mutate DNA sequence: ATAGAGCCTATAGATAG", &
340-
& "Replace_all: all 3 string_type, test case 3")
340+
& "replace_all: all 3 string_type, test case 3")
341341

342342
! 2 as string_type and 1 as character scalar
343343
call check(replace_all(test_string_1, "tat", test_replacement_1) == &
344344
& "muATAe DNA sequence: GTTATCGTATGCCGTAATTAT", &
345-
& "Replace_all: 2 string_type & 1 character scalar, test case 1")
345+
& "replace_all: 2 string_type & 1 character scalar, test case 1")
346346
call check(replace_all(test_string_2, test_pattern_2, "GC") == &
347347
& "mutate DNA sequence: GCGAGCCTGCGGCG", &
348-
& "Replace_all: 2 string_type & 1 character scalar, test case 2")
348+
& "replace_all: 2 string_type & 1 character scalar, test case 2")
349349
call check(replace_all("mutate DNA sequence: AGAGAGCCTAGAGAGAG", test_pattern_2, &
350350
& test_replacement_2) == "mutate DNA sequence: agaGAGCCTagaGagaG", &
351-
& "Replace_all: 2 string_type & 1 character scalar, test case 3")
351+
& "replace_all: 2 string_type & 1 character scalar, test case 3")
352352

353353

354354
! 1 as string_type and 2 as character scalar
355355
call check(replace_all(test_string_1, "TAT", "ATA") == &
356356
& "mutate DNA sequence: GTATACGATAGCCGTAATATA", &
357-
& "Replace_all: 1 string_type & 2 character scalar, test case 1")
357+
& "replace_all: 1 string_type & 2 character scalar, test case 1")
358358
call check(replace_all("mutate DNA sequence: AGAGAGCCTAGAGAGAG", test_pattern_2, &
359359
& "GC") == "mutate DNA sequence: GCGAGCCTGCGGCG", &
360-
& "Replace_all: 1 string_type & 2 character scalar, test case 2")
360+
& "replace_all: 1 string_type & 2 character scalar, test case 2")
361361
call check(replace_all("mutate DNA sequence: GTTATCGTATGCCGTAATTAT", "TA", &
362362
& test_replacement_2) == "mutate DNA sequence: GTagaTCGagaTGCCGagaATagaT", &
363-
& "Replace_all: 1 string_type & 2 character scalar, test case 3")
363+
& "replace_all: 1 string_type & 2 character scalar, test case 3")
364364
call check(replace_all("mutate DNA sequence: GTTATCGTATGCCGTAATTAT", &
365365
& test_pattern_1, "") == "mutate DNA sequence: GTCGGCCGTAAT", &
366-
& "Replace_all: 1 string_type & 2 character scalar, test case 4")
366+
& "replace_all: 1 string_type & 2 character scalar, test case 4")
367367
call check(replace_all(test_string_1, "", "anything here") == test_string_1, &
368-
& "Replace_all: 1 string_type & 2 character scalar, test case 5")
368+
& "replace_all: 1 string_type & 2 character scalar, test case 5")
369369
call check(replace_all("", test_pattern_2, "anything here") == "", &
370-
& "Replace_all: 1 string_type & 2 character scalar, test case 6")
370+
& "replace_all: 1 string_type & 2 character scalar, test case 6")
371371

372372
! all 3 as character scalar
373373
call check(replace_all("mutate DNA sequence: GTTATCGTATGCCGTAATTAT", &
374374
& "GT", "gct") == "mutate DNA sequence: gctTATCgctATGCCgctAATTAT", &
375-
& "Replace_all: all 3 character scalar, test case 1")
375+
& "replace_all: all 3 character scalar, test case 1")
376376
call check(replace_all("", "anything here", "anything here") == "", &
377-
& "Replace_all: all 3 character scalar, test case 2")
377+
& "replace_all: all 3 character scalar, test case 2")
378378

379379
end subroutine test_replace_all
380380

0 commit comments

Comments
 (0)