GCC Code Coverage Report


Directory: ./
File: unittest/factory/state.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) 2019-2025, LAAS-CNRS, University of Edinburgh,
5 // Heriot-Watt University
6 // Copyright note valid unless otherwise stated in individual files.
7 // All rights reserved.
8 ///////////////////////////////////////////////////////////////////////////////
9
10 #ifndef CROCODDYL_STATE_FACTORY_HPP_
11 #define CROCODDYL_STATE_FACTORY_HPP_
12
13 #include "crocoddyl/core/numdiff/state.hpp"
14 #include "crocoddyl/core/state-base.hpp"
15 #include "pinocchio_model.hpp"
16
17 namespace crocoddyl {
18 namespace unittest {
19
20 struct StateModelTypes {
21 enum Type {
22 StateVector,
23 StateMultibody_Hector,
24 StateMultibody_TalosArm,
25 StateMultibodyContact2D_TalosArm,
26 StateMultibody_HyQ,
27 StateMultibody_Talos,
28 StateMultibody_RandomHumanoid,
29 NbStateModelTypes
30 };
31 22 static std::vector<Type> init_all() {
32 22 std::vector<Type> v;
33
1/2
✓ Branch 1 taken 22 times.
✗ Branch 2 not taken.
22 v.reserve(NbStateModelTypes);
34
2/2
✓ Branch 0 taken 154 times.
✓ Branch 1 taken 22 times.
176 for (int i = 0; i < NbStateModelTypes; ++i) {
35
1/2
✓ Branch 1 taken 154 times.
✗ Branch 2 not taken.
154 v.push_back((Type)i);
36 }
37 22 return v;
38 }
39 static const std::vector<Type> all;
40 };
41
42 std::ostream& operator<<(std::ostream& os, StateModelTypes::Type type);
43
44 class StateModelFactory {
45 public:
46 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
47
48 explicit StateModelFactory();
49 ~StateModelFactory();
50
51 std::shared_ptr<crocoddyl::StateAbstract> create(
52 StateModelTypes::Type state_type) const;
53 };
54
55 } // namespace unittest
56 } // namespace crocoddyl
57
58 #endif // CROCODDYL_STATE_FACTORY_HPP_
59