GCC Code Coverage Report


Directory: ./
File: include/tsid/bindings/python/constraint/constraint-inequality.hpp
Date: 2025-03-29 14:29:37
Exec Total Coverage
Lines: 27 35 77.1%
Branches: 42 84 50.0%

Line Branch Exec Source
1 //
2 // Copyright (c) 2018 CNRS
3 //
4 // This file is part of tsid
5 // tsid is free software: you can redistribute it
6 // and/or modify it under the terms of the GNU Lesser General Public
7 // License as published by the Free Software Foundation, either version
8 // 3 of the License, or (at your option) any later version.
9 // tsid is distributed in the hope that it will be
10 // useful, but WITHOUT ANY WARRANTY; without even the implied warranty
11 // of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // General Lesser Public License for more details. You should have
13 // received a copy of the GNU Lesser General Public License along with
14 // tsid If not, see
15 // <http://www.gnu.org/licenses/>.
16 //
17 #ifndef __tsid_python_constriant_inequality_hpp__
18 #define __tsid_python_constriant_inequality_hpp__
19
20 #include "tsid/bindings/python/fwd.hpp"
21
22 #include "tsid/math/constraint-inequality.hpp"
23
24 namespace tsid {
25 namespace python {
26 namespace bp = boost::python;
27
28 template <typename ConstraintInequality>
29 struct ConstraintIneqPythonVisitor
30 : public boost::python::def_visitor<
31 ConstraintIneqPythonVisitor<ConstraintInequality> > {
32 template <class PyClass>
33
34 8 void visit(PyClass& cl) const {
35
2/4
✓ Branch 2 taken 8 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 8 times.
✗ Branch 6 not taken.
8 cl.def(bp::init<std::string>((bp::arg("name")),
36 "Default constructor with name."))
37
4/8
✓ Branch 1 taken 8 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 8 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 8 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 8 times.
✗ Branch 11 not taken.
16 .def(bp::init<std::string, unsigned int, unsigned int>(
38
3/6
✓ Branch 1 taken 8 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 8 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 8 times.
✗ Branch 8 not taken.
24 (bp::arg("name"), bp::arg("row"), bp::arg("col")),
39 "Default constructor with name and size."))
40
5/10
✓ Branch 1 taken 8 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 8 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 8 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 8 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 8 times.
✗ Branch 14 not taken.
24 .def(bp::init<std::string, Eigen::MatrixXd, Eigen::VectorXd,
41 Eigen::VectorXd>(
42
4/8
✓ Branch 1 taken 8 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 8 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 8 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 8 times.
✗ Branch 11 not taken.
32 (bp::arg("name"), bp::arg("A"), bp::arg("lb"), bp::arg("ub")),
43 "Default constructor with name and constraint."))
44
45 16 .add_property("rows", &ConstraintInequality::rows)
46
1/2
✓ Branch 1 taken 8 times.
✗ Branch 2 not taken.
8 .add_property("cols", &ConstraintInequality::cols)
47
2/4
✓ Branch 1 taken 8 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 8 times.
✗ Branch 5 not taken.
16 .def("resize", &ConstraintInequality::resize,
48
2/4
✓ Branch 1 taken 8 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 8 times.
✗ Branch 5 not taken.
16 (bp::arg("r"), bp::arg("c")), "Resize constraint size.")
49
50
1/2
✓ Branch 1 taken 8 times.
✗ Branch 2 not taken.
8 .add_property("isEquality", &ConstraintInequality::isEquality)
51
1/2
✓ Branch 1 taken 8 times.
✗ Branch 2 not taken.
8 .add_property("isInequality", &ConstraintInequality::isInequality)
52
1/2
✓ Branch 1 taken 8 times.
✗ Branch 2 not taken.
8 .add_property("isBound", &ConstraintInequality::isBound)
53
54
2/4
✓ Branch 1 taken 8 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 8 times.
✗ Branch 5 not taken.
8 .add_property("matrix", &ConstraintIneqPythonVisitor::matrix)
55
1/2
✓ Branch 1 taken 8 times.
✗ Branch 2 not taken.
8 .add_property("vector", &ConstraintIneqPythonVisitor::vector)
56
1/2
✓ Branch 1 taken 8 times.
✗ Branch 2 not taken.
8 .add_property("lowerBound", &ConstraintIneqPythonVisitor::lowerBound)
57
1/2
✓ Branch 1 taken 8 times.
✗ Branch 2 not taken.
8 .add_property("upperBound", &ConstraintIneqPythonVisitor::upperBound)
58
59
1/2
✓ Branch 1 taken 8 times.
✗ Branch 2 not taken.
16 .def("setMatrix",
60 (bool (ConstraintInequality::*)(
61 const Eigen::Ref<
62 const Eigen::MatrixXd>))&ConstraintInequality::setMatrix,
63 bp::args("matrix"), "Set Matrix")
64
3/6
✓ Branch 1 taken 8 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 8 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 8 times.
✗ Branch 8 not taken.
16 .def("setVector",
65 (bool (ConstraintInequality::*)(
66 const Eigen::Ref<
67 const Eigen::VectorXd>))&ConstraintInequality::setVector,
68 bp::args("vector"), "Set Vector")
69
2/4
✓ Branch 1 taken 8 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 8 times.
✗ Branch 5 not taken.
16 .def(
70 "setLowerBound",
71 (bool (ConstraintInequality::*)(
72 const Eigen::Ref<const Eigen::VectorXd>))&ConstraintInequality::
73 setLowerBound,
74 bp::args("lb"), "Set LowerBound")
75
2/4
✓ Branch 1 taken 8 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 8 times.
✗ Branch 5 not taken.
8 .def(
76 "setUpperBound",
77 (bool (ConstraintInequality::*)(
78 const Eigen::Ref<const Eigen::VectorXd>))&ConstraintInequality::
79 setUpperBound,
80 bp::args("ub"), "Set UpperBound");
81 8 }
82 static Eigen::MatrixXd matrix(const ConstraintInequality& self) {
83 return self.matrix();
84 }
85 static Eigen::VectorXd vector(const ConstraintInequality& self) {
86 return self.vector();
87 }
88 static Eigen::VectorXd lowerBound(const ConstraintInequality& self) {
89 return self.lowerBound();
90 }
91 static Eigen::VectorXd upperBound(const ConstraintInequality& self) {
92 return self.upperBound();
93 }
94
95 8 static void expose(const std::string& class_name) {
96
1/2
✓ Branch 2 taken 8 times.
✗ Branch 3 not taken.
8 std::string doc = "Constraint Inequality info.";
97
1/2
✓ Branch 3 taken 8 times.
✗ Branch 4 not taken.
8 bp::class_<ConstraintInequality>(class_name.c_str(), doc.c_str(),
98 bp::no_init)
99
1/2
✓ Branch 1 taken 8 times.
✗ Branch 2 not taken.
8 .def(ConstraintIneqPythonVisitor<ConstraintInequality>());
100 8 }
101 };
102 } // namespace python
103 } // namespace tsid
104
105 #endif // ifndef __tsid_python_constriant_inequality_hpp__
106