Skip to content

Fortran 77 print instead of write(*,*) #52

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 30, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 45 additions & 45 deletions src/tests/ascii/test_ascii.f90
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ program test_ascii
is_control, is_punctuation, is_graphical, is_printable, is_ascii, &
to_lower, to_upper, LF, TAB, NUL, DEL

write(*,*) "Lowercase letters: ", lowercase
write(*,*) "Uppercase letters: ", uppercase
write(*,*) "Digits: ", digits
write(*,*) "Octal digits: ", octal_digits
write(*,*) "Full hex digits: ", fullhex_digits
write(*,*) "Hex digits: ", hex_digits
write(*,*) "Lower hex digits: ", lowerhex_digits
print *, "Lowercase letters: ", lowercase
print *, "Uppercase letters: ", uppercase
print *, "Digits: ", digits
print *, "Octal digits: ", octal_digits
print *, "Full hex digits: ", fullhex_digits
print *, "Hex digits: ", hex_digits
print *, "Lower hex digits: ", lowerhex_digits

call test_is_alphanum_short
call test_is_alphanum_long
Expand Down Expand Up @@ -69,7 +69,7 @@ program test_ascii
contains

subroutine test_is_alphanum_short
write(*,*) "test_is_alphanum_short"
print *, "test_is_alphanum_short"
call assert(is_alphanum('A'))
call assert(is_alphanum('1'))
call assert(.not. is_alphanum('#'))
Expand All @@ -82,7 +82,7 @@ subroutine test_is_alphanum_long
integer :: i
character(len=:), allocatable :: clist

write(*,*) "test_is_alphanum_long"
print *, "test_is_alphanum_long"

clist = digits//octal_digits//fullhex_digits//letters//lowercase//uppercase
do i = 1, len(clist)
Expand All @@ -96,7 +96,7 @@ subroutine test_is_alphanum_long
end subroutine

subroutine test_is_alpha_short
write(*,*) "test_is_alpha_short"
print *, "test_is_alpha_short"
call assert(is_alpha('A'))
call assert(.not. is_alpha('1'))
call assert(.not. is_alpha('#'))
Expand All @@ -109,7 +109,7 @@ subroutine test_is_alpha_long
integer :: i
character(len=:), allocatable :: clist

write(*,*) "test_is_alpha_long"
print *, "test_is_alpha_long"

clist = letters//lowercase//uppercase
do i = 1, len(clist)
Expand All @@ -123,7 +123,7 @@ subroutine test_is_alpha_long
end subroutine

subroutine test_is_lower_short
write(*,*) "test_is_lower_short"
print *, "test_is_lower_short"
call assert(is_lower('a'))
call assert(.not. is_lower('A'))
call assert(.not. is_lower('#'))
Expand All @@ -137,7 +137,7 @@ subroutine test_is_lower_long
integer :: i
character(len=:), allocatable :: clist

write(*,*) "test_is_lower_long"
print *, "test_is_lower_long"
do i = 1, len(lowercase)
call assert(is_lower(lowercase(i:i)))
end do
Expand All @@ -149,7 +149,7 @@ subroutine test_is_lower_long
end subroutine

subroutine test_is_upper_short
write(*,*) "test_is_upper_short"
print *, "test_is_upper_short"
call assert(is_upper('A'))
call assert(.not. is_upper('a'))
call assert(.not. is_upper('#'))
Expand All @@ -162,7 +162,7 @@ subroutine test_is_upper_short
subroutine test_is_upper_long
integer :: i
character(len=:), allocatable :: clist
write(*,*) "test_is_upper_long"
print *, "test_is_upper_long"
do i = 1, len(uppercase)
call assert(is_upper(uppercase(i:i)))
end do
Expand All @@ -175,7 +175,7 @@ subroutine test_is_upper_long


subroutine test_is_digit_short
write(*,*) "test_is_digit_short"
print *, "test_is_digit_short"
call assert(is_digit('3'))
call assert(is_digit('8'))
call assert(.not. is_digit('B'))
Expand All @@ -189,7 +189,7 @@ subroutine test_is_digit_short
subroutine test_is_digit_long
integer :: i
character(len=:), allocatable :: clist
write(*,*) "test_is_digit_long"
print *, "test_is_digit_long"
do i = 1, len(digits)
call assert(is_digit(digits(i:i)))
end do
Expand All @@ -201,7 +201,7 @@ subroutine test_is_digit_long
end subroutine

subroutine test_is_octal_digit_short
write(*,*) "test_is_octal_digit_short"
print *, "test_is_octal_digit_short"
call assert(is_octal_digit('0'))
call assert(is_octal_digit('7'))
call assert(.not. is_octal_digit('8'))
Expand All @@ -212,7 +212,7 @@ subroutine test_is_octal_digit_short
subroutine test_is_octal_digit_long
integer :: i
character(len=:), allocatable :: clist
write(*,*) "test_is_octal_digit_long"
print *, "test_is_octal_digit_long"
do i = 1, len(octal_digits)
call assert(is_octal_digit(octal_digits(i:i)))
end do
Expand All @@ -223,7 +223,7 @@ subroutine test_is_octal_digit_long
end subroutine

subroutine test_is_hex_digit_short
write(*,*) "test_is_hex_digit_short"
print *, "test_is_hex_digit_short"
call assert(is_hex_digit('0'))
call assert(is_hex_digit('A'))
call assert(is_hex_digit('f')) !! lowercase hex digits are accepted
Expand All @@ -235,7 +235,7 @@ subroutine test_is_hex_digit_short
subroutine test_is_hex_digit_long
integer :: i
character(len=:), allocatable :: clist
write(*,*) "test_is_hex_digit_long"
print *, "test_is_hex_digit_long"
do i = 1, len(fullhex_digits)
call assert(is_hex_digit(fullhex_digits(i:i)))
end do
Expand All @@ -246,7 +246,7 @@ subroutine test_is_hex_digit_long
end subroutine

subroutine test_is_white_short
write(*,*) "test_is_white_short"
print *, "test_is_white_short"
call assert(is_white(' '))
call assert(is_white(TAB))
call assert(is_white(LF))
Expand All @@ -258,7 +258,7 @@ subroutine test_is_white_short
subroutine test_is_white_long
integer :: i
character(len=:), allocatable :: clist
write(*,*) "test_is_white_long"
print *, "test_is_white_long"
do i = 1, len(whitespace)
call assert(is_white(whitespace(i:i)))
end do
Expand All @@ -269,7 +269,7 @@ subroutine test_is_white_long
end subroutine

subroutine test_is_blank_short
write(*,*) "test_is_blank_short"
print *, "test_is_blank_short"
call assert(is_blank(' '))
call assert(is_blank(TAB))
call assert(.not. is_blank('1'))
Expand All @@ -280,7 +280,7 @@ subroutine test_is_blank_short
subroutine test_is_blank_long
integer :: i
character(len=:), allocatable :: clist
write(*,*) "test_is_blank_long"
print *, "test_is_blank_long"
do i = 1, len(whitespace)
if (whitespace(i:i) == ' ' .or. whitespace(i:i) == TAB) then
call assert(is_blank(whitespace(i:i)))
Expand All @@ -295,25 +295,25 @@ subroutine test_is_blank_long
end subroutine

subroutine test_is_control_short
write(*,*) "test_is_control_short"
! write(*,*) is_control('\0')
! write(*,*) is_control('\022')
print *, "test_is_control_short"
! print *, is_control('\0')
! print *, is_control('\022')
call assert(is_control(new_line('a'))) ! newline is both whitespace and control
call assert(.not. is_control(' '))
call assert(.not. is_control('1'))
call assert(.not. is_control('a'))
call assert(.not. is_control('#'))

! N.B.: non-ASCII Unicode control characters are not recognized:
! write(*,*) .not. is_control('\u0080')
! write(*,*) .not. is_control('\u2028')
! write(*,*) .not. is_control('\u2029')
! print *, .not. is_control('\u0080')
! print *, .not. is_control('\u2028')
! print *, .not. is_control('\u2029')
end subroutine

subroutine test_is_control_long
integer :: i
character(len=:), allocatable :: clist
write(*,*) "test_is_control_long"
print *, "test_is_control_long"
do i = 0, 31
call assert(is_control(achar(i)))
end do
Expand All @@ -326,7 +326,7 @@ subroutine test_is_control_long
end subroutine

subroutine test_is_punctuation_short
write(*,*) "test_is_punctuation_short"
print *, "test_is_punctuation_short"
call assert(is_punctuation('.'))
call assert(is_punctuation(','))
call assert(is_punctuation(':'))
Expand All @@ -343,13 +343,13 @@ subroutine test_is_punctuation_short
call assert(.not. is_punctuation(NUL))

! N.B.: Non-ASCII Unicode punctuation characters are not recognized.
! write(*,*) is_punctuation('\u2012') ! (U+2012 = en-dash)
! print *, is_punctuation('\u2012') ! (U+2012 = en-dash)
end subroutine

subroutine test_is_punctuation_long
integer :: i
character(len=1) :: c
write(*,*) "test_is_punctuation_long"
print *, "test_is_punctuation_long"
do i = 0, 127
c = achar(i)
if (is_control(c) .or. is_alphanum(c) .or. c == ' ') then
Expand All @@ -361,7 +361,7 @@ subroutine test_is_punctuation_long
end subroutine

subroutine test_is_graphical_short
write(*,*) "test_is_graphical"
print *, "test_is_graphical"
call assert(is_graphical('1'))
call assert(is_graphical('a'))
call assert(is_graphical('#'))
Expand All @@ -376,7 +376,7 @@ subroutine test_is_graphical_short
subroutine test_is_graphical_long
integer :: i
character(len=1) :: c
write(*,*) "test_is_graphical_long"
print *, "test_is_graphical_long"
do i = 0, 127
c = achar(i)
if (is_control(c) .or. c == ' ') then
Expand All @@ -388,7 +388,7 @@ subroutine test_is_graphical_long
end subroutine

subroutine test_is_printable_short
write(*,*) "test_is_printable_short"
print *, "test_is_printable_short"
call assert(is_printable(' ')) ! whitespace is printable
call assert(is_printable('1'))
call assert(is_printable('a'))
Expand All @@ -402,7 +402,7 @@ subroutine test_is_printable_short
subroutine test_is_printable_long
integer :: i
character(len=1) :: c
write(*,*) "test_is_printable_long"
print *, "test_is_printable_long"
do i = 0, 127
c = achar(i)
if (is_control(c)) then
Expand All @@ -414,14 +414,14 @@ subroutine test_is_printable_long
end subroutine

subroutine test_is_ascii_short()
write(*,*) "test_is_ascii_short"
print *, "test_is_ascii_short"
call assert(is_ascii('a'))
call assert(.not. is_ascii('ä'))
end subroutine

subroutine test_is_ascii_long()
integer :: i
write(*,*) "test_is_ascii_long"
print *, "test_is_ascii_long"
do i = 0, 127
call assert(is_ascii(achar(i)))
end do
Expand All @@ -430,7 +430,7 @@ subroutine test_is_ascii_long()
end subroutine

subroutine test_to_lower_short()
write(*,*) "test_to_lower_short"
print *, "test_to_lower_short"
call assert(to_lower('a') == 'a')
call assert(to_lower('A') == 'a')
call assert(to_lower('#') == '#')
Expand All @@ -439,7 +439,7 @@ subroutine test_to_lower_short()
subroutine test_to_lower_long()
integer :: i
character(len=1) :: c
write(*,*) "test_to_lower_long"
print *, "test_to_lower_long"
do i = 1, len(uppercase)
call assert(to_lower(uppercase(i:i)) == lowercase(i:i))
end do
Expand All @@ -454,7 +454,7 @@ subroutine test_to_lower_long()
end subroutine

subroutine test_to_upper_short()
write(*,*) "test_to_upper_short"
print *, "test_to_upper_short"
call assert(to_upper('a') == 'A')
call assert(to_upper('A') == 'A')
call assert(to_upper('#') == '#')
Expand All @@ -463,7 +463,7 @@ subroutine test_to_upper_short()
subroutine test_to_upper_long()
integer :: i
character(len=1) :: c
write(*,*) "test_to_upper_long"
print *, "test_to_upper_long"
do i = 1, len(lowercase)
call assert(to_upper(lowercase(i:i)) == uppercase(i:i))
end do
Expand Down