GCC Code Coverage Report


Directory: ./
File: unittest/factory/impulse.hpp
Date: 2025-01-30 11:01:55
Exec Total Coverage
Lines: 6 6 100.0%
Branches: 4 6 66.7%

Line Branch Exec Source
1 ///////////////////////////////////////////////////////////////////////////////
2 // BSD 3-Clause License
3 //
4 // Copyright (C) 2019-2023, University of Edinburgh, LAAS-CNRS,
5 // Heriot-Watt University
6 // Copyright note valid unless otherwise stated in individual files.
7 // All rights reserved.
8 ///////////////////////////////////////////////////////////////////////////////
9
10 #ifndef CROCODDYL_IMPULSES_FACTORY_HPP_
11 #define CROCODDYL_IMPULSES_FACTORY_HPP_
12
13 #include "crocoddyl/multibody/impulse-base.hpp"
14 #include "crocoddyl/multibody/impulses/multiple-impulses.hpp"
15 #include "state.hpp"
16
17 namespace crocoddyl {
18 namespace unittest {
19
20 struct ImpulseModelTypes {
21 enum Type {
22 ImpulseModel3D_LOCAL,
23 ImpulseModel3D_WORLD,
24 ImpulseModel3D_LWA,
25 ImpulseModel6D_LOCAL,
26 ImpulseModel6D_WORLD,
27 ImpulseModel6D_LWA,
28 NbImpulseModelTypes
29 };
30 23 static std::vector<Type> init_all() {
31 23 std::vector<Type> v;
32
1/2
✓ Branch 1 taken 23 times.
✗ Branch 2 not taken.
23 v.reserve(NbImpulseModelTypes);
33
2/2
✓ Branch 0 taken 138 times.
✓ Branch 1 taken 23 times.
161 for (int i = 0; i < NbImpulseModelTypes; ++i) {
34
1/2
✓ Branch 1 taken 138 times.
✗ Branch 2 not taken.
138 v.push_back((Type)i);
35 }
36 23 return v;
37 }
38 static const std::vector<Type> all;
39 };
40
41 std::ostream& operator<<(std::ostream& os, const ImpulseModelTypes::Type& type);
42
43 class ImpulseModelFactory {
44 public:
45 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
46
47 explicit ImpulseModelFactory();
48 ~ImpulseModelFactory();
49
50 std::shared_ptr<crocoddyl::ImpulseModelAbstract> create(
51 ImpulseModelTypes::Type impulse_type,
52 PinocchioModelTypes::Type model_type,
53 const std::string frame_name = std::string("")) const;
54 };
55
56 std::shared_ptr<crocoddyl::ImpulseModelAbstract> create_random_impulse();
57
58 } // namespace unittest
59 } // namespace crocoddyl
60
61 #endif // CROCODDYL_IMPULSES_FACTORY_HPP_
62