test_get_i4_value_equals_default Subroutine

public subroutine test_get_i4_value_equals_default()

Arguments

None

Calls

proc~~test_get_i4_value_equals_default~~CallsGraph proc~test_get_i4_value_equals_default test_get_i4_value_equals_default ESMF_HConfigAdd ESMF_HConfigAdd proc~test_get_i4_value_equals_default->ESMF_HConfigAdd assertequal assertequal proc~test_get_i4_value_equals_default->assertequal asserttrue asserttrue proc~test_get_i4_value_equals_default->asserttrue interface~get_value get_value proc~test_get_i4_value_equals_default->interface~get_value proc~valuestring_mismatch valuestring_mismatch proc~test_get_i4_value_equals_default->proc~valuestring_mismatch

Source Code

   subroutine test_get_i4_value_equals_default()
      character(len=*), parameter :: LABEL = 'inv_alpha'
      integer(kind=I4), parameter :: EXPECTED = 137
      character(len=*), parameter :: EXPECTED_VALUESTRING = '137' // DEFTAG
      integer(kind=I4) :: actual
      character(len=:), allocatable :: valuestring
      type(HConfigParams) :: params
      logical :: found
      integer :: status

      call ESMF_HConfigAdd(hconfig, EXPECTED, addKeyString=LABEL, rc=status)
      params = HConfigParams(hconfig, LABEL, check_value_set=.TRUE.)
      call get_value(params, actual, default=EXPECTED, valuestring=valuestring, rc=status)
      found = params%value_set
      @assertEqual(0, status, ERROR_GET_FAILED)
      @assertTrue(found, ERROR_NOT_FOUND // LABEL)
      @assertEqual(EXPECTED, actual, ERROR_MISMATCH)
      @assertEqual(EXPECTED_VALUESTRING, valuestring, valuestring_mismatch(valuestring, EXPECTED_VALUESTRING))

   end subroutine test_get_i4_value_equals_default