GCC Code Coverage Report


Directory: ./
File: unittest/visitor.cpp
Date: 2025-04-30 16:14:33
Exec Total Coverage
Lines: 98 98 100.0%
Branches: 223 430 51.9%

Line Branch Exec Source
1 //
2 // Copyright (c) 2015-2019 CNRS INRIA
3 //
4
5 #include "pinocchio/multibody/model.hpp"
6 #include "pinocchio/multibody/data.hpp"
7 #include "pinocchio/multibody/visitor.hpp"
8
9 #include <iostream>
10
11 #include <boost/test/unit_test.hpp>
12 #include <boost/utility/binary.hpp>
13
14 namespace bf = boost::fusion;
15
16 struct SimpleUnaryVisitor1 : public pinocchio::fusion::JointUnaryVisitorBase<SimpleUnaryVisitor1>
17 {
18
19 typedef bf::vector<const pinocchio::Model &, pinocchio::Data &, pinocchio::JointIndex> ArgsType;
20
21 template<typename JointModel>
22 48 static void algo(
23 const pinocchio::JointModelBase<JointModel> & jmodel,
24 pinocchio::JointDataBase<typename JointModel::JointDataDerived> & jdata,
25 const pinocchio::Model & model,
26 pinocchio::Data & data,
27 pinocchio::JointIndex jindex)
28 {
29 PINOCCHIO_UNUSED_VARIABLE(jdata);
30 PINOCCHIO_UNUSED_VARIABLE(model);
31 PINOCCHIO_UNUSED_VARIABLE(data);
32
6/12
✓ Branch 3 taken 24 times.
✗ Branch 4 not taken.
✓ Branch 9 taken 24 times.
✗ Branch 10 not taken.
✓ Branch 12 taken 24 times.
✗ Branch 13 not taken.
✓ Branch 15 taken 24 times.
✗ Branch 16 not taken.
✓ Branch 18 taken 24 times.
✗ Branch 19 not taken.
✗ Branch 23 not taken.
✓ Branch 24 taken 24 times.
48 BOOST_CHECK(jindex == jmodel.id());
33
2/4
✓ Branch 3 taken 24 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 24 times.
✗ Branch 7 not taken.
48 std::cout << "joint name: " << jmodel.shortname() << std::endl;
34 48 }
35 };
36
37 struct SimpleUnaryVisitor2 : public pinocchio::fusion::JointUnaryVisitorBase<SimpleUnaryVisitor2>
38 {
39
40 typedef bf::vector<const pinocchio::Model &, pinocchio::Data &, pinocchio::JointIndex> ArgsType;
41
42 template<typename JointModel>
43 48 static void algo(
44 const pinocchio::JointModelBase<JointModel> & jmodel,
45 const pinocchio::Model & model,
46 pinocchio::Data & data,
47 pinocchio::JointIndex jindex)
48 {
49 PINOCCHIO_UNUSED_VARIABLE(model);
50 PINOCCHIO_UNUSED_VARIABLE(data);
51 PINOCCHIO_UNUSED_VARIABLE(jindex);
52
6/12
✓ Branch 3 taken 24 times.
✗ Branch 4 not taken.
✓ Branch 9 taken 24 times.
✗ Branch 10 not taken.
✓ Branch 12 taken 24 times.
✗ Branch 13 not taken.
✓ Branch 15 taken 24 times.
✗ Branch 16 not taken.
✓ Branch 18 taken 24 times.
✗ Branch 19 not taken.
✗ Branch 23 not taken.
✓ Branch 24 taken 24 times.
48 BOOST_CHECK(jindex == jmodel.id());
53
2/4
✓ Branch 3 taken 24 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 24 times.
✗ Branch 7 not taken.
48 std::cout << "joint name: " << jmodel.shortname() << std::endl;
54 48 }
55 };
56
57 struct SimpleUnaryVisitor3 : public pinocchio::fusion::JointUnaryVisitorBase<SimpleUnaryVisitor3>
58 {
59
60 template<typename JointModel>
61 48 static void algo(const pinocchio::JointModelBase<JointModel> & jmodel)
62 {
63
6/12
✓ Branch 3 taken 24 times.
✗ Branch 4 not taken.
✓ Branch 9 taken 24 times.
✗ Branch 10 not taken.
✓ Branch 12 taken 24 times.
✗ Branch 13 not taken.
✓ Branch 16 taken 24 times.
✗ Branch 17 not taken.
✓ Branch 19 taken 24 times.
✗ Branch 20 not taken.
✗ Branch 25 not taken.
✓ Branch 26 taken 24 times.
48 BOOST_CHECK(!jmodel.shortname().empty());
64
2/4
✓ Branch 3 taken 24 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 24 times.
✗ Branch 7 not taken.
48 std::cout << "joint name: " << jmodel.shortname() << std::endl;
65 48 }
66 };
67
68 struct SimpleUnaryVisitor4 : public pinocchio::fusion::JointUnaryVisitorBase<SimpleUnaryVisitor4>
69 {
70
71 template<typename JointModel>
72 48 static void algo(
73 const pinocchio::JointModelBase<JointModel> & jmodel,
74 pinocchio::JointDataBase<typename JointModel::JointDataDerived> & jdata)
75 {
76 PINOCCHIO_UNUSED_VARIABLE(jdata);
77
6/12
✓ Branch 3 taken 24 times.
✗ Branch 4 not taken.
✓ Branch 9 taken 24 times.
✗ Branch 10 not taken.
✓ Branch 12 taken 24 times.
✗ Branch 13 not taken.
✓ Branch 16 taken 24 times.
✗ Branch 17 not taken.
✓ Branch 19 taken 24 times.
✗ Branch 20 not taken.
✗ Branch 25 not taken.
✓ Branch 26 taken 24 times.
48 BOOST_CHECK(!jmodel.shortname().empty());
78
2/4
✓ Branch 3 taken 24 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 24 times.
✗ Branch 7 not taken.
48 std::cout << "joint name: " << jmodel.shortname() << std::endl;
79 48 }
80 };
81
82 struct SimpleBinaryVisitor1 : public pinocchio::fusion::JointBinaryVisitorBase<SimpleBinaryVisitor1>
83 {
84
85 typedef bf::vector<const pinocchio::Model &, pinocchio::Data &, pinocchio::JointIndex> ArgsType;
86
87 template<typename JointModel1, typename JointModel2>
88 48 static void algo(
89 const pinocchio::JointModelBase<JointModel1> & jmodel1,
90 const pinocchio::JointModelBase<JointModel2> & jmodel2,
91 pinocchio::JointDataBase<typename JointModel1::JointDataDerived> & jdata1,
92 pinocchio::JointDataBase<typename JointModel2::JointDataDerived> & jdata2,
93 const pinocchio::Model & model,
94 pinocchio::Data & data,
95 pinocchio::JointIndex jindex)
96 {
97 PINOCCHIO_UNUSED_VARIABLE(jdata1);
98 PINOCCHIO_UNUSED_VARIABLE(jdata2);
99 PINOCCHIO_UNUSED_VARIABLE(model);
100 PINOCCHIO_UNUSED_VARIABLE(data);
101 PINOCCHIO_UNUSED_VARIABLE(jindex);
102
6/12
✓ Branch 3 taken 24 times.
✗ Branch 4 not taken.
✓ Branch 9 taken 24 times.
✗ Branch 10 not taken.
✓ Branch 12 taken 24 times.
✗ Branch 13 not taken.
✓ Branch 15 taken 24 times.
✗ Branch 16 not taken.
✓ Branch 18 taken 24 times.
✗ Branch 19 not taken.
✗ Branch 23 not taken.
✓ Branch 24 taken 24 times.
48 BOOST_CHECK(jindex == jmodel1.id());
103
6/12
✓ Branch 3 taken 24 times.
✗ Branch 4 not taken.
✓ Branch 9 taken 24 times.
✗ Branch 10 not taken.
✓ Branch 12 taken 24 times.
✗ Branch 13 not taken.
✓ Branch 15 taken 24 times.
✗ Branch 16 not taken.
✓ Branch 18 taken 24 times.
✗ Branch 19 not taken.
✗ Branch 23 not taken.
✓ Branch 24 taken 24 times.
48 BOOST_CHECK(jindex == jmodel2.id());
104
2/4
✓ Branch 3 taken 24 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 24 times.
✗ Branch 7 not taken.
48 std::cout << "joint1 name: " << jmodel1.shortname() << std::endl;
105
2/4
✓ Branch 3 taken 24 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 24 times.
✗ Branch 7 not taken.
48 std::cout << "joint2 name: " << jmodel2.shortname() << std::endl;
106 }
107 };
108
109 struct SimpleBinaryVisitor2 : public pinocchio::fusion::JointBinaryVisitorBase<SimpleBinaryVisitor2>
110 {
111
112 typedef bf::vector<const pinocchio::Model &, pinocchio::Data &, pinocchio::JointIndex> ArgsType;
113
114 template<typename JointModel1, typename JointModel2>
115 48 static void algo(
116 const pinocchio::JointModelBase<JointModel1> & jmodel1,
117 const pinocchio::JointModelBase<JointModel2> & jmodel2,
118 const pinocchio::Model & model,
119 pinocchio::Data & data,
120 pinocchio::JointIndex jindex)
121 {
122 PINOCCHIO_UNUSED_VARIABLE(model);
123 PINOCCHIO_UNUSED_VARIABLE(data);
124 PINOCCHIO_UNUSED_VARIABLE(jindex);
125
6/12
✓ Branch 3 taken 24 times.
✗ Branch 4 not taken.
✓ Branch 9 taken 24 times.
✗ Branch 10 not taken.
✓ Branch 12 taken 24 times.
✗ Branch 13 not taken.
✓ Branch 15 taken 24 times.
✗ Branch 16 not taken.
✓ Branch 18 taken 24 times.
✗ Branch 19 not taken.
✗ Branch 23 not taken.
✓ Branch 24 taken 24 times.
48 BOOST_CHECK(jindex == jmodel1.id());
126
6/12
✓ Branch 3 taken 24 times.
✗ Branch 4 not taken.
✓ Branch 9 taken 24 times.
✗ Branch 10 not taken.
✓ Branch 12 taken 24 times.
✗ Branch 13 not taken.
✓ Branch 15 taken 24 times.
✗ Branch 16 not taken.
✓ Branch 18 taken 24 times.
✗ Branch 19 not taken.
✗ Branch 23 not taken.
✓ Branch 24 taken 24 times.
48 BOOST_CHECK(jindex == jmodel2.id());
127
2/4
✓ Branch 3 taken 24 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 24 times.
✗ Branch 7 not taken.
48 std::cout << "joint1 name: " << jmodel1.shortname() << std::endl;
128
2/4
✓ Branch 3 taken 24 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 24 times.
✗ Branch 7 not taken.
48 std::cout << "joint2 name: " << jmodel2.shortname() << std::endl;
129 }
130 };
131
132 struct SimpleBinaryVisitor3 : public pinocchio::fusion::JointBinaryVisitorBase<SimpleBinaryVisitor3>
133 {
134 template<typename JointModel1, typename JointModel2>
135 48 static void algo(
136 const pinocchio::JointModelBase<JointModel1> & jmodel1,
137 const pinocchio::JointModelBase<JointModel2> & jmodel2)
138 {
139
6/12
✓ Branch 3 taken 24 times.
✗ Branch 4 not taken.
✓ Branch 9 taken 24 times.
✗ Branch 10 not taken.
✓ Branch 12 taken 24 times.
✗ Branch 13 not taken.
✓ Branch 16 taken 24 times.
✗ Branch 17 not taken.
✓ Branch 19 taken 24 times.
✗ Branch 20 not taken.
✗ Branch 25 not taken.
✓ Branch 26 taken 24 times.
48 BOOST_CHECK(!jmodel1.shortname().empty());
140
6/12
✓ Branch 3 taken 24 times.
✗ Branch 4 not taken.
✓ Branch 9 taken 24 times.
✗ Branch 10 not taken.
✓ Branch 12 taken 24 times.
✗ Branch 13 not taken.
✓ Branch 16 taken 24 times.
✗ Branch 17 not taken.
✓ Branch 19 taken 24 times.
✗ Branch 20 not taken.
✗ Branch 25 not taken.
✓ Branch 26 taken 24 times.
48 BOOST_CHECK(!jmodel2.shortname().empty());
141
2/4
✓ Branch 3 taken 24 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 24 times.
✗ Branch 7 not taken.
48 std::cout << "joint1 name: " << jmodel1.shortname() << std::endl;
142
2/4
✓ Branch 3 taken 24 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 24 times.
✗ Branch 7 not taken.
48 std::cout << "joint2 name: " << jmodel2.shortname() << std::endl;
143 }
144 };
145
146 struct SimpleBinaryVisitor4 : public pinocchio::fusion::JointBinaryVisitorBase<SimpleBinaryVisitor4>
147 {
148 template<typename JointModel1, typename JointModel2>
149 48 static void algo(
150 const pinocchio::JointModelBase<JointModel1> & jmodel1,
151 const pinocchio::JointModelBase<JointModel2> & jmodel2,
152 pinocchio::JointDataBase<typename JointModel1::JointDataDerived> & jdata1,
153 pinocchio::JointDataBase<typename JointModel2::JointDataDerived> & jdata2)
154 {
155 PINOCCHIO_UNUSED_VARIABLE(jdata1);
156 PINOCCHIO_UNUSED_VARIABLE(jdata2);
157
6/12
✓ Branch 3 taken 24 times.
✗ Branch 4 not taken.
✓ Branch 9 taken 24 times.
✗ Branch 10 not taken.
✓ Branch 12 taken 24 times.
✗ Branch 13 not taken.
✓ Branch 16 taken 24 times.
✗ Branch 17 not taken.
✓ Branch 19 taken 24 times.
✗ Branch 20 not taken.
✗ Branch 25 not taken.
✓ Branch 26 taken 24 times.
48 BOOST_CHECK(!jmodel1.shortname().empty());
158
6/12
✓ Branch 3 taken 24 times.
✗ Branch 4 not taken.
✓ Branch 9 taken 24 times.
✗ Branch 10 not taken.
✓ Branch 12 taken 24 times.
✗ Branch 13 not taken.
✓ Branch 16 taken 24 times.
✗ Branch 17 not taken.
✓ Branch 19 taken 24 times.
✗ Branch 20 not taken.
✗ Branch 25 not taken.
✓ Branch 26 taken 24 times.
48 BOOST_CHECK(!jmodel2.shortname().empty());
159
2/4
✓ Branch 3 taken 24 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 24 times.
✗ Branch 7 not taken.
48 std::cout << "joint1 name: " << jmodel1.shortname() << std::endl;
160
2/4
✓ Branch 3 taken 24 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 24 times.
✗ Branch 7 not taken.
48 std::cout << "joint2 name: " << jmodel2.shortname() << std::endl;
161
2/4
✓ Branch 3 taken 24 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 24 times.
✗ Branch 7 not taken.
48 std::cout << "jdata1 name: " << jdata1.classname() << std::endl;
162
2/4
✓ Branch 3 taken 24 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 24 times.
✗ Branch 7 not taken.
48 std::cout << "jdata2 name: " << jdata2.classname() << std::endl;
163 }
164 };
165
166 BOOST_AUTO_TEST_SUITE(BOOST_TEST_MODULE)
167
168 template<typename JointModel_>
169 struct init;
170
171 template<typename JointModel_>
172 struct init
173 {
174 80 static JointModel_ run(const pinocchio::Model & /* model*/)
175 {
176 80 JointModel_ jmodel;
177 80 return jmodel;
178 }
179 };
180
181 template<typename Scalar, int Options>
182 struct init<pinocchio::JointModelRevoluteUnalignedTpl<Scalar, Options>>
183 {
184 typedef pinocchio::JointModelRevoluteUnalignedTpl<Scalar, Options> JointModel;
185
186 2 static JointModel run(const pinocchio::Model & /* model*/)
187 {
188 typedef typename JointModel::Vector3 Vector3;
189
2/4
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 2 times.
✗ Branch 6 not taken.
2 JointModel jmodel(Vector3::Random().normalized());
190
191 2 return jmodel;
192 }
193 };
194
195 template<typename Scalar, int Options>
196 struct init<pinocchio::JointModelRevoluteUnboundedUnalignedTpl<Scalar, Options>>
197 {
198 typedef pinocchio::JointModelRevoluteUnboundedUnalignedTpl<Scalar, Options> JointModel;
199
200 2 static JointModel run(const pinocchio::Model & /* model*/)
201 {
202 typedef typename JointModel::Vector3 Vector3;
203
2/4
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 2 times.
✗ Branch 6 not taken.
2 JointModel jmodel(Vector3::Random().normalized());
204
205 2 return jmodel;
206 }
207 };
208
209 template<typename Scalar, int Options>
210 struct init<pinocchio::JointModelPrismaticUnalignedTpl<Scalar, Options>>
211 {
212 typedef pinocchio::JointModelPrismaticUnalignedTpl<Scalar, Options> JointModel;
213
214 2 static JointModel run(const pinocchio::Model & /* model*/)
215 {
216 typedef typename JointModel::Vector3 Vector3;
217
2/4
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 2 times.
✗ Branch 6 not taken.
2 JointModel jmodel(Vector3::Random().normalized());
218
219 2 return jmodel;
220 }
221 };
222
223 template<typename Scalar, int Options, template<typename, int> class JointCollection>
224 struct init<pinocchio::JointModelTpl<Scalar, Options, JointCollection>>
225 {
226 typedef pinocchio::JointModelTpl<Scalar, Options, JointCollection> JointModel;
227
228 static JointModel run(const pinocchio::Model & /* model*/)
229 {
230 typedef pinocchio::JointModelRevoluteTpl<Scalar, Options, 0> JointModelRX;
231 JointModel jmodel((JointModelRX()));
232
233 return jmodel;
234 }
235 };
236
237 template<typename Scalar, int Options, template<typename, int> class JointCollection>
238 struct init<pinocchio::JointModelCompositeTpl<Scalar, Options, JointCollection>>
239 {
240 typedef pinocchio::JointModelCompositeTpl<Scalar, Options, JointCollection> JointModel;
241
242 2 static JointModel run(const pinocchio::Model & /* model*/)
243 {
244 typedef pinocchio::JointModelRevoluteTpl<Scalar, Options, 0> JointModelRX;
245 typedef pinocchio::JointModelRevoluteTpl<Scalar, Options, 1> JointModelRY;
246 typedef pinocchio::JointModelRevoluteTpl<Scalar, Options, 2> JointModelRZ;
247
248
2/4
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 2 times.
✗ Branch 6 not taken.
2 JointModel jmodel(JointModelRX(), pinocchio::SE3::Random());
249
3/6
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 2 times.
✗ Branch 8 not taken.
2 jmodel.addJoint(JointModelRY(), pinocchio::SE3::Random());
250
3/6
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 2 times.
✗ Branch 8 not taken.
2 jmodel.addJoint(JointModelRZ(), pinocchio::SE3::Random());
251
252 2 return jmodel;
253 }
254 };
255
256 template<typename Scalar, int Options, template<typename, int> class JointCollection>
257 struct init<pinocchio::JointModelMimicTpl<Scalar, Options, JointCollection>>
258 {
259 typedef pinocchio::JointModelMimicTpl<Scalar, Options, JointCollection> JointModel;
260
261 2 static JointModel run(const pinocchio::Model & model)
262 {
263 typedef pinocchio::JointModelRevoluteTpl<Scalar, Options, 0> JointModelRX;
264
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
2 JointModelRX jmodel_ref = init<JointModelRX>::run(model);
265
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
2 jmodel_ref.setIndexes(0, 0, 0, 0);
266
267
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
2 JointModel jmodel(jmodel_ref, 1., 0.);
268
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
2 jmodel.setIndexes(1, 0, 0, 0);
269
270 4 return jmodel;
271 }
272 };
273
274 struct AppendJointToModel
275 {
276 2 AppendJointToModel(pinocchio::Model & model)
277 2 : model(model)
278 {
279 2 }
280
281 template<typename JointModel>
282 96 void operator()(const pinocchio::JointModelBase<JointModel> &) const
283 {
284
1/2
✓ Branch 1 taken 48 times.
✗ Branch 2 not taken.
96 JointModel jmodel = init<JointModel>::run(model);
285
4/8
✓ Branch 1 taken 48 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 48 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 48 times.
✗ Branch 8 not taken.
✓ Branch 11 taken 48 times.
✗ Branch 12 not taken.
96 model.addJoint(model.joints.size() - 1, jmodel, pinocchio::SE3::Random(), jmodel.classname());
286 96 }
287
288 pinocchio::Model & model;
289 };
290
291
33/66
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 9 not taken.
✓ Branch 11 taken 1 times.
✗ Branch 12 not taken.
✓ Branch 14 taken 1 times.
✗ Branch 15 not taken.
✓ Branch 19 taken 1 times.
✗ Branch 20 not taken.
✓ Branch 23 taken 1 times.
✗ Branch 24 not taken.
✓ Branch 27 taken 1 times.
✗ Branch 28 not taken.
✓ Branch 30 taken 1 times.
✗ Branch 31 not taken.
✓ Branch 33 taken 1 times.
✗ Branch 34 not taken.
✓ Branch 36 taken 1 times.
✗ Branch 37 not taken.
✓ Branch 41 taken 1 times.
✗ Branch 42 not taken.
✓ Branch 45 taken 1 times.
✗ Branch 46 not taken.
✓ Branch 48 taken 1 times.
✗ Branch 49 not taken.
✓ Branch 52 taken 1 times.
✗ Branch 53 not taken.
✓ Branch 55 taken 1 times.
✗ Branch 56 not taken.
✓ Branch 58 taken 1 times.
✗ Branch 59 not taken.
✓ Branch 61 taken 1 times.
✗ Branch 62 not taken.
✓ Branch 66 taken 1 times.
✗ Branch 67 not taken.
✓ Branch 70 taken 1 times.
✗ Branch 71 not taken.
✓ Branch 73 taken 1 times.
✗ Branch 74 not taken.
✓ Branch 77 taken 1 times.
✗ Branch 78 not taken.
✓ Branch 80 taken 1 times.
✗ Branch 81 not taken.
✓ Branch 83 taken 1 times.
✗ Branch 84 not taken.
✓ Branch 86 taken 1 times.
✗ Branch 87 not taken.
✓ Branch 91 taken 1 times.
✗ Branch 92 not taken.
✓ Branch 95 taken 1 times.
✗ Branch 96 not taken.
✓ Branch 98 taken 1 times.
✗ Branch 99 not taken.
✓ Branch 102 taken 1 times.
✗ Branch 103 not taken.
✓ Branch 105 taken 1 times.
✗ Branch 106 not taken.
✓ Branch 108 taken 1 times.
✗ Branch 109 not taken.
✓ Branch 111 taken 1 times.
✗ Branch 112 not taken.
✓ Branch 116 taken 1 times.
✗ Branch 117 not taken.
4 BOOST_AUTO_TEST_CASE(test_run_over_all_joints_unary_visitor)
292 {
293 using namespace pinocchio;
294
295 typedef JointCollectionDefault::JointModelVariant Variant;
296
297
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 Model model;
298
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
2 boost::mpl::for_each<Variant::types>(AppendJointToModel(model));
299
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 Data data(model);
300
301
2/2
✓ Branch 0 taken 24 times.
✓ Branch 1 taken 1 times.
50 for (Model::JointIndex i = 1; i < (Model::JointIndex)model.njoints; ++i)
302 {
303
1/2
✓ Branch 1 taken 24 times.
✗ Branch 2 not taken.
48 SimpleUnaryVisitor1::run(
304
1/2
✓ Branch 1 taken 24 times.
✗ Branch 2 not taken.
96 model.joints[i], data.joints[i], SimpleUnaryVisitor1::ArgsType(model, data, i));
305 }
306
307
2/2
✓ Branch 0 taken 24 times.
✓ Branch 1 taken 1 times.
50 for (Model::JointIndex i = 1; i < (Model::JointIndex)model.njoints; ++i)
308 {
309
2/4
✓ Branch 1 taken 24 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 24 times.
✗ Branch 6 not taken.
48 SimpleUnaryVisitor2::run(model.joints[i], SimpleUnaryVisitor2::ArgsType(model, data, i));
310 }
311
312
2/2
✓ Branch 0 taken 24 times.
✓ Branch 1 taken 1 times.
50 for (Model::JointIndex i = 1; i < (Model::JointIndex)model.njoints; ++i)
313 {
314
1/2
✓ Branch 2 taken 24 times.
✗ Branch 3 not taken.
48 SimpleUnaryVisitor3::run(model.joints[i]);
315 }
316
317
2/2
✓ Branch 0 taken 24 times.
✓ Branch 1 taken 1 times.
50 for (Model::JointIndex i = 1; i < (Model::JointIndex)model.njoints; ++i)
318 {
319
1/2
✓ Branch 3 taken 24 times.
✗ Branch 4 not taken.
48 SimpleUnaryVisitor4::run(model.joints[i], data.joints[i]);
320 }
321 2 }
322
323
33/66
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 9 not taken.
✓ Branch 11 taken 1 times.
✗ Branch 12 not taken.
✓ Branch 14 taken 1 times.
✗ Branch 15 not taken.
✓ Branch 19 taken 1 times.
✗ Branch 20 not taken.
✓ Branch 23 taken 1 times.
✗ Branch 24 not taken.
✓ Branch 27 taken 1 times.
✗ Branch 28 not taken.
✓ Branch 30 taken 1 times.
✗ Branch 31 not taken.
✓ Branch 33 taken 1 times.
✗ Branch 34 not taken.
✓ Branch 36 taken 1 times.
✗ Branch 37 not taken.
✓ Branch 41 taken 1 times.
✗ Branch 42 not taken.
✓ Branch 45 taken 1 times.
✗ Branch 46 not taken.
✓ Branch 48 taken 1 times.
✗ Branch 49 not taken.
✓ Branch 52 taken 1 times.
✗ Branch 53 not taken.
✓ Branch 55 taken 1 times.
✗ Branch 56 not taken.
✓ Branch 58 taken 1 times.
✗ Branch 59 not taken.
✓ Branch 61 taken 1 times.
✗ Branch 62 not taken.
✓ Branch 66 taken 1 times.
✗ Branch 67 not taken.
✓ Branch 70 taken 1 times.
✗ Branch 71 not taken.
✓ Branch 73 taken 1 times.
✗ Branch 74 not taken.
✓ Branch 77 taken 1 times.
✗ Branch 78 not taken.
✓ Branch 80 taken 1 times.
✗ Branch 81 not taken.
✓ Branch 83 taken 1 times.
✗ Branch 84 not taken.
✓ Branch 86 taken 1 times.
✗ Branch 87 not taken.
✓ Branch 91 taken 1 times.
✗ Branch 92 not taken.
✓ Branch 95 taken 1 times.
✗ Branch 96 not taken.
✓ Branch 98 taken 1 times.
✗ Branch 99 not taken.
✓ Branch 102 taken 1 times.
✗ Branch 103 not taken.
✓ Branch 105 taken 1 times.
✗ Branch 106 not taken.
✓ Branch 108 taken 1 times.
✗ Branch 109 not taken.
✓ Branch 111 taken 1 times.
✗ Branch 112 not taken.
✓ Branch 116 taken 1 times.
✗ Branch 117 not taken.
4 BOOST_AUTO_TEST_CASE(test_run_over_all_joints_binary_visitor)
324 {
325 using namespace pinocchio;
326
327 typedef JointCollectionDefault::JointModelVariant Variant;
328
329
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 Model model;
330
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
2 boost::mpl::for_each<Variant::types>(AppendJointToModel(model));
331
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 Data data(model);
332
333
2/2
✓ Branch 0 taken 24 times.
✓ Branch 1 taken 1 times.
50 for (Model::JointIndex i = 1; i < (Model::JointIndex)model.njoints; ++i)
334 {
335
1/2
✓ Branch 1 taken 24 times.
✗ Branch 2 not taken.
48 SimpleBinaryVisitor1::run(
336 48 model.joints[i], model.joints[i], data.joints[i], data.joints[i],
337
1/2
✓ Branch 1 taken 24 times.
✗ Branch 2 not taken.
96 SimpleBinaryVisitor1::ArgsType(model, data, i));
338 }
339
340
2/2
✓ Branch 0 taken 24 times.
✓ Branch 1 taken 1 times.
50 for (Model::JointIndex i = 1; i < (Model::JointIndex)model.njoints; ++i)
341 {
342
1/2
✓ Branch 1 taken 24 times.
✗ Branch 2 not taken.
48 SimpleBinaryVisitor2::run(
343
1/2
✓ Branch 1 taken 24 times.
✗ Branch 2 not taken.
96 model.joints[i], model.joints[i], SimpleBinaryVisitor2::ArgsType(model, data, i));
344 }
345
346
2/2
✓ Branch 0 taken 24 times.
✓ Branch 1 taken 1 times.
50 for (Model::JointIndex i = 1; i < (Model::JointIndex)model.njoints; ++i)
347 {
348
1/2
✓ Branch 3 taken 24 times.
✗ Branch 4 not taken.
48 SimpleBinaryVisitor3::run(model.joints[i], model.joints[i]);
349 }
350
351
2/2
✓ Branch 0 taken 24 times.
✓ Branch 1 taken 1 times.
50 for (Model::JointIndex i = 1; i < (Model::JointIndex)model.njoints; ++i)
352 {
353
1/2
✓ Branch 5 taken 24 times.
✗ Branch 6 not taken.
48 SimpleBinaryVisitor4::run(model.joints[i], model.joints[i], data.joints[i], data.joints[i]);
354 }
355 2 }
356
357 BOOST_AUTO_TEST_SUITE_END()
358