Test_FieldCreate.pf Source File


This file depends on

sourcefile~~test_fieldcreate.pf~~EfferentGraph sourcefile~test_fieldcreate.pf Test_FieldCreate.pf sourcefile~esmf_testmethod.f90 ESMF_TestMethod.F90 sourcefile~test_fieldcreate.pf->sourcefile~esmf_testmethod.f90 sourcefile~fieldcreate.f90 FieldCreate.F90 sourcefile~test_fieldcreate.pf->sourcefile~fieldcreate.f90 sourcefile~fieldget.f90 FieldGet.F90 sourcefile~test_fieldcreate.pf->sourcefile~fieldget.f90 sourcefile~esmf_testcase.f90 ESMF_TestCase.F90 sourcefile~esmf_testmethod.f90->sourcefile~esmf_testcase.f90 sourcefile~esmf_testparameter.f90 ESMF_TestParameter.F90 sourcefile~esmf_testmethod.f90->sourcefile~esmf_testparameter.f90 sourcefile~errorhandling.f90 ErrorHandling.F90 sourcefile~fieldcreate.f90->sourcefile~errorhandling.f90 sourcefile~fieldinfo.f90 FieldInfo.F90 sourcefile~fieldcreate.f90->sourcefile~fieldinfo.f90 sourcefile~keywordenforcer.f90 KeywordEnforcer.F90 sourcefile~fieldcreate.f90->sourcefile~keywordenforcer.f90 sourcefile~lu_bound.f90 LU_Bound.F90 sourcefile~fieldcreate.f90->sourcefile~lu_bound.f90 sourcefile~ungriddeddims.f90 UngriddedDims.F90 sourcefile~fieldcreate.f90->sourcefile~ungriddeddims.f90 sourcefile~verticalstaggerloc.f90 VerticalStaggerLoc.F90 sourcefile~fieldcreate.f90->sourcefile~verticalstaggerloc.f90 sourcefile~fieldget.f90->sourcefile~errorhandling.f90 sourcefile~fieldget.f90->sourcefile~fieldinfo.f90 sourcefile~fieldget.f90->sourcefile~keywordenforcer.f90 sourcefile~fieldget.f90->sourcefile~ungriddeddims.f90 sourcefile~fieldget.f90->sourcefile~verticalstaggerloc.f90 sourcefile~mapl_throw.f90 MAPL_Throw.F90 sourcefile~errorhandling.f90->sourcefile~mapl_throw.f90 sourcefile~esmf_testcase.f90->sourcefile~esmf_testparameter.f90 sourcefile~fieldinfo.f90->sourcefile~errorhandling.f90 sourcefile~fieldinfo.f90->sourcefile~keywordenforcer.f90 sourcefile~fieldinfo.f90->sourcefile~ungriddeddims.f90 sourcefile~fieldinfo.f90->sourcefile~verticalstaggerloc.f90 sourcefile~infoutilities.f90 InfoUtilities.F90 sourcefile~fieldinfo.f90->sourcefile~infoutilities.f90 sourcefile~mapl_esmf_infokeys.f90 MAPL_ESMF_InfoKeys.F90 sourcefile~fieldinfo.f90->sourcefile~mapl_esmf_infokeys.f90 sourcefile~ungriddeddims.f90->sourcefile~errorhandling.f90 sourcefile~ungriddeddims.f90->sourcefile~lu_bound.f90 sourcefile~ungriddeddims.f90->sourcefile~infoutilities.f90 sourcefile~ungriddeddims.f90->sourcefile~mapl_esmf_infokeys.f90 sourcefile~ungriddeddim.f90 UngriddedDim.F90 sourcefile~ungriddeddims.f90->sourcefile~ungriddeddim.f90 sourcefile~ungriddeddimvector.f90 UngriddedDimVector.F90 sourcefile~ungriddeddims.f90->sourcefile~ungriddeddimvector.f90 sourcefile~infoutilities.f90->sourcefile~errorhandling.f90 sourcefile~infoutilities.f90->sourcefile~keywordenforcer.f90 sourcefile~infoutilities.f90->sourcefile~mapl_esmf_infokeys.f90 sourcefile~mapl_esmf_infokeys.f90->sourcefile~errorhandling.f90 sourcefile~ungriddeddim.f90->sourcefile~errorhandling.f90 sourcefile~ungriddeddim.f90->sourcefile~lu_bound.f90 sourcefile~ungriddeddim.f90->sourcefile~infoutilities.f90 sourcefile~ungriddeddimvector.f90->sourcefile~ungriddeddim.f90

Source Code

#include "MAPL_TestErr.h"

module Test_FieldCreate
   use mapl3g_FieldCreate
   use mapl3g_FieldGet
   use funit
   use ESMF_TestMethod_mod
   use esmf
   implicit none(type,external)

contains

   ! Just a basic test to ensure that things happen.  Far too many
   ! optional arguments to sensibly test all code paths, but certainly
   ! more tests could be added.
   @test(type=ESMF_TestMethod, npes=[1])
   subroutine test_get_units(this)
      class(ESMF_TestMethod), intent(inout) :: this
      type(ESMF_Field) :: field
      type(ESMF_Geom) :: geom
      type(ESMF_Grid) :: grid
      character(*), parameter :: EXPECTED_UNITS = 'km'
      character(:), allocatable :: units

      integer :: status

      grid = ESMF_GridCreateNoPeriDim(maxIndex=[4,4], _RC)
      geom = ESMF_GeomCreate(grid, _RC)
      
      field = MAPL_FieldCreate(geom, typekind=ESMF_TYPEKIND_R4, units=EXPECTED_UNITS, _RC)

      call MAPL_FieldGet(field, units=units, _RC)
      @assertEqual(units, EXPECTED_UNITS)

      call ESMF_FieldDestroy(field, _RC)
      call ESMF_GridDestroy(grid, _RC)
      call ESMF_GeomDestroy(geom, _RC)
      
   end subroutine test_get_units

end module Test_FieldCreate