Skip to content

Commit

Permalink
fix fixed_weights in elecstate tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mohanchen committed Jun 8, 2024
1 parent 2b150a9 commit 0140e99
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions source/module_elecstate/test/elecstate_base_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ TEST_F(ElecStateTest,FixedWeights)
{
ocp_kb[i] = 1.0;
}
elecstate->fixed_weights(ocp_kb);
elecstate->fixed_weights(ocp_kb, GlobalV::NBANDS, GlobalV::nelec);
EXPECT_EQ(elecstate->wg(0, 0), 1.0);
EXPECT_EQ(elecstate->wg(klist->get_nks()-1, GlobalV::NBANDS-1), 1.0);
EXPECT_TRUE(elecstate->skip_weights);
Expand All @@ -428,7 +428,7 @@ TEST_F(ElecStateDeathTest,FixedWeightsWarning1)
ocp_kb[i] = 1.0;
}
testing::internal::CaptureStdout();
EXPECT_EXIT(elecstate->fixed_weights(ocp_kb), ::testing::ExitedWithCode(0), "");
EXPECT_EXIT(elecstate->fixed_weights(ocp_kb, GlobalV::NBANDS, GlobalV::nelec), ::testing::ExitedWithCode(0), "");
output = testing::internal::GetCapturedStdout();
EXPECT_THAT(output, testing::HasSubstr("size of occupation array is wrong , please check ocp_set"));
}
Expand All @@ -448,7 +448,7 @@ TEST_F(ElecStateDeathTest,FixedWeightsWarning2)
ocp_kb[i] = 1.0;
}
testing::internal::CaptureStdout();
EXPECT_EXIT(elecstate->fixed_weights(ocp_kb), ::testing::ExitedWithCode(0), "");
EXPECT_EXIT(elecstate->fixed_weights(ocp_kb, GlobalV::NBANDS, GlobalV::nelec), ::testing::ExitedWithCode(0), "");
output = testing::internal::GetCapturedStdout();
EXPECT_THAT(output, testing::HasSubstr("total number of occupations is wrong , please check ocp_set"));
}
Expand Down Expand Up @@ -703,4 +703,4 @@ TEST_F(ElecStateTest, CalculateWeightsGWeightsTwoFermi)


#undef protected
#undef private
#undef private

0 comments on commit 0140e99

Please sign in to comment.