From f1496ad6a32766ee567e219001bda9593a7762ff Mon Sep 17 00:00:00 2001 From: Stephane Del Pino <stephane.delpino44@gmail.com> Date: Thu, 20 Feb 2020 11:03:31 +0100 Subject: [PATCH] Rename CMathModule -> MathModule This change is made for consistency. It is done in preparation to the module interface and handling. --- src/language/ASTModulesImporter.cpp | 4 ++-- src/language/CMakeLists.txt | 2 +- src/language/{CMathModule.cpp => MathModule.cpp} | 6 +++--- src/language/{CMathModule.hpp => MathModule.hpp} | 6 +++--- tests/CMakeLists.txt | 2 +- tests/test_CFunctionProcessor.cpp | 4 ++-- tests/{test_CMathModule.cpp => test_MathModule.cpp} | 6 +++--- 7 files changed, 15 insertions(+), 15 deletions(-) rename src/language/{CMathModule.cpp => MathModule.cpp} (96%) rename src/language/{CMathModule.hpp => MathModule.hpp} (88%) rename tests/{test_CMathModule.cpp => test_MathModule.cpp} (99%) diff --git a/src/language/ASTModulesImporter.cpp b/src/language/ASTModulesImporter.cpp index 8436a5eb3..1a164cf24 100644 --- a/src/language/ASTModulesImporter.cpp +++ b/src/language/ASTModulesImporter.cpp @@ -6,7 +6,7 @@ #include <PEGGrammar.hpp> #include <CFunctionEmbedder.hpp> -#include <CMathModule.hpp> +#include <MathModule.hpp> #include <memory> @@ -28,7 +28,7 @@ ASTModulesImporter::_importModule(ASTNode& import_node) std::cout << " * importing '" << rang::fgB::green << module_name << rang::style::reset << "' module\n"; if (module_name == "math") { - CMathModule math_module; + MathModule math_module; CFunctionEmbedderTable& c_function_embedder_table = m_symbol_table.cFunctionEbedderTable(); diff --git a/src/language/CMakeLists.txt b/src/language/CMakeLists.txt index acd8b1e57..21510acb1 100644 --- a/src/language/CMakeLists.txt +++ b/src/language/CMakeLists.txt @@ -31,7 +31,7 @@ add_library( ASTPrinter.cpp ASTSymbolTableBuilder.cpp ASTSymbolInitializationChecker.cpp - CMathModule.cpp + MathModule.cpp PugsParser.cpp) # Additional dependencies diff --git a/src/language/CMathModule.cpp b/src/language/MathModule.cpp similarity index 96% rename from src/language/CMathModule.cpp rename to src/language/MathModule.cpp index 26d8a8f13..934b55be8 100644 --- a/src/language/CMathModule.cpp +++ b/src/language/MathModule.cpp @@ -1,11 +1,11 @@ -#include <CMathModule.hpp> +#include <MathModule.hpp> #include <CFunctionEmbedder.hpp> #include <iostream> void -CMathModule::_addFunction(const std::string& name, std::shared_ptr<ICFunctionEmbedder> c_function_embedder) +MathModule::_addFunction(const std::string& name, std::shared_ptr<ICFunctionEmbedder> c_function_embedder) { auto [i_function, success] = m_name_cfunction_map.insert(std::make_pair(name, c_function_embedder)); // LCOV_EXCL_START @@ -16,7 +16,7 @@ CMathModule::_addFunction(const std::string& name, std::shared_ptr<ICFunctionEmb // LCOV_EXCL_STOP } -CMathModule::CMathModule() +MathModule::MathModule() { this->_addFunction("sqrt", std::make_shared<CFunctionEmbedder<double, double>>( std::function<double(double)>{[](double x) -> double { return std::sqrt(x); }})); diff --git a/src/language/CMathModule.hpp b/src/language/MathModule.hpp similarity index 88% rename from src/language/CMathModule.hpp rename to src/language/MathModule.hpp index 65b0890df..2d7871076 100644 --- a/src/language/CMathModule.hpp +++ b/src/language/MathModule.hpp @@ -8,7 +8,7 @@ #include <unordered_map> class ICFunctionEmbedder; -class CMathModule +class MathModule { private: std::unordered_map<std::string, std::shared_ptr<ICFunctionEmbedder>> m_name_cfunction_map; @@ -22,9 +22,9 @@ class CMathModule return m_name_cfunction_map; } - CMathModule(); + MathModule(); - ~CMathModule() = default; + ~MathModule() = default; }; #endif // CMATH_MODULE_HPP diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 01762e9d1..b22063248 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -44,7 +44,7 @@ add_executable (unit_tests test_CFunctionEmbedder.cpp test_CFunctionEmbedderTable.cpp test_CFunctionProcessor.cpp - test_CMathModule.cpp + test_MathModule.cpp test_ContinueProcessor.cpp test_ConcatExpressionProcessor.cpp test_CRSMatrix.cpp diff --git a/tests/test_CFunctionProcessor.cpp b/tests/test_CFunctionProcessor.cpp index efd3efad7..0809ca9bd 100644 --- a/tests/test_CFunctionProcessor.cpp +++ b/tests/test_CFunctionProcessor.cpp @@ -12,7 +12,7 @@ #include <ASTSymbolTableBuilder.hpp> -#include <CMathModule.hpp> +#include <MathModule.hpp> #define CHECK_CFUNCTION_EVALUATION_RESULT(data, variable_name, expected_value) \ { \ @@ -257,7 +257,7 @@ let z:Z, z = round(-1.2); CHECK_CFUNCTION_EVALUATION_RESULT(data, "z", int64_t{-1}); } - CMathModule math_module; + MathModule math_module; bool missing_test = false; for (auto [cmath_name, c_function] : math_module.getNameCFunctionsMap()) { diff --git a/tests/test_CMathModule.cpp b/tests/test_MathModule.cpp similarity index 99% rename from tests/test_CMathModule.cpp rename to tests/test_MathModule.cpp index f6365bdd7..5239387a5 100644 --- a/tests/test_CMathModule.cpp +++ b/tests/test_MathModule.cpp @@ -3,13 +3,13 @@ #include <CFunctionEmbedder.hpp> #include <CFunctionEmbedderTable.hpp> -#include <CMathModule.hpp> +#include <MathModule.hpp> -TEST_CASE("CMathModule", "[language]") +TEST_CASE("MathModule", "[language]") { rang::setControlMode(rang::control::Off); - CMathModule math_module; + MathModule math_module; const auto& name_cfunction = math_module.getNameCFunctionsMap(); REQUIRE(name_cfunction.size() == 22); -- GitLab