From 71900d2b83ba61ef34576301a94d7587fd2fc42d Mon Sep 17 00:00:00 2001 From: Marco Randazzo Date: Thu, 30 Nov 2023 12:46:31 +0100 Subject: [PATCH] improved coverage --- .../src/yarp/dev/tests/ICurrentControlTest.h | 20 ++++++++++++ .../src/yarp/dev/tests/IInteractionModeTest.h | 32 +++++++++++++++++-- 2 files changed, 50 insertions(+), 2 deletions(-) diff --git a/src/libYARP_dev/src/yarp/dev/tests/ICurrentControlTest.h b/src/libYARP_dev/src/yarp/dev/tests/ICurrentControlTest.h index e81a04c7eb..b478a768b5 100644 --- a/src/libYARP_dev/src/yarp/dev/tests/ICurrentControlTest.h +++ b/src/libYARP_dev/src/yarp/dev/tests/ICurrentControlTest.h @@ -10,6 +10,10 @@ #include #include +#include +#include +#include + using namespace yarp::dev; using namespace yarp::os; @@ -43,6 +47,22 @@ namespace yarp::dev::tests b = icurr->getCurrentRange(0, &min, &max); CHECK(b); + + auto mins = std::vector< double >(axis); + auto maxs = std::vector< double >(axis); + auto currs = std::vector< double >(axis); + + b = icurr->getCurrentRanges(mins.data(), maxs.data()); + CHECK(b); + + b = icurr->getCurrents(currs.data()); + CHECK(b); + + b = icurr->getRefCurrents(currs.data()); + CHECK(b); + + b = icurr->setRefCurrents(currs.data()); + CHECK(b); } } diff --git a/src/libYARP_dev/src/yarp/dev/tests/IInteractionModeTest.h b/src/libYARP_dev/src/yarp/dev/tests/IInteractionModeTest.h index d6211fa08a..59c3fb00d3 100644 --- a/src/libYARP_dev/src/yarp/dev/tests/IInteractionModeTest.h +++ b/src/libYARP_dev/src/yarp/dev/tests/IInteractionModeTest.h @@ -6,6 +6,11 @@ #ifndef IINTERACTIONMODETEST_H #define IINTERACTIONMODETEST_H +#include +#include +#include + +#include #include #include @@ -14,11 +19,15 @@ using namespace yarp::os; namespace yarp::dev::tests { - inline void exec_iInteractionMode_test_1(IInteractionMode* iint) + inline void exec_iInteractionMode_test_1(IInteractionMode* iint, IAxisInfo* iinfo) { REQUIRE(iint != nullptr); + REQUIRE(iinfo != nullptr); - bool b=false; + int ax; + bool b = iinfo->getAxes(&ax); + CHECK(b); + REQUIRE(ax > 0); yarp::dev::InteractionModeEnum val; yarp::dev::InteractionModeEnum ret; @@ -39,6 +48,25 @@ namespace yarp::dev::tests b = iint->getInteractionMode(0, &ret); CHECK(b); + + auto modes = std::vector< yarp::dev::InteractionModeEnum>(ax); + b = iint->getInteractionModes(modes.data()); + CHECK(b); + + auto joints = std::vector(ax); + std::iota(joints.begin(), joints.end(), 0); + b = iint->getInteractionModes(ax, joints.data(), modes.data()); + CHECK(b); + + for (size_t j = 0; j < ax; j++) + { + modes[j]= yarp::dev::InteractionModeEnum::VOCAB_IM_STIFF; + } + b = iint->setInteractionModes(modes.data()); + CHECK(b); + b = iint->setInteractionModes(ax, joints.data(), modes.data()); + CHECK(b); + } } #endif