66#ifndef IINTERACTIONMODETEST_H
77#define IINTERACTIONMODETEST_H
88
9+ #include < memory>
10+ #include < numeric>
11+ #include < vector>
12+
13+ #include < yarp/dev/IAxisInfo.h>
914#include < yarp/dev/IInteractionMode.h>
1015#include < catch2/catch_amalgamated.hpp>
1116
@@ -14,11 +19,15 @@ using namespace yarp::os;
1419
1520namespace yarp ::dev::tests
1621{
17- inline void exec_iInteractionMode_test_1 (IInteractionMode* iint)
22+ inline void exec_iInteractionMode_test_1 (IInteractionMode* iint, IAxisInfo* iinfo )
1823 {
1924 REQUIRE (iint != nullptr );
25+ REQUIRE (iinfo != nullptr );
2026
21- bool b=false ;
27+ int ax;
28+ bool b = iinfo->getAxes (&ax);
29+ CHECK (b);
30+ REQUIRE (ax > 0 );
2231
2332 yarp::dev::InteractionModeEnum val;
2433 yarp::dev::InteractionModeEnum ret;
@@ -39,6 +48,25 @@ namespace yarp::dev::tests
3948
4049 b = iint->getInteractionMode (0 , &ret);
4150 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+
4270 }
4371}
4472#endif
0 commit comments