From bde5502149da2dcd1d48f05342c903c213951737 Mon Sep 17 00:00:00 2001 From: Philipp Date: Sat, 19 Oct 2024 18:05:54 +0200 Subject: [PATCH] Added test function. --- test/dmteststring.f90 | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/test/dmteststring.f90 b/test/dmteststring.f90 index b77de3a..8097d4d 100644 --- a/test/dmteststring.f90 +++ b/test/dmteststring.f90 @@ -7,7 +7,7 @@ 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) @@ -15,7 +15,8 @@ program dmteststring tests = [ & test_type('test01', test01), & test_type('test02', test02), & - test_type('test03', test03) & + test_type('test03', test03), & + test_type('test04', test04) & ] call dm_init() @@ -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