test_read_whole_number Subroutine

public subroutine test_read_whole_number()

Arguments

None

Calls

proc~~test_read_whole_number~~CallsGraph proc~test_read_whole_number test_read_whole_number assertequal assertequal proc~test_read_whole_number->assertequal proc~read_whole_number read_whole_number proc~test_read_whole_number->proc~read_whole_number proc~read_whole_number_indexed read_whole_number_indexed proc~read_whole_number->proc~read_whole_number_indexed proc~get_integer_digit_from_string get_integer_digit_from_string proc~read_whole_number_indexed->proc~get_integer_digit_from_string proc~is_whole_number is_whole_number proc~read_whole_number_indexed->proc~is_whole_number proc~get_integer_digit get_integer_digit proc~get_integer_digit_from_string->proc~get_integer_digit

Source Code

   subroutine test_read_whole_number()
      character(len=*), parameter :: NUM_STRING = '01234'
      integer, parameter :: WHOLE_NUMBER = 1234
      integer, parameter :: NOT_WHOLE_NUMBER = -1
      character(len=*), parameter :: LETTERS = 'ABCDEFG'
      character(len=*), parameter :: ALPHA_NUMERICS = '9B4D3F7'
      character(len=*), parameter :: NEGATIVE_INTEGER = '-' // NUM_STRING
      character(len=*), parameter :: SYMBOLS = '100%'
      character(len=*), parameter :: FLOATING_POINT = '10.07'
      character(len=*), parameter :: POSITIVE_INTEGER = '+' // NUM_STRING

      @assertEqual(WHOLE_NUMBER, read_whole_number(NUM_STRING))

      @assertEqual(NOT_WHOLE_NUMBER, read_whole_number(LETTERS))
      @assertEqual(NOT_WHOLE_NUMBER, read_whole_number(ALPHA_NUMERICS))
      @assertEqual(NOT_WHOLE_NUMBER, read_whole_number(NEGATIVE_INTEGER))
      @assertEqual(NOT_WHOLE_NUMBER, read_whole_number(SYMBOLS))
      @assertEqual(NOT_WHOLE_NUMBER, read_whole_number(FLOATING_POINT))
      @assertEqual(NOT_WHOLE_NUMBER, read_whole_number(POSITIVE_INTEGER))
   end subroutine test_read_whole_number