GCC Code Coverage Report


Directory: ./
File: unittest/factory/control.hpp
Date: 2025-01-16 08:47:40
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 #include "crocoddyl/core/utils/exception.hpp"
17
18 namespace crocoddyl {
19 namespace unittest {
20
21 struct ControlTypes {
22 enum Type { PolyZero, PolyOne, PolyTwoRK3, PolyTwoRK4, NbControlTypes };
23 23 static std::vector<Type> init_all() {
24 23 std::vector<Type> v;
25
1/2
✓ Branch 1 taken 23 times.
✗ Branch 2 not taken.
23 v.reserve(NbControlTypes);
26
2/2
✓ Branch 0 taken 92 times.
✓ Branch 1 taken 23 times.
115 for (int i = 0; i < NbControlTypes; ++i) {
27
1/2
✓ Branch 1 taken 92 times.
✗ Branch 2 not taken.
92 v.push_back((Type)i);
28 }
29 23 return v;
30 }
31 static const std::vector<Type> all;
32 };
33
34 std::ostream& operator<<(std::ostream& os, ControlTypes::Type type);
35
36 class ControlFactory {
37 public:
38 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
39
40 explicit ControlFactory();
41 ~ControlFactory();
42
43 boost::shared_ptr<crocoddyl::ControlParametrizationModelAbstract> create(
44 ControlTypes::Type control_type, const std::size_t nu) const;
45 };
46
47 } // namespace unittest
48 } // namespace crocoddyl
49
50 #endif // CROCODDYL_CONTROL_FACTORY_HPP_
51