test_extract_ISO8601_from_CF_Time Subroutine

public subroutine test_extract_ISO8601_from_CF_Time()

Arguments

None

Calls

proc~~test_extract_iso8601_from_cf_time~~CallsGraph proc~test_extract_iso8601_from_cf_time test_extract_ISO8601_from_CF_Time assertequal assertequal proc~test_extract_iso8601_from_cf_time->assertequal asserttrue asserttrue proc~test_extract_iso8601_from_cf_time->asserttrue interface~extract_iso8601_from_cf_time extract_ISO8601_from_CF_Time proc~test_extract_iso8601_from_cf_time->interface~extract_iso8601_from_cf_time

Source Code

   subroutine test_extract_ISO8601_from_CF_Time()
      type(CF_Time_Integer) :: cfti
      integer, parameter :: duration = 1800
      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=len(base_datetime)), parameter :: expected = '1999-12-31T23:29:59'
      character(len=MAX_CHARACTER_LENGTH) :: isostring
      integer :: status

      call extract_ISO8601_from_CF_Time(units, isostring, rc = status)
      @assertEqual(SUCCESS, status, 'Failed to extract string from units')
      @assertEqual(expected, isostring, 'Actual string from units does not match expected string.')

      cfti = CF_Time_Integer(duration, units)
      @assertTrue(cfti % is_valid, 'Invalid CF_Time_Integer')
      call extract_ISO8601_from_CF_Time(units, isostring, rc = status)
      @assertEqual(SUCCESS, status, 'Failed to extract string from CF_Time')
      @assertEqual(expected, isostring, 'Actual string from CF_Time does not match expected string.')
      
   end subroutine test_extract_ISO8601_from_CF_Time