@@ -112,49 +112,8 @@ TEST_F(ElecStatePrintTest, PrintFormat)
112112 std::remove (" test.dat" );
113113}
114114
115- TEST_F (ElecStatePrintTest, PrintBand)
116- {
117- PARAM.input .nspin = 1 ;
118- PARAM.input .nbands = 2 ;
119- PARAM.sys .nbands_l = 2 ;
120- GlobalV::MY_RANK = 0 ;
121-
122- std::ofstream ofs;
123- ofs.open (" test.dat" , std::ios::out);
124- // print eigenvalues
125- elecstate::print_band (elecstate.ekb ,elecstate.wg ,elecstate.klist , 0 , 1 , 0 , ofs);
126- ofs.close ();
127-
128- ifs.open (" test.dat" , std::ios::in);
129- std::string str ((std::istreambuf_iterator<char >(ifs)), std::istreambuf_iterator<char >());
130- EXPECT_THAT (str, testing::HasSubstr (" Energy (eV) & Occupations for spin=1 k-point=1" ));
131- EXPECT_THAT (str, testing::HasSubstr (" 1 13.6057 0.100000" ));
132- EXPECT_THAT (str, testing::HasSubstr (" 2 27.2114 0.200000" ));
133- ifs.close ();
134- std::remove (" test.dat" );
135- }
136115
137116
138- TEST_F (ElecStatePrintTest, PrintBandWarning)
139- {
140- elecstate.ekb (0 , 0 ) = 1.0e11 ;
141- PARAM.input .nspin = 4 ;
142-
143- std::ofstream ofs;
144- ofs.open (" test.dat" , std::ios::out);
145- testing::internal::CaptureStdout ();
146-
147- EXPECT_EXIT (elecstate::print_band (elecstate.ekb ,elecstate.wg ,elecstate.klist , 0 , 1 , 0 , ofs),
148- ::testing::ExitedWithCode (1 ), "");
149-
150- output = testing::internal::GetCapturedStdout ();
151- EXPECT_THAT (output, testing::HasSubstr (" Eigenvalues are too large!" ));
152-
153- ofs.close ();
154-
155- std::remove (" test.dat" );
156- }
157-
158117TEST_F (ElecStatePrintTest, PrintEtot)
159118{
160119 GlobalV::ofs_running.open (" test.dat" , std::ios::out);
0 commit comments