MyraMath
expr_list


Source: tests/expression/expr.cpp

1 
2 // ========================================================================= //
3 // This file is part of MyraMath, copyright (c) 2014-2019 by Ryan A Chilton //
4 // and distributed by MyraCore, LLC. See LICENSE.txt for license terms. //
5 // ========================================================================= //
6 
14 
15 // Reporting.
16 #include <tests/myratest.h>
17 
18 using namespace myra;
19 
20 #ifdef MYRAMATH_ENABLE_CPP11
21 
22 ADD_TEST("expr_list","[expression]")
23  {
24  auto E = expr({1.0,2.0,3.0});
25  REQUIRE( E.evaluate({0}) == 1.0 );
26  REQUIRE( E.evaluate({1}) == 2.0 );
27  REQUIRE( E.evaluate({2}) == 3.0 );
28  }
29 
30 #endif
31 
32 ADD_TEST("expr_vector","[expression]")
33  {
34  std::vector<double> v;
35  v.push_back(1.0);
36  v.push_back(2.0);
37  v.push_back(3.0);
38  auto E = expr(v);
39  REQUIRE( E.evaluate({0}) == 1.0 );
40  REQUIRE( E.evaluate({1}) == 2.0 );
41  REQUIRE( E.evaluate({2}) == 3.0 );
42  }
Overloads expr() for std::vector<Number> and (C++11 only) std::initializer_list<Number> ...
An interface used to fill containers from Expression&#39;s (see Matrix::evaluate(), for example)...
Definition: syntax.dox:1


Results: [PASS]


Go back to Summary of /test programs.