GCC Code Coverage Report


Directory: ./
File: src/matrix/integrator-euler-python-module-py.cc
Date: 2024-11-13 12:35:17
Exec Total Coverage
Lines: 11 21 52.4%
Branches: 7 26 26.9%

Line Branch Exec Source
1 #include <boost/python/suite/indexing/vector_indexing_suite.hpp>
2 #include <dynamic-graph/python/dynamic-graph-py.hh>
3 #include <dynamic-graph/python/module.hh>
4 #include <sot/core/integrator-euler.hh>
5
6 namespace dg = dynamicgraph;
7 namespace dgc = dynamicgraph::command;
8 namespace dgs = dynamicgraph::sot;
9 using dg::Matrix;
10 using dg::Vector;
11
12 template <typename S, typename C>
13 6 void exposeIntegratorEuler() {
14 typedef dgs::IntegratorEuler<S, C> IE_t;
15
16
1/2
✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
6 const std::string cName = dgc::Value::typeName(dgc::ValueHelper<C>::TypeID);
17
18 dg::python::exposeEntity<IE_t>()
19
2/4
✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
✓ Branch 6 taken 3 times.
✗ Branch 7 not taken.
6 .add_property(
20 "numerators",
21 +[](const IE_t &e) {
22 return dg::python::to_py_list(e.numCoeffs().begin(),
23 e.numCoeffs().end());
24 },
25 +[](IE_t &e, bp::object iterable) {
26 e.numCoeffs(dg::python::to_std_vector<C>(iterable));
27 })
28
1/2
✓ Branch 3 taken 3 times.
✗ Branch 4 not taken.
6 .add_property(
29 "denominators",
30 +[](const IE_t &e) {
31 return dg::python::to_py_list(e.denomCoeffs().begin(),
32 e.denomCoeffs().end());
33 },
34 +[](IE_t &e, bp::object iterable) {
35 e.denomCoeffs(dg::python::to_std_vector<C>(iterable));
36 });
37 6 }
38
39
2/4
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
4 BOOST_PYTHON_MODULE(wrap) {
40
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
2 bp::import("dynamic_graph");
41
42 2 exposeIntegratorEuler<double, double>();
43 2 exposeIntegratorEuler<Vector, double>();
44 2 exposeIntegratorEuler<Vector, Matrix>();
45 2 }
46