Main MRPT website > C++ reference for MRPT 1.5.9
CRuntimeCompiledExpression_unittest.cpp
Go to the documentation of this file.
1 /* +---------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | http://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2017, Individual contributors, see AUTHORS file |
6  | See: http://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See details in http://www.mrpt.org/License |
8  +---------------------------------------------------------------------------+ */
9 
11 #include <gtest/gtest.h>
12 
13 using namespace mrpt;
14 using namespace mrpt::utils;
15 using namespace mrpt::math;
16 using namespace std;
17 
18 TEST(RuntimeCompiledExpression,SimpleTest)
19 {
21  std::map<std::string, double> vars;
22 
23  vars["x"] = 5.0;
24  vars["y"] = 3.0;
25  expr.compile("x^2+x*y+1", vars);
26 
27  EXPECT_NEAR(expr.eval(), vars["x"] * vars["x"] + vars["x"] * vars["y"] + 1.0, 1e-9);
28 }
29 
30 
Classes for serialization, sockets, ini-file manipulation, streams, list of properties-values, timewatch, extensions to STL.
Definition: zip.h:16
STL namespace.
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.
This base provides a set of functions for maths stuff.
Definition: CArrayNumeric.h:19
double eval() const
Evaluates the current value of the precompiled formula.
TEST(RuntimeCompiledExpression, SimpleTest)
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.



Page generated by Doxygen 1.8.14 for MRPT 1.5.9 Git: 690a4699f Wed Apr 15 19:29:53 2020 +0200 at miƩ abr 15 19:30:12 CEST 2020