11 #include <gtest/gtest.h>
18 TEST(RuntimeCompiledExpression,SimpleTest)
21 std::map<std::string, double> vars;
25 expr.
compile(
"x^2+x*y+1", vars);
27 EXPECT_NEAR(expr.
eval(), vars[
"x"] * vars[
"x"] + vars[
"x"] * vars[
"y"] + 1.0, 1e-9);
TEST(RuntimeCompiledExpression, SimpleTest)
A wrapper of exprtk runtime expression compiler: it takes a string representing an expression (from a...
void compile(const std::string &expression, const std::map< std::string, double > &variables=std::map< std::string, double >(), const std::string &expr_name_for_error_reporting=std::string())
Initializes the object by compiling an expression.
double eval() const
Evaluates the current value of the precompiled formula.
This base provides a set of functions for maths stuff.
Classes for serialization, sockets, ini-file manipulation, streams, list of properties-values,...
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.