test_parse_timezone_offset Subroutine

public subroutine test_parse_timezone_offset()

Arguments

None

Calls

proc~~test_parse_timezone_offset~~CallsGraph proc~test_parse_timezone_offset test_parse_timezone_offset assertequal assertequal proc~test_parse_timezone_offset->assertequal asserttrue asserttrue proc~test_parse_timezone_offset->asserttrue proc~parse_timezone_offset parse_timezone_offset proc~test_parse_timezone_offset->proc~parse_timezone_offset proc~is_whole_number is_whole_number proc~parse_timezone_offset->proc~is_whole_number proc~read_whole_number read_whole_number proc~parse_timezone_offset->proc~read_whole_number proc~read_whole_number_indexed read_whole_number_indexed proc~read_whole_number->proc~read_whole_number_indexed proc~read_whole_number_indexed->proc~is_whole_number proc~get_integer_digit_from_string get_integer_digit_from_string proc~read_whole_number_indexed->proc~get_integer_digit_from_string

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