6
6
#ifndef IINTERACTIONMODETEST_H
7
7
#define IINTERACTIONMODETEST_H
8
8
9
+ #include < memory>
10
+ #include < numeric>
11
+ #include < vector>
12
+
13
+ #include < yarp/dev/IAxisInfo.h>
9
14
#include < yarp/dev/IInteractionMode.h>
10
15
#include < catch2/catch_amalgamated.hpp>
11
16
@@ -14,11 +19,15 @@ using namespace yarp::os;
14
19
15
20
namespace yarp ::dev::tests
16
21
{
17
- inline void exec_iInteractionMode_test_1 (IInteractionMode* iint)
22
+ inline void exec_iInteractionMode_test_1 (IInteractionMode* iint, IAxisInfo* iinfo )
18
23
{
19
24
REQUIRE (iint != nullptr );
25
+ REQUIRE (iinfo != nullptr );
20
26
21
- bool b=false ;
27
+ int ax;
28
+ bool b = iinfo->getAxes (&ax);
29
+ CHECK (b);
30
+ REQUIRE (ax > 0 );
22
31
23
32
yarp::dev::InteractionModeEnum val;
24
33
yarp::dev::InteractionModeEnum ret;
@@ -39,6 +48,25 @@ namespace yarp::dev::tests
39
48
40
49
b = iint->getInteractionMode (0 , &ret);
41
50
CHECK (b);
51
+
52
+ auto modes = std::vector< yarp::dev::InteractionModeEnum>(ax);
53
+ b = iint->getInteractionModes (modes.data ());
54
+ CHECK (b);
55
+
56
+ auto joints = std::vector<int >(ax);
57
+ std::iota (joints.begin (), joints.end (), 0 );
58
+ b = iint->getInteractionModes (ax, joints.data (), modes.data ());
59
+ CHECK (b);
60
+
61
+ for (size_t j = 0 ; j < ax; j++)
62
+ {
63
+ modes[j]= yarp::dev::InteractionModeEnum::VOCAB_IM_STIFF;
64
+ }
65
+ b = iint->setInteractionModes (modes.data ());
66
+ CHECK (b);
67
+ b = iint->setInteractionModes (ax, joints.data (), modes.data ());
68
+ CHECK (b);
69
+
42
70
}
43
71
}
44
72
#endif
0 commit comments