test_undelimit_all Subroutine

public subroutine test_undelimit_all()

Arguments

None

Calls

proc~~test_undelimit_all~~CallsGraph proc~test_undelimit_all test_undelimit_all assertequal assertequal proc~test_undelimit_all->assertequal undelimit_all undelimit_all proc~test_undelimit_all->undelimit_all

Source Code

   subroutine test_undelimit_all()
      character(len=32), parameter :: UNDELIMITED_DATE = '20220720'
      character(len=32), parameter :: DATE ='2022-07-20' 
      character(len=32), parameter :: UNDELIMITED_TIME1 = '153437'
      character(len=32), parameter :: TIME1 = '15:34:37'
      character(len=32), parameter :: UNDELIMITED_TIME2 = '153437421'
      character(len=32), parameter :: TIME2 = '15:34:37.421'
      integer, parameter :: DATEWIDTH = len_trim(UNDELIMITED_DATE)
      integer, parameter :: TIMEWIDTH1 = len_trim(UNDELIMITED_TIME1)
      integer, parameter :: TIMEWIDTH2 = len_trim(UNDELIMITED_TIME2)

      character(len=*), parameter :: cf_datetime_string_A = '2023-04-23 21:05:37'
      character(len=*), parameter :: expected_A = '20230423210537'
      character(len=*), parameter :: cf_datetime_string_B= '2023-04-23 21:05:37.337'
      character(len=*), parameter :: expected_B = '20230423210537337'
      character(len=*), parameter :: undelimited_datetime_string_C = '20230423210537'
      character(len=*), parameter :: fail_D = '2023-4-23 21:05:37'
      character(len=*), parameter :: fail_E = '2023-04-23 21:5:37'

      @assertEqual(trim(UNDELIMITED_DATE), trim(undelimit_all(DATE)))
      @assertEqual(DATEWIDTH, len_trim(UNDELIMITED_DATE)) 
      @assertEqual(trim(UNDELIMITED_TIME1), trim(undelimit_all(TIME1)))
      @assertEqual(TIMEWIDTH1, len_trim(UNDELIMITED_TIME1))
      @assertEqual(trim(UNDELIMITED_TIME2), trim(undelimit_all(TIME2)))
      @assertEqual(TIMEWIDTH2, len_trim(UNDELIMITED_TIME2))
      @assertEqual(trim(UNDELIMITED_TIME1), trim(undelimit_all(UNDELIMITED_TIME1)))
      @assertEqual('', trim(undelimit_all('')))

      @assertEqual(trim(expected_A), trim(undelimit_all(cf_datetime_string_A)), 'Mismatch A')
      @assertEqual(trim(expected_B), trim(undelimit_all(cf_datetime_string_B)), 'Mismatch B')
      @assertEqual(trim(undelimited_datetime_string_C), trim(undelimit_all(undelimited_datetime_string_C)), 'Mismatch C')

   end subroutine test_undelimit_all