From 17c163f9dc40060c222f85f85191ef65b068c34c Mon Sep 17 00:00:00 2001 From: Mengyuan Wu <119288223+SeptemberMy@users.noreply.github.com> Date: Sat, 4 Mar 2023 10:53:38 +0800 Subject: [PATCH] Test:UnitTest for SphericalBesselsjp (#2000) --- source/module_base/test/math_sphbes_test.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/source/module_base/test/math_sphbes_test.cpp b/source/module_base/test/math_sphbes_test.cpp index 4fd33f48af..c17edd2321 100644 --- a/source/module_base/test/math_sphbes_test.cpp +++ b/source/module_base/test/math_sphbes_test.cpp @@ -23,7 +23,7 @@ * Tested function: * - Spherical_Bessel. * - Spherical_Bessel_Roots - * + * - overloading of Spherical_Bessel. This funnction sets sjp[i] to 1.0 when i < msh. */ double mean(const double* vect, const int totN) @@ -200,3 +200,16 @@ int main(int argc, char **argv) #endif return result; } + +TEST_F(Sphbes,SphericalBesselsjp) +{ + int iii; + double *sjp = new double[msh]; + ModuleBase::Sphbes::Spherical_Bessel(msh,r,q,l0,jl,sjp); + EXPECT_NEAR(mean(jl,msh)/0.2084468748396,1.0,doublethreshold); + for(int iii = 0 ; iii