Skip to content

Commit

Permalink
revise testinfnan
Browse files Browse the repository at this point in the history
  • Loading branch information
zaikunzhang committed Oct 6, 2023
1 parent 2ecb192 commit 36a067d
Showing 1 changed file with 20 additions and 6 deletions.
26 changes: 20 additions & 6 deletions test/testinfnan.f90
Original file line number Diff line number Diff line change
Expand Up @@ -129,39 +129,46 @@ function test_infnan() result(success)

write (*, '(/(1A))') 'Single-precision tests:'

success_SP = .true.

if (.not. all(is_finite(x) .eqv. check_finite)) then
success_SP = .false.
write (*, *) 'True IS_FINITE: ', check_finite
write (*, *) 'IS_FINITE: ', is_finite(x)
write (*, *) 'IEEE_IS_FINITE: ', ieee_is_finite(x)
end if

if (.not. all(is_inf(x) .eqv. check_inf)) then
success_SP = .false.
write (*, *) 'True IS_INF: ', check_inf
write (*, *) 'IS_INF: ', is_inf(x)
write (*, *) 'IEEE_IS_INF: ', ieee_is_inf(x)
end if

if (.not. all(is_posinf(x) .eqv. check_posinf)) then
success_SP = .false.
write (*, *) 'True IS_POSINF: ', check_posinf
write (*, *) 'IS_POSINF: ', is_posinf(x)
write (*, *) 'IEEE_IS_POSINF: ', ieee_is_posinf(x)
end if

if (.not. all(is_neginf(x) .eqv. check_neginf)) then
success_SP = .false.
write (*, *) 'True IS_NEGINF: ', check_neginf
write (*, *) 'IS_NEGINF: ', is_neginf(x)
write (*, *) 'IEEE_IS_NEGINF: ', ieee_is_neginf(x)
end if

if (.not. all(is_nan(x) .eqv. check_nan)) then
success_SP = .false.
write (*, *) 'True IS_NAN: ', check_nan
write (*, *) 'IS_NAN: ', is_nan(x)
write (*, *) 'IEEE_IS_NAN: ', ieee_is_nan(x)
end if

success_SP = all(is_finite(x) .eqv. check_finite) .and. all(is_inf(x) .eqv. check_inf) .and. &
& all(is_posinf(x) .eqv. check_posinf) .and. all(is_neginf(x) .eqv. check_neginf) .and. &
& all(is_nan(x) .eqv. check_nan)
!success_SP = all(is_finite(x) .eqv. check_finite) .and. all(is_inf(x) .eqv. check_inf) .and. &
! & all(is_posinf(x) .eqv. check_posinf) .and. all(is_neginf(x) .eqv. check_neginf) .and. &
! & all(is_nan(x) .eqv. check_nan)

if (.not. success_SP) then
write (*, '(1A)') 'Some tests failed. The data is'
Expand All @@ -173,39 +180,46 @@ function test_infnan() result(success)

write (*, '(/(1A))') 'Double-precision tests:'

success_DP = .true.

if (.not. all(is_finite(y) .eqv. check_finite)) then
success_DP = .false.
write (*, *) 'True IS_FINITE: ', check_finite
write (*, *) 'IS_FINITE: ', is_finite(y)
write (*, *) 'IEEE_IS_FINITE: ', ieee_is_finite(y)
end if

if (.not. all(is_inf(y) .eqv. check_inf)) then
success_DP = .false.
write (*, *) 'True IS_INF: ', check_inf
write (*, *) 'IS_INF: ', is_inf(y)
write (*, *) 'IEEE_IS_INF: ', ieee_is_inf(y)
end if

if (.not. all(is_posinf(y) .eqv. check_posinf)) then
success_DP = .false.
write (*, *) 'Truth IS_POSINF: ', check_posinf
write (*, *) 'IS_POSINF: ', is_posinf(y)
write (*, *) 'IEEE_IS_POSINF: ', ieee_is_posinf(y)
end if

if (.not. all(is_neginf(y) .eqv. check_neginf)) then
success_DP = .false.
write (*, *) 'True IS_NEGINF: ', check_neginf
write (*, *) 'IS_NEGINF: ', is_neginf(y)
write (*, *) 'IEEE_IS_NEGINF: ', ieee_is_neginf(y)
end if

if (.not. all(is_nan(y) .eqv. check_nan)) then
success_DP = .false.
write (*, *) 'True IS_NAN: ', check_nan
write (*, *) 'IS_NAN: ', is_nan(y)
write (*, *) 'IEEE_IS_NAN: ', ieee_is_nan(y)
end if

success_DP = all(is_finite(y) .eqv. check_finite) .and. all(is_inf(y) .eqv. check_inf) .and. &
& all(is_posinf(y) .eqv. check_posinf) .and. all(is_neginf(y) .eqv. check_neginf) .and. &
& all(is_nan(y) .eqv. check_nan)
!success_DP = all(is_finite(y) .eqv. check_finite) .and. all(is_inf(y) .eqv. check_inf) .and. &
! & all(is_posinf(y) .eqv. check_posinf) .and. all(is_neginf(y) .eqv. check_neginf) .and. &
! & all(is_nan(y) .eqv. check_nan)

if (.not. success_DP) then
write (*, '(1A)') 'Some tests failed. The data is'
Expand Down

0 comments on commit 36a067d

Please sign in to comment.