10 #include "gtest/gtest.h"
12 #include "boost/smart_ptr.hpp"
13 #include "boost/tuple/tuple.hpp"
14 #include "boost/type_traits/remove_cv.hpp"
15 #include "boost/variant/get.hpp"
16 #include "boost/variant/variant.hpp"
22 class SumErrSqExpressionTest :
public ::testing::Test {
25 SumErrSqExpressionTest() {
29 virtual ~SumErrSqExpressionTest() {
36 virtual void SetUp() {
41 virtual void TearDown() {
48 TEST_F(SumErrSqExpressionTest, EvaluateSumErrSqExpression) {
51 double expected = (3.087242557177229e-04*3.087242557177229e-04 +
52 3.127445619624299e-04*3.127445619624299e-04 +
53 3.185324887508158e-04*3.185324887508158e-04) / 3.0;
54 expected =
sqrt(expected);
59 funcs.insert(std::pair<std::string, client::function::type>
60 (
"sumErrSq", errsumsq));
62 std::string testexpr =
"sumErrSq(\"resources/measurement_test.dat\", \"rms_x\", \"resources/test.stat\")";
63 boost::scoped_ptr<Expression>
e(
new Expression(testexpr, funcs));
66 result =
e->evaluate(vars);
71 ASSERT_NEAR(expected, boost::get<0>(result), 1
e-6);
72 ASSERT_TRUE(boost::get<1>(result));
77 int main(
int argc,
char **argv) {
78 ::testing::InitGoogleTest(&argc, argv);
79 return RUN_ALL_TESTS();
constexpr double e
The value of .
Expression to be evaluated in the framework.
boost::tuple< double, bool > Result_t
Tps< T > sqrt(const Tps< T > &x)
Square root.
int main(int argc, char *argv[])
boost::function< boost::tuple< double, bool >arguments_t)> type
std::map< std::string, double > variableDictionary_t
std::map< std::string, client::function::type > functionDictionary_t