test_retrieve_exists Subroutine

public subroutine test_retrieve_exists()

Arguments

None

Calls

proc~~test_retrieve_exists~2~~CallsGraph proc~test_retrieve_exists~2 test_retrieve_exists ESMF_AttributeSet ESMF_AttributeSet proc~test_retrieve_exists~2->ESMF_AttributeSet ESMF_GridEmptyCreate ESMF_GridEmptyCreate proc~test_retrieve_exists~2->ESMF_GridEmptyCreate assertequal assertequal proc~test_retrieve_exists~2->assertequal assertfalse assertfalse proc~test_retrieve_exists~2->assertfalse asserttrue asserttrue proc~test_retrieve_exists~2->asserttrue at at proc~test_retrieve_exists~2->at get_name get_name proc~test_retrieve_exists~2->get_name insert insert proc~test_retrieve_exists~2->insert make_regridder make_regridder proc~test_retrieve_exists~2->make_regridder mockregridderfactory mockregridderfactory proc~test_retrieve_exists~2->mockregridderfactory regridderfactoryspec regridderfactoryspec proc~test_retrieve_exists~2->regridderfactoryspec regridderspec regridderspec proc~test_retrieve_exists~2->regridderspec throw throw proc~test_retrieve_exists~2->throw

Source Code

   subroutine test_retrieve_exists()
      type (ESMF_Grid), target :: g1_in, g1_out
      type (RegridderSpec) :: regridder_spec
      type (RegridderFactorySpec) :: factory_spec
      type (RegridderFactoryRegistry) :: registry

      class (AbstractRegridderFactory), pointer :: factory
      class (AbstractRegridder), allocatable :: regridder


      g1_in = ESMF_GridEmptyCreate()
      g1_out = ESMF_GridEmptyCreate()

      call ESMF_AttributeSet(g1_in, name='GridType', value='A')
      call ESMF_AttributeSet(g1_out, name='GridType', value='B')

      regridder_spec = RegridderSpec(g1_in, g1_out)
      factory_spec = RegridderFactorySpec(regridder_spec)

      factory => registry%at(factory_spec)
      @assertFalse(associated(factory))

      call registry%insert(factory_spec, MockRegridderFactory('A to B'))
      factory => registry%at(factory_spec)
      @assertTrue(associated(factory))

      allocate(regridder, source=factory%make_regridder(regridder_spec))
      select type (regridder)
      type is (MockRegridder)
         @assertEqual('A to B::A -> B', regridder%get_name())
      class default
         call throw('incorrect type of regridder returned')
      end select
      
   end subroutine test_retrieve_exists