Skip to content

Commit ff3d0f0

Browse files
committed
Update test_filesystem.f90
1 parent 39b67b3 commit ff3d0f0

File tree

1 file changed

+26
-21
lines changed

1 file changed

+26
-21
lines changed

test/fpm_test/test_filesystem.f90

Lines changed: 26 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -302,31 +302,36 @@ subroutine test_split_lines_first_last(error)
302302
character, parameter :: CR = achar(13)
303303
character, parameter :: LF = new_line('A')
304304
integer, allocatable :: first(:), last(:)
305+
306+
call split_lines_first_last(CR//LF//'line1'//CR//'line2'//LF//'line3'//CR//LF//'hello', first, last)
307+
if (.not.(all(first==[3,9,15,23]) .and. all(last==[7,13,21,27]))) then
308+
call test_failed(error, "Test split_lines_first_last #1 failed")
309+
return
310+
end if
305311

306-
call check_array(error, &
307-
& split_lines_first_last(CR//LF//'line1'//CR//'line2'//LF//'line3'//CR//LF//'hello', first, last), &
308-
& [3, 9, 15, 23], [7, 13, 21, 27])
309-
if (allocated(error)) return
310-
311-
call check_array(error, &
312-
& split_lines_first_last('single_line', first, last), &
313-
& [1], [11])
314-
if (allocated(error)) return
312+
call split_lines_first_last('single_line', first, last)
313+
if (.not.(all(first==[1]) .and. all(last==[11]))) then
314+
call test_failed(error, "Test split_lines_first_last #2 failed")
315+
return
316+
end if
315317

316-
call check_array(error, &
317-
& split_lines_first_last(CR//LF//CR//LF//'test', first, last), &
318-
& [5], [8])
319-
if (allocated(error)) return
318+
call split_lines_first_last(CR//LF//CR//LF//'test', first, last)
319+
if (.not.(all(first == [5]) .and. all(last == [8]))) then
320+
call test_failed(error, "Test split_lines_first_last #3 failed")
321+
return
322+
end if
320323

321-
call check_array(error, &
322-
& split_lines_first_last('a'//CR//'b'//LF//'c'//CR//LF//'d', first, last), &
323-
& [1, 3, 5, 8], [1, 3, 5, 8])
324-
if (allocated(error)) return
324+
call split_lines_first_last('a'//CR//'b'//LF//'c'//CR//LF//'d', first, last)
325+
if (.not.(all(first == [1, 3, 5, 8]) .and. all(last == [1, 3, 5, 8]))) then
326+
call test_failed(error, "Test split_lines_first_last #4 failed")
327+
return
328+
end if
325329

326-
call check_array(error, &
327-
& split_lines_first_last('', first, last), &
328-
& [], [])
329-
if (allocated(error)) return
330+
call split_lines_first_last('', first, last)
331+
if (.not.(size(first) == 0 .and. size(last) == 0)) then
332+
call test_failed(error, "Test split_lines_first_last #5 failed")
333+
return
334+
end if
330335

331336
end subroutine test_split_lines_first_last
332337

0 commit comments

Comments
 (0)