Skip to content

Commit

Permalink
Merge pull request #27 from tkoyama010/tkoyama010-patch-2
Browse files Browse the repository at this point in the history
Add Test: #25 0903001
  • Loading branch information
certik authored Oct 16, 2019
2 parents 0b21402 + a3411f3 commit b43bd24
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tests/special/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,7 @@ add_test(test_airybi ${PROJECT_BINARY_DIR}/test_airybi)
add_executable(test_dairybi test_dairybi.f90)
target_link_libraries(test_dairybi fortran_utils)
add_test(test_dairybi ${PROJECT_BINARY_DIR}/test_dairybi)

add_executable(test_spherical_bessel_yn test_spherical_bessel_yn.f90)
target_link_libraries(test_spherical_bessel_yn fortran_utils)
add_test(test_spherical_bessel_yn ${PROJECT_BINARY_DIR}/test_spherical_bessel_yn)
23 changes: 23 additions & 0 deletions tests/special/test_spherical_bessel_yn.f90
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
program test_spherical_bessel_yn
use types, only: dp
use utils, only: assert
use special, only: spherical_bessel_yn
implicit none

! check a few value against the ones computed with SciPy:
! note we use a rather 'large' eps - SciPy computes some the values we compare
! to with CEPHES whereas we use AMOS

integer :: i
real(dp), parameter :: eps = 1e-13_dp
integer, parameter :: ordersReal(7) = [0, 1, 2, 3, 4, 5, 6]
real(dp), parameter :: xReal(7) = [1.1_dp, 3.0_dp, 10.0_dp, 2.1_dp, 5.5_dp, 1.1_dp, 2.0_dp]
real(dp), parameter :: correctResultsRealArg(7) = [-0.4123601103868884_dp, 0.06295916360231597_dp, &
& -0.0650693049937348_dp, -1.2845701875051379_dp, -0.10423608124826822_dp, -570.9016520477184_dp, -97.79165768518729_dp]

! test real argument with integer order:
do i = 1,7
call assert(abs(spherical_bessel_yn(ordersReal(i), xReal(i)) - correctResultsRealArg(i)) < eps)
end do

end program test_spherical_bessel_yn

0 comments on commit b43bd24

Please sign in to comment.