Skip to content
Snippets Groups Projects
Commit f1496ad6 authored by Stéphane Del Pino's avatar Stéphane Del Pino
Browse files

Rename CMathModule -> MathModule

This change is made for consistency. It is done in preparation to the module
interface and handling.
parent 713aba1c
No related branches found
No related tags found
1 merge request!37Feature/language
......@@ -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();
......
......@@ -31,7 +31,7 @@ add_library(
ASTPrinter.cpp
ASTSymbolTableBuilder.cpp
ASTSymbolInitializationChecker.cpp
CMathModule.cpp
MathModule.cpp
PugsParser.cpp)
# Additional dependencies
......
#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); }}));
......
......@@ -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
......@@ -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
......
......@@ -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()) {
......
......@@ -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);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment