Skip to content

Commit 71900d2

Browse files
committed
improved coverage
1 parent 2e3977d commit 71900d2

File tree

2 files changed

+50
-2
lines changed

2 files changed

+50
-2
lines changed

src/libYARP_dev/src/yarp/dev/tests/ICurrentControlTest.h

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010
#include <yarp/dev/IControlMode.h>
1111
#include <catch2/catch_amalgamated.hpp>
1212

13+
#include <memory>
14+
#include <numeric>
15+
#include <vector>
16+
1317
using namespace yarp::dev;
1418
using namespace yarp::os;
1519

@@ -43,6 +47,22 @@ namespace yarp::dev::tests
4347

4448
b = icurr->getCurrentRange(0, &min, &max);
4549
CHECK(b);
50+
51+
auto mins = std::vector< double >(axis);
52+
auto maxs = std::vector< double >(axis);
53+
auto currs = std::vector< double >(axis);
54+
55+
b = icurr->getCurrentRanges(mins.data(), maxs.data());
56+
CHECK(b);
57+
58+
b = icurr->getCurrents(currs.data());
59+
CHECK(b);
60+
61+
b = icurr->getRefCurrents(currs.data());
62+
CHECK(b);
63+
64+
b = icurr->setRefCurrents(currs.data());
65+
CHECK(b);
4666
}
4767
}
4868

src/libYARP_dev/src/yarp/dev/tests/IInteractionModeTest.h

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@
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

1520
namespace 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

Comments
 (0)