GCC Code Coverage Report


Directory: ./
File: unittest/factory/control.cpp
Date: 2025-06-03 08:14:12
Exec Total Coverage
Lines: 0 43 0.0%
Functions: 0 4 0.0%
Branches: 0 27 0.0%

Line Branch Exec Source
1 ///////////////////////////////////////////////////////////////////////////////
2 // BSD 3-Clause License
3 //
4 // Copyright (C) 2021, University of Edinburgh, University of Trento
5 // Copyright note valid unless otherwise stated in individual files.
6 // All rights reserved.
7 ///////////////////////////////////////////////////////////////////////////////
8
9 #include "control.hpp"
10
11 #include "crocoddyl/core/controls/poly-one.hpp"
12 #include "crocoddyl/core/controls/poly-two-rk.hpp"
13 #include "crocoddyl/core/controls/poly-zero.hpp"
14
15 namespace crocoddyl {
16 namespace unittest {
17
18 const std::vector<ControlTypes::Type> ControlTypes::all(
19 ControlTypes::init_all());
20
21 ✗ std::ostream& operator<<(std::ostream& os, ControlTypes::Type type) {
22 ✗ switch (type) {
23 ✗ case ControlTypes::PolyZero:
24 ✗ os << "PolyZero";
25 ✗ break;
26 ✗ case ControlTypes::PolyOne:
27 ✗ os << "PolyOne";
28 ✗ break;
29 ✗ case ControlTypes::PolyTwoRK3:
30 ✗ os << "PolyTwoRK3";
31 ✗ break;
32 ✗ case ControlTypes::PolyTwoRK4:
33 ✗ os << "PolyTwoRK4";
34 ✗ break;
35 ✗ case ControlTypes::NbControlTypes:
36 ✗ os << "NbControlTypes";
37 ✗ break;
38 ✗ default:
39 ✗ break;
40 }
41 ✗ return os;
42 }
43
44 ✗ ControlFactory::ControlFactory() {}
45 ✗ ControlFactory::~ControlFactory() {}
46
47 std::shared_ptr<crocoddyl::ControlParametrizationModelAbstract>
48 ✗ ControlFactory::create(ControlTypes::Type control_type,
49 const std::size_t nu) const {
50 ✗ std::shared_ptr<crocoddyl::ControlParametrizationModelAbstract> control;
51 ✗ switch (control_type) {
52 ✗ case ControlTypes::PolyZero:
53 control =
54 ✗ std::make_shared<crocoddyl::ControlParametrizationModelPolyZero>(nu);
55 ✗ break;
56 ✗ case ControlTypes::PolyOne:
57 control =
58 ✗ std::make_shared<crocoddyl::ControlParametrizationModelPolyOne>(nu);
59 ✗ break;
60 ✗ case ControlTypes::PolyTwoRK3:
61 control =
62 ✗ std::make_shared<crocoddyl::ControlParametrizationModelPolyTwoRK>(
63 ✗ nu, RKType::three);
64 ✗ break;
65 ✗ case ControlTypes::PolyTwoRK4:
66 control =
67 ✗ std::make_shared<crocoddyl::ControlParametrizationModelPolyTwoRK>(
68 ✗ nu, RKType::four);
69 ✗ break;
70 ✗ default:
71 ✗ throw_pretty(__FILE__ ": Wrong ControlTypes::Type given");
72 break;
73 }
74 ✗ return control;
75 ✗ }
76
77 } // namespace unittest
78 } // namespace crocoddyl
79