test_extract_CF_Time_unit Subroutine

public subroutine test_extract_CF_Time_unit()

Arguments

None

Calls

proc~~test_extract_cf_time_unit~~CallsGraph proc~test_extract_cf_time_unit test_extract_CF_Time_unit assertequal assertequal proc~test_extract_cf_time_unit->assertequal asserttrue asserttrue proc~test_extract_cf_time_unit->asserttrue interface~extract_cf_time_unit extract_CF_Time_unit proc~test_extract_cf_time_unit->interface~extract_cf_time_unit

Source Code

   subroutine test_extract_CF_Time_unit()
      type(CF_Time_Integer) :: cfti
      integer :: duration = 0
      character(len=*), parameter :: time_unit = 'seconds'
      character(len=*), parameter :: base_datetime = '1999-12-31 23:29:59'
      character(len=*), parameter :: units = time_unit // ' since ' // base_datetime
      character(len=MAX_CHARACTER_LENGTH) :: actual
      integer :: status

      call extract_CF_Time_unit(units, actual, rc = status)
      @assertEqual(SUCCESS, status, 'Failed to extract time unit from units')
      @assertEqual(time_unit, actual, 'Actual time unit does not match expected time unit.')

      cfti = CF_Time_Integer(duration, units)
      @assertTrue(cfti % is_valid, 'Invalid CF_Time_Integer')
      call extract_CF_Time_unit(cfti, actual, rc = status)
      @assertEqual(SUCCESS, status, 'Failed to extract time unit from CF_Time')
      @assertEqual(time_unit, actual, 'Actual time unit does not match expected time unit.')

   end subroutine test_extract_CF_Time_unit