Skip to content
This repository has been archived by the owner on Nov 7, 2023. It is now read-only.

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jchristopherson committed Sep 24, 2020
1 parent 92dc4cb commit 1c762c2
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions tests/test_fcore_dictionary.f90
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ function test_dictionary_1() result(rst)
type(hash_code) :: hash
type(dictionary) :: x
class(*), pointer :: item
logical :: temp

! Initialization
rst = .true.
Expand Down Expand Up @@ -83,6 +84,30 @@ function test_dictionary_1() result(rst)
item // " instead."
end if
end select

item => x%get(key3)
select type (item)
type is (character(len = *))
if (item /= str3) then
rst = .false.
print '(A)', "TEST_DICTIONARY_1 (Test 7): " // &
"Expected to find " // str3 // ", but found " // &
item // " instead."
end if
end select

! Remove the second item (key2)
temp = x%remove(key2)
if (.not.temp) then
rst = .false.
print '(A)', "TEST_DICTIONARY_1 (Test 8): Failed to remove " // &
"an existing item."
end if
if (x%contains_key(key2)) then
rst = .false.
print '(A)', "TEST_DICTIONARY_1 (Test 9): Failed to remove " // &
"an existing item."
end if
end function

! ------------------------------------------------------------------------------
Expand Down

0 comments on commit 1c762c2

Please sign in to comment.