test_get_integer_digit_from_string Subroutine

public subroutine test_get_integer_digit_from_string()

Arguments

None

Calls

proc~~test_get_integer_digit_from_string~~CallsGraph proc~test_get_integer_digit_from_string test_get_integer_digit_from_string assertequal assertequal proc~test_get_integer_digit_from_string->assertequal get_integer_digit_from_string get_integer_digit_from_string proc~test_get_integer_digit_from_string->get_integer_digit_from_string

Source Code

   subroutine test_get_integer_digit_from_string
      integer :: i
      integer, parameter :: NONDIGIT = -1
      character(len=5), parameter :: digit = '19150'
      integer, dimension(5) :: values = [1, 9, 1, 5, 0]

      @assertEqual(1, get_integer_digit_from_string('19150', 1))

      do i= 1, len(digit)
         @assertEqual(values(i), get_integer_digit_from_string(digit, i))
      end do

      @assertEqual(NONDIGIT, get_integer_digit_from_string(digit, 0))
      @assertEqual(NONDIGIT, get_integer_digit_from_string(digit, -1))
      @assertEqual(NONDIGIT, get_integer_digit_from_string(digit, len(digit)+1))
   end subroutine test_get_integer_digit_from_string