Skip to content

Commit

Permalink
Added test function.
Browse files Browse the repository at this point in the history
  • Loading branch information
interkosmos committed Oct 19, 2024
1 parent 4fb169f commit bde5502
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions test/dmteststring.f90
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,16 @@ program dmteststring
implicit none (type, external)

character(len=*), parameter :: TEST_NAME = 'dmteststring'
integer, parameter :: NTESTS = 3
integer, parameter :: NTESTS = 4

type(test_type) :: tests(NTESTS)
logical :: stats(NTESTS)

tests = [ &
test_type('test01', test01), &
test_type('test02', test02), &
test_type('test03', test03) &
test_type('test03', test03), &
test_type('test04', test04) &
]

call dm_init()
Expand Down Expand Up @@ -109,4 +110,19 @@ logical function test03() result(stat)

stat = TEST_PASSED
end function test03

logical function test04() result(stat)
stat = TEST_FAILED

print *, 'Testing starts-with function ...'

if (.not. dm_string_starts_with('aaa', 'a')) return
if (.not. dm_string_starts_with('aaa', 'aaa')) return
if (dm_string_starts_with('', '')) return
if (dm_string_starts_with('aaa', '')) return
if (dm_string_starts_with('', 'aaa')) return
if (dm_string_starts_with('a', 'aaa')) return

stat = TEST_PASSED
end function test04
end program dmteststring

0 comments on commit bde5502

Please sign in to comment.