Skip to content

Commit 855e4e4

Browse files
committed
add abs(v-v_in) in CHECK_DOUBLE func.
1 parent f9ae72f commit 855e4e4

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

source/module_base/test/tool_check_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ TEST_F(ToolCheckTest, Double)
103103
EXPECT_THAT(output,testing::HasSubstr("not match"));
104104
// quit check
105105
testing::internal::CaptureStdout();
106-
EXPECT_DEATH(ModuleBase::CHECK_DOUBLE(ifs, 0.23002), "");
106+
EXPECT_DEATH(ModuleBase::CHECK_DOUBLE(ifs, 0.22998), "");
107107
output = testing::internal::GetCapturedStdout();
108108
EXPECT_THAT(output,testing::HasSubstr("NOTICE"));
109109
ifs.close();

source/module_base/tool_check.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ void CHECK_DOUBLE(std::ifstream &ifs,const double &v,bool quit)
5151
const double tiny = 1.0e-5;
5252
double v_in;
5353
ifs >> v_in;
54-
if( (v - v_in) > tiny )
54+
if( fabs(v - v_in) > tiny )
5555
{
5656
if(quit)
5757
{

0 commit comments

Comments
 (0)