@@ -183,7 +183,6 @@ TEST_F(Mixing_Test, BroydenSolveLinearEq)
183183 this ->mixing ->init_mixing_data (testdata, 3 , sizeof (double ));
184184
185185 // testing::internal::CaptureStdout();
186- // EXPECT_DEATH(this->mixing->push_data(testdata, x_in.data(), x_out.data(), nullptr, true), "");
187186 EXPECT_EXIT (this ->mixing ->push_data (testdata, x_in.data (), x_out.data (), nullptr , true ),
188187 ::testing::ExitedWithCode (0 ),
189188 "");
@@ -193,7 +192,6 @@ TEST_F(Mixing_Test, BroydenSolveLinearEq)
193192 // testing::HasSubstr("One Broyden_Mixing object can only bind one Mixing_Data object to calculate coefficients"));
194193
195194 // testing::internal::CaptureStdout();
196- // EXPECT_DEATH(this->mixing->cal_coef(testdata, ext_inner_product_mock), "");
197195 EXPECT_EXIT (this ->mixing ->cal_coef (testdata, ext_inner_product_mock), ::testing::ExitedWithCode (0 ), " " );
198196 // output = testing::internal::GetCapturedStdout();
199197 // EXPECT_THAT(
@@ -203,53 +201,53 @@ TEST_F(Mixing_Test, BroydenSolveLinearEq)
203201 clear ();
204202}
205203
206- // TEST_F(Mixing_Test, PulaySolveLinearEq)
207- // {
208- // omp_set_num_threads(1);
209- // init_method("pulay" );
210- // std::vector<double> x_in = xd_ref;
211- // std::vector<double> x_out(3 );
212- // solve_linear_eq <double>( x_in.data(), x_out.data()) ;
213- // EXPECT_NEAR( x_out[0], 2.9999959638248037, DOUBLETHRESHOLD );
214- // EXPECT_NEAR(x_out[1], 2.0000002552633349, DOUBLETHRESHOLD );
215- // EXPECT_NEAR(x_out[2 ], 1.0000019542717642 , DOUBLETHRESHOLD);
216- // ASSERT_EQ(niter, 6 );
217-
218- // this->mixing->reset( );
219- // xdata.reset();
220-
221- // std::vector<std::complex<double>> xc_in = xc_ref ;
222- // std::vector<std::complex<double>> xc_out(3);
223- // solve_linear_eq <std::complex<double>>( xc_in.data(), xc_out.data()) ;
224- // EXPECT_NEAR( xc_out[0].real(), 3.0000063220482565, DOUBLETHRESHOLD );
225- // EXPECT_NEAR(xc_out[1].real (), 1.9999939191147462, DOUBLETHRESHOLD );
226- // EXPECT_NEAR(xc_out[2 ].real(), 0.99999835919718549 , DOUBLETHRESHOLD);
227- // ASSERT_EQ(niter, 6 );
228-
229- // std::string output ;
230- // Base_Mixing::Mixing_Data testdata;
231- // this->mixing->init_mixing_data(testdata, 3, sizeof(double)) ;
232-
233- // testing::internal::CaptureStdout( );
234- // EXPECT_DEATH(this->mixing->push_data(testdata, x_in.data(), x_out.data(), nullptr, true), "");
235- // // EXPECT_EXIT(this->mixing->push_data(testdata, x_in.data(), x_out.data(), nullptr, true),
236- // // ::testing::ExitedWithCode(0 ),
237- // // "");
238- // output = testing::internal::GetCapturedStdout( );
239- // EXPECT_THAT(
240- // output,
241- // testing::HasSubstr("One Pulay_Mixing object can only bind one Mixing_Data object to calculate coefficients"));
242-
243- // testing::internal::CaptureStdout();
244- // EXPECT_DEATH(this->mixing->cal_coef(testdata, ext_inner_product_mock), "" );
245- // // EXPECT_EXIT(this->mixing->cal_coef(testdata, ext_inner_product_mock), ::testing::ExitedWithCode(0), "");
246- // output = testing::internal::GetCapturedStdout();
247- // EXPECT_THAT(
248- // output,
249- // testing::HasSubstr("One Pulay_Mixing object can only bind one Mixing_Data object to calculate coefficients"));
250-
251- // clear();
252- // }
204+ TEST_F (Mixing_Test, PulaySolveLinearEq)
205+ {
206+ # ifdef _OPENMP
207+ omp_set_num_threads ( 1 );
208+ # endif
209+ init_method ( " pulay " );
210+ std::vector <double > x_in = xd_ref ;
211+ std::vector< double > x_out ( 3 );
212+ solve_linear_eq< double >(x_in. data (), x_out. data () );
213+ EXPECT_NEAR (x_out[0 ], 2.9999959638248037 , DOUBLETHRESHOLD);
214+ EXPECT_NEAR (x_out[ 1 ], 2.0000002552633349 , DOUBLETHRESHOLD );
215+ EXPECT_NEAR (x_out[ 2 ], 1.0000019542717642 , DOUBLETHRESHOLD);
216+ EXPECT_EQ (niter, 6 );
217+
218+ this -> mixing -> reset ();
219+ xdata. reset () ;
220+
221+ std::vector <std::complex <double >> xc_in = xc_ref ;
222+ std::vector<std:: complex < double >> xc_out ( 3 );
223+ solve_linear_eq<std:: complex < double >>(xc_in. data (), xc_out. data () );
224+ EXPECT_NEAR (xc_out[0 ].real (), 3.0000063220482565 , DOUBLETHRESHOLD);
225+ EXPECT_NEAR (xc_out[ 1 ]. real (), 1.9999939191147462 , DOUBLETHRESHOLD );
226+ EXPECT_NEAR (xc_out[ 2 ]. real (), 0.99999835919718549 , DOUBLETHRESHOLD);
227+ ASSERT_EQ (niter, 6 ) ;
228+
229+ std::string output ;
230+ Base_Mixing::Mixing_Data testdata;
231+ this -> mixing -> init_mixing_data (testdata, 3 , sizeof ( double ) );
232+
233+ // testing::internal::CaptureStdout();
234+ EXPECT_EXIT ( this -> mixing -> push_data (testdata, x_in. data (), x_out. data (), nullptr , true ),
235+ ::testing::ExitedWithCode ( 0 ),
236+ "" );
237+ // output = testing::internal::GetCapturedStdout();
238+ // EXPECT_THAT(
239+ // output,
240+ // testing::HasSubstr("One Pulay_Mixing object can only bind one Mixing_Data object to calculate coefficients"));
241+
242+ // testing::internal::CaptureStdout( );
243+ EXPECT_EXIT (this ->mixing ->cal_coef (testdata, ext_inner_product_mock), ::testing::ExitedWithCode (0 ), " " );
244+ // output = testing::internal::GetCapturedStdout();
245+ // EXPECT_THAT(
246+ // output,
247+ // testing::HasSubstr("One Pulay_Mixing object can only bind one Mixing_Data object to calculate coefficients"));
248+
249+ clear ();
250+ }
253251
254252TEST_F (Mixing_Test, PlainSolveLinearEq)
255253{
0 commit comments