test_parse_timezone_offset Subroutine

public subroutine test_parse_timezone_offset()

Arguments

None

Calls

proc~~test_parse_timezone_offset~2~~CallsGraph proc~test_parse_timezone_offset~2 test_parse_timezone_offset assertequal assertequal proc~test_parse_timezone_offset~2->assertequal asserttrue asserttrue proc~test_parse_timezone_offset~2->asserttrue parse_timezone_offset parse_timezone_offset proc~test_parse_timezone_offset~2->parse_timezone_offset

Source Code

   subroutine test_parse_timezone_offset()
      integer, parameter :: FIELD_WIDTH = 2
      integer, parameter :: INVALID_OFFSET = -1

      character(len=*), parameter :: HOUR_ONLY = '15'
      character(len=*), parameter :: HOUR_MINUTE00 = '1500'
      character(len=*), parameter :: HOUR_MINUTE = '1530'
      integer, parameter :: OFFSET1500 = 15*60
      integer, parameter :: OFFSET1530 = 15*60 + 30

      character(len=*), parameter :: NARROW1 = '1'
      character(len=*), parameter :: NARROW3 = '153'
      character(len=*), parameter :: WIDE5 = '15307'
      character(len=*), parameter :: GARBAGE = '1T3R'

      character(len=*), parameter :: NEG_HOUR = '-15'
      character(len=*), parameter :: NEG_HOURMIN00 = '-1500'
      character(len=*), parameter :: NEG_HOURMIN = '-1530'
      integer, parameter :: OFFSETM1500 = -1*(15*60)
      integer, parameter :: OFFSETM1530 = -1*(15*60 + 30)

      @assertEqual(OFFSET1500, parse_timezone_offset(HOUR_ONLY, FIELD_WIDTH))
      @assertEqual(OFFSET1500, parse_timezone_offset(HOUR_MINUTE00, FIELD_WIDTH))
      @assertEqual(OFFSET1530, parse_timezone_offset(HOUR_MINUTE, FIELD_WIDTH))

      @assertTrue(parse_timezone_offset(NARROW1, FIELD_WIDTH) < 0)
      @assertTrue(parse_timezone_offset(NARROW3, FIELD_WIDTH) < 0)
      @assertTrue(parse_timezone_offset(WIDE5, FIELD_WIDTH) < 0)
      @assertTrue(parse_timezone_offset(GARBAGE, FIELD_WIDTH) < 0)

   end subroutine test_parse_timezone_offset