Skip to content

Commit

Permalink
Fix: Float comparison in test
Browse files Browse the repository at this point in the history
  • Loading branch information
krystophny committed Jan 19, 2024
1 parent 24aed5c commit 27c4799
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions tests/source/test_util.f90
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
program test_interpolate
implicit none

real(8), parameter :: TOL = 1.0d-12

call test_arange
call test_linspace

Expand All @@ -14,7 +16,7 @@ subroutine test_arange
expected = (/ 0.0d0, 1.0d0, 2.0d0, 3.0d0, 4.0d0 /)
call arange(0.0d0, 5.0d0, 1.0d0, actual)

if (any(expected /= actual)) error stop
if (maxval(abs(expected - actual)) > TOL) error stop
end subroutine test_arange

subroutine test_linspace
Expand All @@ -25,7 +27,7 @@ subroutine test_linspace
expected = (/ 0.0d0, 1.0d0, 2.0d0, 3.0d0, 4.0d0 /)
call linspace(0.0d0, 4.0d0, 5, actual)

if (any(expected /= actual)) error stop
if (maxval(abs(expected - actual)) > TOL) error stop
end subroutine test_linspace

end program test_interpolate

0 comments on commit 27c4799

Please sign in to comment.