test_read_whole_number Subroutine

public subroutine test_read_whole_number()

Arguments

None

Calls

proc~~test_read_whole_number~2~~CallsGraph proc~test_read_whole_number~2 test_read_whole_number assertequal assertequal proc~test_read_whole_number~2->assertequal read_whole_number read_whole_number proc~test_read_whole_number~2->read_whole_number

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