30 #include "gtest/gtest.h"
32 #include "boost/smart_ptr.hpp"
33 #include "boost/tuple/tuple.hpp"
34 #include "boost/type_traits/remove_cv.hpp"
35 #include "boost/variant/get.hpp"
36 #include "boost/variant/variant.hpp"
42 class SumErrSqExpressionTest :
public ::testing::Test {
45 SumErrSqExpressionTest() {
49 virtual ~SumErrSqExpressionTest() {
56 virtual void SetUp() {
61 virtual void TearDown() {
68 TEST_F(SumErrSqExpressionTest, EvaluateSumErrSqExpression) {
71 double expected = (3.087242557177229e-04*3.087242557177229e-04 +
72 3.127445619624299e-04*3.127445619624299e-04 +
73 3.185324887508158e-04*3.185324887508158e-04) / 3.0;
74 expected =
sqrt(expected);
79 funcs.insert(std::pair<std::string, client::function::type>
80 (
"sumErrSq", errsumsq));
82 std::string testexpr =
"sumErrSq(\"resources/measurement_test.dat\", \"rms_x\", \"resources/test.stat\")";
83 boost::scoped_ptr<Expression>
e(
new Expression(testexpr, funcs));
86 result =
e->evaluate(vars);
91 ASSERT_NEAR(expected, boost::get<0>(result), 1
e-6);
92 ASSERT_TRUE(boost::get<1>(result));
97 int main(
int argc,
char **argv) {
98 ::testing::InitGoogleTest(&argc, argv);
99 return RUN_ALL_TESTS();
Tps< T > sqrt(const Tps< T > &x)
Square root.
std::map< std::string, client::function::type > functionDictionary_t
std::map< std::string, double > variableDictionary_t
int main(int argc, char **argv)
boost::tuple< double, bool > Result_t
constexpr double e
The value of.
boost::function< boost::tuple< double, bool >arguments_t)> type