GCC Code Coverage Report


Directory: ./
File: unittest/factory/control.hpp
Date: 2025-03-26 19:23:43
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) 2021, LAAS-CNRS, University of Edinburgh, University of Trento
5 // Copyright note valid unless otherwise stated in individual files.
6 // All rights reserved.
7 ///////////////////////////////////////////////////////////////////////////////
8
9 #ifndef CROCODDYL_CONTROL_FACTORY_HPP_
10 #define CROCODDYL_CONTROL_FACTORY_HPP_
11
12 #include <vector>
13
14 #include "crocoddyl/core/control-base.hpp"
15 #include "crocoddyl/core/fwd.hpp"
16
17 namespace crocoddyl {
18 namespace unittest {
19
20 struct ControlTypes {
21 enum Type { PolyZero, PolyOne, PolyTwoRK3, PolyTwoRK4, NbControlTypes };
22 22 static std::vector<Type> init_all() {
23 22 std::vector<Type> v;
24
1/2
✓ Branch 1 taken 22 times.
✗ Branch 2 not taken.
22 v.reserve(NbControlTypes);
25
2/2
✓ Branch 0 taken 88 times.
✓ Branch 1 taken 22 times.
110 for (int i = 0; i < NbControlTypes; ++i) {
26
1/2
✓ Branch 1 taken 88 times.
✗ Branch 2 not taken.
88 v.push_back((Type)i);
27 }
28 22 return v;
29 }
30 static const std::vector<Type> all;
31 };
32
33 std::ostream& operator<<(std::ostream& os, ControlTypes::Type type);
34
35 class ControlFactory {
36 public:
37 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
38
39 explicit ControlFactory();
40 ~ControlFactory();
41
42 std::shared_ptr<crocoddyl::ControlParametrizationModelAbstract> create(
43 ControlTypes::Type control_type, const std::size_t nu) const;
44 };
45
46 } // namespace unittest
47 } // namespace crocoddyl
48
49 #endif // CROCODDYL_CONTROL_FACTORY_HPP_
50