subroutine test_child_user_items_created(this)
class(MpiTestMethod), intent(inout) :: this
integer :: status
type(ESMF_GridComp) :: outer_gc
type(OuterMetaComponent), pointer :: outer_meta
type(MultiState) :: states
type(ESMF_Field) :: f
call setup(outer_gc, states, status)
@assert_that(status, is(0))
outer_meta => get_outer_meta(outer_gc, rc=status)
@assert_that(status, is(0))
@assert_that('import', check('child_A', 'import', ['I_A1']), is(0))
@assert_that('export', check('child_A', 'export', ['E_A1', 'Z_A1']), is(0))
@assert_that('internal', check('child_A', 'internal', ['Z_A1']), is(0))
@assert_that('import', check('child_B', 'import', ['I_B1']), is(0))
@assert_that('export', check('child_B', 'export', ['E_B1']), is(0))
@assert_that('internal', check('child_B', 'internal', ['Z_B1']), is(0))
contains
integer function check(child_name, state_intent, expected_items) result(status)
character(*), intent(in) :: child_name
character(*), intent(in) :: state_intent
character(*), intent(in) :: expected_items(:)
type(ESMF_Field) :: f
type(ESMF_State) :: state
type(MultiState) :: states
integer :: i
type(OuterMetaComponent), pointer :: child_meta
type(ESMF_GridComp) :: child_gc
type(GriddedComponentDriver) :: child_comp
type(GriddedComponentDriver), pointer :: user_component
status = 1
child_comp = outer_meta%get_child(child_name, rc=status)
if (status /= 0) then
status = 2
return
end if
child_gc = child_comp%get_gridcomp()
child_meta => get_outer_meta(child_gc)
user_component => child_meta%get_user_gc_driver()
states = user_component%get_states()
call states%get_state(state, state_intent, rc=status)
if (status /= 0) then
status = 3
return
end if
do i = 1, size(expected_items)
call ESMF_StateGet(state, trim(expected_items(i)), f, rc=status)
if (status /= 0) then
status = 10 + i
return
end if
end do
status = 0
end function check
end subroutine test_child_user_items_created