test_MAPL_DateTime_Parsing_ESMF.pf Source File


This file depends on

sourcefile~~test_mapl_datetime_parsing_esmf.pf~~EfferentGraph sourcefile~test_mapl_datetime_parsing_esmf.pf test_MAPL_DateTime_Parsing_ESMF.pf sourcefile~mapl_cf_time.f90 MAPL_CF_Time.F90 sourcefile~test_mapl_datetime_parsing_esmf.pf->sourcefile~mapl_cf_time.f90 sourcefile~mapl_datetime_parsing_esmf.f90 MAPL_DateTime_Parsing_ESMF.F90 sourcefile~test_mapl_datetime_parsing_esmf.pf->sourcefile~mapl_datetime_parsing_esmf.f90 sourcefile~mapl_exceptionhandling.f90 MAPL_ExceptionHandling.F90 sourcefile~mapl_cf_time.f90->sourcefile~mapl_exceptionhandling.f90 sourcefile~mapl_keywordenforcer.f90 MAPL_KeywordEnforcer.F90 sourcefile~mapl_cf_time.f90->sourcefile~mapl_keywordenforcer.f90 sourcefile~mapl_datetime_parsing_esmf.f90->sourcefile~mapl_exceptionhandling.f90 sourcefile~mapl_datetime_parsing_esmf.f90->sourcefile~mapl_keywordenforcer.f90 sourcefile~mapl_errorhandling.f90 MAPL_ErrorHandling.F90 sourcefile~mapl_exceptionhandling.f90->sourcefile~mapl_errorhandling.f90 sourcefile~mapl_throw.f90 MAPL_Throw.F90 sourcefile~mapl_exceptionhandling.f90->sourcefile~mapl_throw.f90 sourcefile~mapl_errorhandling.f90->sourcefile~mapl_throw.f90

Source Code

#include "MAPL_Exceptions.h"
!===============================================================================
! TEST_MAPL_DATETIMEPARSING_ESMF
!===============================================================================
module test_MAPL_DateTime_Parsing_ESMF
   use MAPL_DateTime_Parsing
   use MAPL_DateTime_Parsing_ESMF
   use MAPL_CF_Time
   use ESMF
   use, intrinsic :: iso_fortran_env, only: R64 => real64, R32 => real32

   implicit none
   
   integer, parameter :: SUCCESS = _SUCCESS !wdb deleteme

contains

   @test
   subroutine test_set_ESMF_TimeInterval_integer()
      integer :: duration = 1800, actual
      type(datetime_duration) :: dt_dur
      character(len=*), parameter :: units = 'seconds since 1999-12-31 23:29:59'
      type(ESMF_TimeInterval) :: interval
      integer :: status
      
      call convert_CF_Time_to_datetime_duration(duration, units, dt_dur, rc = status)
      @assertEqual(_SUCCESS, status, 'Conversion unsuccessful')

   end subroutine test_set_ESMF_TimeInterval_integer

   @test
   subroutine test_set_ESMF_TimeInterval_real()
      real(R64) :: duration = 1800.0, actual
      type(datetime_duration) :: dt_dur
      character(len=*), parameter :: units = 'seconds since 1999-12-31 23:29:59'
      type(ESMF_TimeInterval) :: interval
      integer :: status
      
      call convert_CF_Time_to_datetime_duration(duration, units, dt_dur, rc = status)
      @assertEqual(_SUCCESS, status, 'Conversion unsuccessful')

   end subroutine test_set_ESMF_TimeInterval_real

   @test
   subroutine test_ESMF_Time_from_ISO8601()
      character(len=*), parameter :: isostring = '1999-12-31T23:29:59'
      character(len=len(isostring)) :: actual
      type(ESMF_Time) :: time
      integer :: status

      call set_ESMF_Time_from_ISO8601(time, isostring, rc = status)
      @assertTrue(status == _SUCCESS, 'Failed to set ESMF_Time')
      call ESMF_TimeGet(time, timeStringISOFrac = actual, rc = status)
      @assertTrue(status == _SUCCESS, 'Failed to get isostring')
      @assertEqual(isostring, actual, 'ISO8601 strings do not match.')
      
   end subroutine test_ESMF_Time_from_ISO8601

end module test_MAPL_DateTime_Parsing_ESMF