Skip to content

Commit a8e5e9a

Browse files
author
zxy.monado
committed
Clean: drop the duplicated chebyshev checkconverge tests
The previous commit stops `checkconverge` and `checkconverge_float` from being compiled out of `MODULE_BASE_math_chebyshev`. They cannot actually run in that target: they reach `GlobalFunc::ddot_real` -> `Parallel_Reduce::reduce_pool`, which needs a valid `POOL_WORLD`, and this target has no MPI setup -- unlike `MODULE_BASE_opt_cg` / `MODULE_BASE_opt_tn`, which #7888 gave `mpi_test_main.cpp`. They are also redundant: both are byte-identical to the tests of the same names in `test_parallel/math_cheby_mpi_test.cpp` (`MODULE_BASE_math_chebyshev_mpi`), which sets `POOL_WORLD` up in its fixture and runs them properly. So delete the copies rather than stand up a second MPI harness for them. No coverage is lost.
1 parent 95204b1 commit a8e5e9a

1 file changed

Lines changed: 1 addition & 71 deletions

File tree

‎source/source_base/test/math_chebyshev_test.cpp‎

Lines changed: 1 addition & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -331,51 +331,6 @@ TEST_F(MathChebyshevTest, tracepolyA)
331331
delete p_chetest;
332332
}
333333

334-
TEST_F(MathChebyshevTest, checkconverge)
335-
{
336-
const int norder = 100;
337-
p_chetest = new ModuleBase::Chebyshev<double>(norder);
338-
auto fun_sigma_y
339-
= [&](std::complex<double>* in, std::complex<double>* out, const int m = 1) { fun.sigma_y(in, out, m); };
340-
341-
std::complex<double>* v = new std::complex<double>[4];
342-
v[0] = 1.0;
343-
v[1] = 0.0;
344-
v[2] = 0.0;
345-
v[3] = 1.0; //[1 0; 0 1]
346-
double tmin = -1.1;
347-
double tmax = 1.1;
348-
bool converge;
349-
converge = p_chetest->checkconverge(fun_sigma_y, v, 2, 2, tmax, tmin, 0.2);
350-
EXPECT_TRUE(converge);
351-
converge = p_chetest->checkconverge(fun_sigma_y, v + 2, 2, 2, tmax, tmin, 0.2);
352-
EXPECT_TRUE(converge);
353-
EXPECT_NEAR(tmin, -1.1, 1e-8);
354-
EXPECT_NEAR(tmax, 1.1, 1e-8);
355-
356-
tmax = -1.1;
357-
converge = p_chetest->checkconverge(fun_sigma_y, v, 2, 2, tmax, tmin, 2.2);
358-
EXPECT_TRUE(converge);
359-
EXPECT_NEAR(tmin, -1.1, 1e-8);
360-
EXPECT_NEAR(tmax, 1.1, 1e-8);
361-
362-
// not converge
363-
v[0] = std::complex<double>(0, 1), v[1] = 1;
364-
fun.factor = 1.5;
365-
tmin = -1.1, tmax = 1.1;
366-
converge = p_chetest->checkconverge(fun_sigma_y, v, 2, 2, tmax, tmin, 0.2);
367-
EXPECT_FALSE(converge);
368-
369-
fun.factor = -1.5;
370-
tmin = -1.1, tmax = 1.1;
371-
converge = p_chetest->checkconverge(fun_sigma_y, v, 2, 2, tmax, tmin, 0.2);
372-
EXPECT_FALSE(converge);
373-
fun.factor = 1;
374-
375-
delete[] v;
376-
delete p_chetest;
377-
}
378-
379334
TEST_F(MathChebyshevTest, recurs)
380335
{
381336
testing::internal::CaptureStdout();
@@ -616,30 +571,5 @@ TEST_F(MathChebyshevTest, tracepolyA_float)
616571
delete p_fchetest;
617572
}
618573

619-
TEST_F(MathChebyshevTest, checkconverge_float)
620-
{
621-
const int norder = 100;
622-
p_fchetest = new ModuleBase::Chebyshev<float>(norder);
623-
624-
std::complex<float>* v = new std::complex<float>[4];
625-
v[0] = 1.0;
626-
v[1] = 0.0;
627-
v[2] = 0.0;
628-
v[3] = 1.0; //[1 0; 0 1]
629-
float tmin = -1.1;
630-
float tmax = 1.1;
631-
bool converge;
632-
633-
auto fun_sigma_yf
634-
= [&](std::complex<float>* in, std::complex<float>* out, const int m = 1) { fun.sigma_y(in, out, m); };
635-
converge = p_fchetest->checkconverge(fun_sigma_yf, v, 2, 2, tmax, tmin, 0.2);
636-
EXPECT_TRUE(converge);
637-
converge = p_fchetest->checkconverge(fun_sigma_yf, v + 2, 2, 2, tmax, tmin, 0.2);
638-
EXPECT_TRUE(converge);
639-
EXPECT_NEAR(tmin, -1.1, 1e-6);
640-
EXPECT_NEAR(tmax, 1.1, 1e-6);
574+
#endif
641575

642-
delete[] v;
643-
delete p_fchetest;
644-
}
645-
#endif

0 commit comments

Comments
 (0)