subroutine test_read_whole_number_indexed() character(len=11), parameter :: STRING = '12345678901' character(len=15), parameter :: BAD_STRING = '18The3.1415...' integer, parameter :: NOT_WHOLE_NUMBER = -1 @assertEqual(12, read_whole_number_indexed(STRING, 1, 2)) @assertEqual(90, read_whole_number_indexed(STRING, 9, 10)) @assertEqual(7, read_whole_number_indexed(STRING, 7, 7)) @assertEqual(1, read_whole_number_indexed(STRING, 10, 11)) @assertEqual(NOT_WHOLE_NUMBER, read_whole_number_indexed(STRING, 2, 1)) @assertEqual(NOT_WHOLE_NUMBER, read_whole_number_indexed(STRING, 1, 12)) @assertEqual(NOT_WHOLE_NUMBER, read_whole_number_indexed(STRING, -1, 9)) @assertEqual(NOT_WHOLE_NUMBER, read_whole_number_indexed(STRING, 1, -1)) @assertEqual(NOT_WHOLE_NUMBER, read_whole_number_indexed(STRING, 0, 2)) @assertEqual(NOT_WHOLE_NUMBER, read_whole_number_indexed(STRING, 2, 0)) @assertEqual(18, read_whole_number_indexed(BAD_STRING, 1, 2)) @assertEqual(NOT_WHOLE_NUMBER, read_whole_number_indexed(BAD_STRING, 2, 3)) @assertEqual(NOT_WHOLE_NUMBER, read_whole_number_indexed(BAD_STRING, 3, 5)) @assertEqual(NOT_WHOLE_NUMBER, read_whole_number_indexed(BAD_STRING, 5, 5)) @assertEqual(NOT_WHOLE_NUMBER, read_whole_number_indexed(BAD_STRING, 5, 6)) @assertEqual(NOT_WHOLE_NUMBER, read_whole_number_indexed(BAD_STRING, 6, 11)) @assertEqual(NOT_WHOLE_NUMBER, read_whole_number_indexed(BAD_STRING, 7, 7)) @assertEqual(NOT_WHOLE_NUMBER, read_whole_number_indexed(BAD_STRING, 7, 8)) @assertEqual(NOT_WHOLE_NUMBER, read_whole_number_indexed('+800', 1, 3)) @assertEqual(NOT_WHOLE_NUMBER, read_whole_number_indexed('-800', 1, 3)) end subroutine test_read_whole_number_indexed