test_get_units Subroutine

public subroutine test_get_units(this)

Arguments

Type IntentOptional Attributes Name
class(ESMF_TestMethod), intent(inout) :: this

Calls

proc~~test_get_units~~CallsGraph proc~test_get_units test_get_units ESMF_GeomCreate ESMF_GeomCreate proc~test_get_units->ESMF_GeomCreate ESMF_GeomDestroy ESMF_GeomDestroy proc~test_get_units->ESMF_GeomDestroy ESMF_GridCreateNoPeriDim ESMF_GridCreateNoPeriDim proc~test_get_units->ESMF_GridCreateNoPeriDim ESMF_GridDestroy ESMF_GridDestroy proc~test_get_units->ESMF_GridDestroy anyexceptions anyexceptions proc~test_get_units->anyexceptions assert_that assert_that proc~test_get_units->assert_that assertequal assertequal proc~test_get_units->assertequal esmf_fielddestroy esmf_fielddestroy proc~test_get_units->esmf_fielddestroy interface~mapl_fieldcreate~2 MAPL_FieldCreate proc~test_get_units->interface~mapl_fieldcreate~2 interface~mapl_fieldget MAPL_FieldGet proc~test_get_units->interface~mapl_fieldget sourcelocation sourcelocation proc~test_get_units->sourcelocation

Source Code

   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