3 ! Test contributed by Valery Weber <valeryweber@hotmail.com>
7 TYPE, PUBLIC
:: dict_entry_type
8 CLASS( * ), ALLOCATABLE
:: key
9 CLASS( * ), ALLOCATABLE
:: val
10 END TYPE dict_entry_type
15 SUBROUTINE dict_put ( this
, key, val
)
16 CLASS(dict_entry_type
), INTENT(INOUT
) :: this
17 CLASS(*), INTENT(IN
) :: key, val
19 ALLOCATE( this
%key, SOURCE
=key, STAT
=istat
)
20 ALLOCATE( this
%val
, SOURCE
=val
, STAT
=istat
)
21 end SUBROUTINE dict_put
26 type(dict_entry_type
) :: t
27 call dict_put(t
, "foo", 42)
29 if (.NOT
. allocated(t
%key)) call abort()
30 select
type (x
=> t
%key)
31 type is (CHARACTER(*))
32 if (x
/= "foo") call abort()
38 if (.NOT
. allocated(t
%val
)) call abort()
39 select
type (x
=> t
%val
)
41 if (x
/= 42) call abort()