Test_StringGridFactoryMap.pf Source File


This file depends on

sourcefile~~test_stringgridfactorymap.pf~~EfferentGraph sourcefile~test_stringgridfactorymap.pf Test_StringGridFactoryMap.pf sourcefile~mapl_abstractgridfactory.f90 MAPL_AbstractGridFactory.F90 sourcefile~test_stringgridfactorymap.pf->sourcefile~mapl_abstractgridfactory.f90 sourcefile~mapl_stringgridfactorymap.f90 MAPL_StringGridFactoryMap.F90 sourcefile~test_stringgridfactorymap.pf->sourcefile~mapl_stringgridfactorymap.f90 sourcefile~mockgridfactory.f90 MockGridFactory.F90 sourcefile~test_stringgridfactorymap.pf->sourcefile~mockgridfactory.f90 sourcefile~base_base.f90 Base_Base.F90 sourcefile~mapl_abstractgridfactory.f90->sourcefile~base_base.f90 sourcefile~constants.f90 Constants.F90 sourcefile~mapl_abstractgridfactory.f90->sourcefile~constants.f90 sourcefile~mapl_exceptionhandling.f90 MAPL_ExceptionHandling.F90 sourcefile~mapl_abstractgridfactory.f90->sourcefile~mapl_exceptionhandling.f90 sourcefile~mapl_keywordenforcer.f90 MAPL_KeywordEnforcer.F90 sourcefile~mapl_abstractgridfactory.f90->sourcefile~mapl_keywordenforcer.f90 sourcefile~pfio.f90 pFIO.F90 sourcefile~mapl_abstractgridfactory.f90->sourcefile~pfio.f90 sourcefile~mapl_stringgridfactorymap.f90->sourcefile~mapl_abstractgridfactory.f90 sourcefile~mockgridfactory.f90->sourcefile~mapl_abstractgridfactory.f90 sourcefile~mockgridfactory.f90->sourcefile~base_base.f90 sourcefile~mockgridfactory.f90->sourcefile~mapl_keywordenforcer.f90 sourcefile~mockgridfactory.f90->sourcefile~pfio.f90

Source Code

module Test_StringGridFactoryMap
   use pFUnit
   use ESMF
   use MAPL_StringGridFactoryMapMod
   use MAPL_AbstractGridFactoryMod
   use MockGridFactoryMod
   implicit none


contains

   ! Tests here just verify basic functionality that FTL provides for
   ! the registry

   @test
   subroutine test_retrieve_exists()
      class (AbstractGridFactory), pointer :: factory
      type (StringGridFactoryMap) :: registry

      @assertFalse(associated(registry%at('a')))
      
      call registry%insert('a', MockGridFactory('A'))
      @assertTrue(associated(registry%at('a')))

      factory => registry%at('a')
      @assertEqual('A', factory%to_string())

   end subroutine test_retrieve_exists
      
      
   @test
   subroutine test_retrieve_multi()
      class (AbstractGridFactory), pointer :: factory
      type (StringGridFactoryMap) :: registry

      call registry%insert('a', MockGridFactory('A'))
      call registry%insert('b', MockGridFactory('B'))
      call registry%insert('c', MockGridFactory('C'))

      factory => registry%at('c')
      @assertEqual('C', factory%to_string())

      factory => registry%at('a')
      @assertEqual('A', factory%to_string())
      
   end subroutine test_retrieve_multi
      
   
end module Test_StringGridFactoryMap