From a31a7081985ccb699c1d42687ea71e42e516a4fb Mon Sep 17 00:00:00 2001 From: Alexey Utkin Date: Tue, 6 Sep 2022 09:32:35 +0300 Subject: [PATCH] [BUG] Unnecessary "utbot_abs_error" constant added to the test #405 - remove obsolete `ABS_ERROR` - printer optimization --- server/src/utils/PrinterUtils.cpp | 1 - server/src/utils/PrinterUtils.h | 1 - server/src/visitors/AssertsVisitor.cpp | 10 +++++----- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/server/src/utils/PrinterUtils.cpp b/server/src/utils/PrinterUtils.cpp index e14a66305..ebb851fb9 100644 --- a/server/src/utils/PrinterUtils.cpp +++ b/server/src/utils/PrinterUtils.cpp @@ -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"; diff --git a/server/src/utils/PrinterUtils.h b/server/src/utils/PrinterUtils.h index f48bb354e..106525cbe 100644 --- a/server/src/utils/PrinterUtils.h +++ b/server/src/utils/PrinterUtils.h @@ -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; diff --git a/server/src/visitors/AssertsVisitor.cpp b/server/src/visitors/AssertsVisitor.cpp index 5510ae25a..291a27fb7 100644 --- a/server/src/visitors/AssertsVisitor.cpp +++ b/server/src/visitors/AssertsVisitor.cpp @@ -30,16 +30,16 @@ namespace visitor { AssertsVisitor::FunctionSignature AssertsVisitor::processExpect( const types::Type &type, const std::string >estMacro, std::vector &&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) {