Skip to content

Commit

Permalink
[BUG] Unnecessary "utbot_abs_error" constant added to the test #405
Browse files Browse the repository at this point in the history
- remove obsolete `ABS_ERROR`
- printer optimization
  • Loading branch information
alexey-utkin committed Sep 6, 2022
1 parent 4fdd4d9 commit a31a708
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
1 change: 0 additions & 1 deletion server/src/utils/PrinterUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ namespace PrinterUtils {

const std::string EXPECTED = "expected";
const std::string ACTUAL = "actual";
const std::string ABS_ERROR = "utbot_abs_error";
const std::string EXPECT_ = "EXPECT_";
const std::string EXPECT_FLOAT_EQ = "EXPECT_FLOAT_EQ";
const std::string EXPECT_DOUBLE_EQ = "EXPECT_DOUBLE_EQ";
Expand Down
1 change: 0 additions & 1 deletion server/src/utils/PrinterUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ namespace PrinterUtils {
extern const std::string EXPECT_DOUBLE_EQ;

extern const std::string ACTUAL;
extern const std::string ABS_ERROR;
extern const std::string EXPECT_;
extern const std::string EQ;

Expand Down
10 changes: 5 additions & 5 deletions server/src/visitors/AssertsVisitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,16 @@ namespace visitor {

AssertsVisitor::FunctionSignature AssertsVisitor::processExpect(
const types::Type &type, const std::string &gtestMacro, std::vector<std::string> &&args) {
std::string macroName = PrinterUtils::EXPECT_ + gtestMacro;
if (types::TypesHandler::isFloatingPointType(type) && gtestMacro == PrinterUtils::EQ) {
const types::TypeName &typeName = type.baseType();
if (typeName == "float") {
return VerboseAssertsVisitor::FunctionSignature{ PrinterUtils::EXPECT_FLOAT_EQ, std::move(args) };
}
if (typeName == "double" || typeName == "long double") {
return VerboseAssertsVisitor::FunctionSignature{ PrinterUtils::EXPECT_DOUBLE_EQ, std::move(args) };
macroName = PrinterUtils::EXPECT_FLOAT_EQ;
} else if (typeName == "double" || typeName == "long double") {
macroName = PrinterUtils::EXPECT_DOUBLE_EQ;
}
}
return VerboseAssertsVisitor::FunctionSignature{ PrinterUtils::EXPECT_ + gtestMacro, std::move(args) };
return VerboseAssertsVisitor::FunctionSignature{ macroName, std::move(args) };
}

std::string AssertsVisitor::getDecorateActualVarName(const std::string &access) {
Expand Down

0 comments on commit a31a708

Please sign in to comment.