Skip to content

Commit

Permalink
Test:UnitTest for SphericalBesselsjp (#2000)
Browse files Browse the repository at this point in the history
  • Loading branch information
SeptemberMy authored Mar 4, 2023
1 parent 13cb8f4 commit 17c163f
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion source/module_base/test/math_sphbes_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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 <msh ; ++iii)
{
EXPECT_EQ(sjp[iii], 1.0);
}
delete [] sjp;
}

0 comments on commit 17c163f

Please sign in to comment.