30 #include "gtest/gtest.h"
32 #include "boost/tuple/tuple.hpp"
33 #include "boost/type_traits/remove_cv.hpp"
34 #include "boost/variant/get.hpp"
35 #include "boost/variant/variant.hpp"
41 class SumErrSqExpressionTest :
public ::testing::Test {
44 SumErrSqExpressionTest() {
48 virtual ~SumErrSqExpressionTest() {
55 virtual void SetUp() {
60 virtual void TearDown() {
67 TEST_F(SumErrSqExpressionTest, EvaluateSumErrSqExpression) {
70 double expected = (3.087242557177229e-04*3.087242557177229e-04 +
71 3.127445619624299e-04*3.127445619624299e-04 +
72 3.185324887508158e-04*3.185324887508158e-04) / 3.0;
73 expected =
sqrt(expected);
78 funcs.insert(std::pair<std::string, client::function::type>
79 (
"sumErrSq", errsumsq));
81 std::string testexpr =
"sumErrSq(\"resources/measurement_test.dat\", \"rms_x\", \"resources/test.stat\")";
82 const std::unique_ptr<Expression>
e(
new Expression(testexpr, funcs));
85 result =
e->evaluate(vars);
90 ASSERT_NEAR(expected, boost::get<0>(result), 1
e-6);
91 ASSERT_TRUE(boost::get<1>(result));
96 int main(
int argc,
char **argv) {
97 ::testing::InitGoogleTest(&argc, argv);
98 return RUN_ALL_TESTS();
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
constexpr double e
The value of .
boost::tuple< double, bool > Result_t