From 73e6d8cd153005971cb2ca66464486c9b7188e30 Mon Sep 17 00:00:00 2001 From: fintarin Date: Wed, 25 Oct 2023 11:16:10 +0300 Subject: [PATCH] Rename PowerF to PowerFunction --- include/fintamath/core/MathObjectTypes.hpp | 2 +- .../powers/{PowF.hpp => PowerFunction.hpp} | 4 +-- src/fintamath/config/ExpressionConfig.cpp | 4 +-- src/fintamath/config/ParserConfig.cpp | 4 +-- src/fintamath/functions/powers/PowF.cpp | 11 -------- .../functions/powers/PowerFunction.cpp | 11 ++++++++ .../{PowFTests.cpp => PowerFunctionTests.cpp} | 28 +++++++++---------- tests/src/parser/ParserTests.cpp | 4 +-- 8 files changed, 34 insertions(+), 34 deletions(-) rename include/fintamath/functions/powers/{PowF.hpp => PowerFunction.hpp} (71%) delete mode 100644 src/fintamath/functions/powers/PowF.cpp create mode 100644 src/fintamath/functions/powers/PowerFunction.cpp rename tests/src/functions/powers/{PowFTests.cpp => PowerFunctionTests.cpp} (68%) diff --git a/include/fintamath/core/MathObjectTypes.hpp b/include/fintamath/core/MathObjectTypes.hpp index b175cfb63..ca3c9289f 100644 --- a/include/fintamath/core/MathObjectTypes.hpp +++ b/include/fintamath/core/MathObjectTypes.hpp @@ -112,7 +112,7 @@ class MathObjectType { Derivative, Integral, Frac, - PowF, + PowerFunction, Floor, Ceil, diff --git a/include/fintamath/functions/powers/PowF.hpp b/include/fintamath/functions/powers/PowerFunction.hpp similarity index 71% rename from include/fintamath/functions/powers/PowF.hpp rename to include/fintamath/functions/powers/PowerFunction.hpp index b80702374..fad34997d 100644 --- a/include/fintamath/functions/powers/PowF.hpp +++ b/include/fintamath/functions/powers/PowerFunction.hpp @@ -5,14 +5,14 @@ namespace fintamath { -class PowF : public IFunctionCRTP { +class PowerFunction : public IFunctionCRTP { public: std::string toString() const override { return "pow"; } static MathObjectType getTypeStatic() { - return MathObjectType::PowF; + return MathObjectType::PowerFunction; } protected: diff --git a/src/fintamath/config/ExpressionConfig.cpp b/src/fintamath/config/ExpressionConfig.cpp index 332d56c33..b85fdb08c 100644 --- a/src/fintamath/config/ExpressionConfig.cpp +++ b/src/fintamath/config/ExpressionConfig.cpp @@ -62,7 +62,7 @@ #include "fintamath/functions/other/Percent.hpp" #include "fintamath/functions/powers/Exp.hpp" #include "fintamath/functions/powers/Pow.hpp" -#include "fintamath/functions/powers/PowF.hpp" +#include "fintamath/functions/powers/PowerFunction.hpp" #include "fintamath/functions/powers/Root.hpp" #include "fintamath/functions/powers/Sqrt.hpp" #include "fintamath/functions/trigonometry/Acos.hpp" @@ -172,7 +172,7 @@ struct ExpressionConfig { return PowExpression(std::move(args.front()), std::move(args.back())).clone(); }); - Expression::registerFunctionExpressionMaker([](ArgumentPtrVector &&args) { + Expression::registerFunctionExpressionMaker([](ArgumentPtrVector &&args) { return PowExpression(std::move(args.front()), std::move(args.back())).clone(); }); diff --git a/src/fintamath/config/ParserConfig.cpp b/src/fintamath/config/ParserConfig.cpp index 162db00ca..036a2b588 100644 --- a/src/fintamath/config/ParserConfig.cpp +++ b/src/fintamath/config/ParserConfig.cpp @@ -56,7 +56,7 @@ #include "fintamath/functions/other/Percent.hpp" #include "fintamath/functions/powers/Exp.hpp" #include "fintamath/functions/powers/Pow.hpp" -#include "fintamath/functions/powers/PowF.hpp" +#include "fintamath/functions/powers/PowerFunction.hpp" #include "fintamath/functions/powers/Root.hpp" #include "fintamath/functions/powers/Sqrt.hpp" #include "fintamath/functions/trigonometry/Acos.hpp" @@ -225,7 +225,7 @@ struct ParserConfig { IFunction::registerType(); IFunction::registerType(); IFunction::registerType(); - IFunction::registerType(); + IFunction::registerType(); IFunction::registerType(); IFunction::registerType(); diff --git a/src/fintamath/functions/powers/PowF.cpp b/src/fintamath/functions/powers/PowF.cpp deleted file mode 100644 index f33075be6..000000000 --- a/src/fintamath/functions/powers/PowF.cpp +++ /dev/null @@ -1,11 +0,0 @@ -#include "fintamath/functions/powers/PowF.hpp" - -#include "fintamath/functions/powers/Pow.hpp" - -namespace fintamath { - -std::unique_ptr PowF::call(const ArgumentRefVector &argsVect) const { - return Pow()(argsVect); -} - -} diff --git a/src/fintamath/functions/powers/PowerFunction.cpp b/src/fintamath/functions/powers/PowerFunction.cpp new file mode 100644 index 000000000..fa7b680fa --- /dev/null +++ b/src/fintamath/functions/powers/PowerFunction.cpp @@ -0,0 +1,11 @@ +#include "fintamath/functions/powers/PowerFunction.hpp" + +#include "fintamath/functions/powers/Pow.hpp" + +namespace fintamath { + +std::unique_ptr PowerFunction::call(const ArgumentRefVector &argsVect) const { + return Pow()(argsVect); +} + +} diff --git a/tests/src/functions/powers/PowFTests.cpp b/tests/src/functions/powers/PowerFunctionTests.cpp similarity index 68% rename from tests/src/functions/powers/PowFTests.cpp rename to tests/src/functions/powers/PowerFunctionTests.cpp index 7c3bdc7bb..311765ff7 100644 --- a/tests/src/functions/powers/PowFTests.cpp +++ b/tests/src/functions/powers/PowerFunctionTests.cpp @@ -1,6 +1,6 @@ #include "gtest/gtest.h" -#include "fintamath/functions/powers/PowF.hpp" +#include "fintamath/functions/powers/PowerFunction.hpp" #include "fintamath/core/IArithmetic.hpp" #include "fintamath/exceptions/UndefinedException.hpp" @@ -12,17 +12,17 @@ using namespace fintamath; -const PowF f; +const PowerFunction f; -TEST(PowFTests, toStringTest) { +TEST(PowerFunctionTests, toStringTest) { EXPECT_EQ(f.toString(), "pow"); } -TEST(PowFTests, getFunctionTypeTest) { +TEST(PowerFunctionTests, getFunctionTypeTest) { EXPECT_EQ(f.getFunctionType(), IFunction::Type::Binary); } -TEST(PowFTests, callTest) { +TEST(PowerFunctionTests, callTest) { EXPECT_EQ(f(Integer(3), Integer(2))->toString(), "9"); EXPECT_EQ(f(Rational(-10), Rational(-3))->toString(), "-1/1000"); @@ -36,7 +36,7 @@ TEST(PowFTests, callTest) { EXPECT_THROW(f(Integer(1), Integer(1), Integer(1)), InvalidInputFunctionException); } -TEST(PowFTests, doArgsMatchTest) { +TEST(PowerFunctionTests, doArgsMatchTest) { Integer a; EXPECT_FALSE(f.doArgsMatch({})); @@ -45,19 +45,19 @@ TEST(PowFTests, doArgsMatchTest) { EXPECT_FALSE(f.doArgsMatch({a, a, a})); } -TEST(PowFTests, equalsTest) { +TEST(PowerFunctionTests, equalsTest) { EXPECT_EQ(f, f); - EXPECT_EQ(f, PowF()); - EXPECT_EQ(PowF(), f); - EXPECT_EQ(f, cast(PowF())); - EXPECT_EQ(cast(PowF()), f); + EXPECT_EQ(f, PowerFunction()); + EXPECT_EQ(PowerFunction(), f); + EXPECT_EQ(f, cast(PowerFunction())); + EXPECT_EQ(cast(PowerFunction()), f); EXPECT_NE(f, Sub()); EXPECT_NE(Sub(), f); EXPECT_NE(f, UnaryPlus()); EXPECT_NE(UnaryPlus(), f); } -TEST(PowFTests, getTypeTest) { - EXPECT_EQ(PowF::getTypeStatic(), MathObjectType::PowF); - EXPECT_EQ(PowF().getType(), MathObjectType::PowF); +TEST(PowerFunctionTests, getTypeTest) { + EXPECT_EQ(PowerFunction::getTypeStatic(), MathObjectType::PowerFunction); + EXPECT_EQ(PowerFunction().getType(), MathObjectType::PowerFunction); } diff --git a/tests/src/parser/ParserTests.cpp b/tests/src/parser/ParserTests.cpp index b7e3ab92e..3d0bcd4b5 100644 --- a/tests/src/parser/ParserTests.cpp +++ b/tests/src/parser/ParserTests.cpp @@ -51,7 +51,7 @@ #include "fintamath/functions/other/Percent.hpp" #include "fintamath/functions/powers/Exp.hpp" #include "fintamath/functions/powers/Pow.hpp" -#include "fintamath/functions/powers/PowF.hpp" +#include "fintamath/functions/powers/PowerFunction.hpp" #include "fintamath/functions/powers/Root.hpp" #include "fintamath/functions/powers/Sqrt.hpp" #include "fintamath/functions/trigonometry/Acos.hpp" @@ -244,7 +244,7 @@ TEST(ParserTests, parseFunctionTest) { EXPECT_TRUE(is(IFunction::parse("derivative"))); EXPECT_TRUE(is(IFunction::parse("integral"))); EXPECT_TRUE(is(IFunction::parse("frac"))); - EXPECT_TRUE(is(IFunction::parse("pow"))); + EXPECT_TRUE(is(IFunction::parse("pow"))); EXPECT_TRUE(is(IFunction::parse("floor"))); EXPECT_TRUE(is(IFunction::parse("ceil")));