diff --git a/tests/libYARP_dev/ControlBoardNwsTest.cpp b/tests/libYARP_dev/ControlBoardNwsTest.cpp index b9efc1bf163..2148d0987b0 100644 --- a/tests/libYARP_dev/ControlBoardNwsTest.cpp +++ b/tests/libYARP_dev/ControlBoardNwsTest.cpp @@ -9,6 +9,7 @@ #include #include #include +#include #include @@ -29,21 +30,30 @@ TEST_CASE("dev::controlBoard_nws_yarp", "[yarp::dev]") SECTION("test the controlBoard_nws_yarp device") { - PolyDriver dd; - Property p; - p.put("device","controlBoard_nws_yarp"); - p.put("subdevice","fakeMotionControl"); - p.put("name","/motor"); - auto& pg = p.addGroup("GENERAL"); + PolyDriver dd_nws; + Property p_nws; + p_nws.put("device", "controlBoard_nws_yarp"); + p_nws.put("name", "/motor"); + bool result_nws = dd_nws.open(p_nws); + REQUIRE(result_nws); + + PolyDriver dd_dev; + Property p_dev; + p_dev.put("device", "fakeMotionControl"); + auto& pg = p_dev.addGroup("GENERAL"); pg.put("Joints", 16); - bool result; - result = dd.open(p); - REQUIRE(result); // controlBoard_nws_yarp open reported successful + bool result_dev = dd_dev.open(p_dev); + REQUIRE(result_dev); + + yarp::dev::WrapperSingle* ww_nws; + dd_nws.view(ww_nws); + bool result_att = ww_nws->attach(&dd_dev); + REQUIRE(result_att); // Check if IMultipleWrapper interface is correctly found yarp::dev::IMultipleWrapper * i_mwrapper=nullptr; - result = dd.view(i_mwrapper); - REQUIRE(result); // IMultipleWrapper view reported successful + bool result_imw = dd_nws.view(i_mwrapper); + REQUIRE(result_imw); // IMultipleWrapper view reported successful REQUIRE(i_mwrapper != nullptr); // IMultipleWrapper pointer not null PolyDriver dd2; @@ -53,7 +63,7 @@ TEST_CASE("dev::controlBoard_nws_yarp", "[yarp::dev]") p2.put("local","/motor/client"); p2.put("carrier","tcp"); p2.put("ignoreProtocolCheck","true"); - result = dd2.open(p2); + bool result = dd2.open(p2); REQUIRE(result); // remote_controlboard open reported successful IPositionControl *pos = nullptr; @@ -62,7 +72,8 @@ TEST_CASE("dev::controlBoard_nws_yarp", "[yarp::dev]") int axes = 0; pos->getAxes(&axes); CHECK(axes == 16); // interface seems functional - CHECK(dd.close()); // close dd reported successful + CHECK(dd_nws.close()); // close dd reported successful + CHECK(dd_dev.close()); // close dd reported successful CHECK(dd2.close()); // close dd2 reported successful } } diff --git a/tests/libYARP_dev/Navigation2DnwcTest.cpp b/tests/libYARP_dev/Navigation2DnwcTest.cpp index 2421297a2f7..6d6f581092e 100644 --- a/tests/libYARP_dev/Navigation2DnwcTest.cpp +++ b/tests/libYARP_dev/Navigation2DnwcTest.cpp @@ -10,6 +10,7 @@ #include #include #include +#include #include #include @@ -38,9 +39,12 @@ TEST_CASE("dev::Navigation2DNwcTest", "[yarp::dev]") { PolyDriver ddnavserver; PolyDriver ddmapserver; + PolyDriver ddmapstorage; PolyDriver ddmapclient; PolyDriver ddlocserver; PolyDriver ddnavclient; + PolyDriver ddfakeLocalizer; + PolyDriver ddfakeNavigation; INavigation2D* inav = nullptr; IMap2D* imap = nullptr; @@ -48,8 +52,12 @@ TEST_CASE("dev::Navigation2DNwcTest", "[yarp::dev]") { Property pmapserver_cfg; pmapserver_cfg.put("device", "map2D_nws_yarp"); - pmapserver_cfg.put("subdevice", "map2DStorage"); REQUIRE(ddmapserver.open(pmapserver_cfg)); + Property pmapstorage_cfg; + pmapstorage_cfg.put("device", "map2DStorage"); + REQUIRE(ddmapstorage.open(pmapstorage_cfg)); + {yarp::dev::WrapperSingle* ww_nws; ddmapserver.view(ww_nws); + bool result_att = ww_nws->attach(&ddmapstorage);} Property pmapclient_cfg; pmapclient_cfg.put("device", "map2D_nwc_yarp"); @@ -60,13 +68,21 @@ TEST_CASE("dev::Navigation2DNwcTest", "[yarp::dev]") Property plocserver_cfg; plocserver_cfg.put("device", "localization2D_nws_yarp"); - plocserver_cfg.put("subdevice", "fakeLocalizer"); REQUIRE(ddlocserver.open(plocserver_cfg)); + Property pfakeLocalizer_cfg; + pfakeLocalizer_cfg.put("device", "fakeLocalizer"); + REQUIRE(ddfakeLocalizer.open(pfakeLocalizer_cfg)); + {yarp::dev::WrapperSingle* ww_nws; ddlocserver.view(ww_nws); + bool result_att = ww_nws->attach(&ddfakeLocalizer); } Property pnavserver_cfg; pnavserver_cfg.put("device", "navigation2D_nws_yarp"); - pnavserver_cfg.put("subdevice", "fakeNavigation"); REQUIRE(ddnavserver.open(pnavserver_cfg)); + Property pfakeNavigation; + pfakeNavigation.put("device", "fakeNavigation"); + REQUIRE(ddfakeNavigation.open(pfakeNavigation)); + {yarp::dev::WrapperSingle* ww_nws; ddnavserver.view(ww_nws); + bool result_att = ww_nws->attach(&ddfakeNavigation); } Property pnavclient_cfg; pnavclient_cfg.put("device", "navigation2D_nwc_yarp"); @@ -89,6 +105,9 @@ TEST_CASE("dev::Navigation2DNwcTest", "[yarp::dev]") CHECK(ddlocserver.close()); CHECK(ddmapclient.close()); CHECK(ddmapserver.close()); + CHECK(ddmapstorage.close()); + CHECK(ddfakeLocalizer.close()); + CHECK(ddfakeNavigation.close()); } } diff --git a/tests/libYARP_dev/TorqueControlTest.cpp b/tests/libYARP_dev/TorqueControlTest.cpp index 970d4519c08..1fb01cf8372 100644 --- a/tests/libYARP_dev/TorqueControlTest.cpp +++ b/tests/libYARP_dev/TorqueControlTest.cpp @@ -14,6 +14,7 @@ #include #include +#include using namespace yarp::os; using namespace yarp::dev; @@ -29,22 +30,25 @@ TEST_CASE("dev::TorqueControl", "[yarp::dev]") SECTION("test the controlBoard_nws_yarp device") { - PolyDriver dd; - Property p; - p.put("device","controlBoard_nws_yarp"); - p.put("subdevice","fakeMotionControl"); - p.put("name","/motor"); - auto& pg = p.addGroup("GENERAL"); + PolyDriver dd_nws; + Property p_nws; + p_nws.put("device","controlBoard_nws_yarp"); + p_nws.put("name", "/motor"); + bool result_nws = dd_nws.open(p_nws); + REQUIRE(result_nws); + + PolyDriver dd_dev; + Property p_dev; + p_dev.put("device", "fakeMotionControl"); + auto& pg = p_dev.addGroup("GENERAL"); pg.put("Joints", 1); - bool result; - result = dd.open(p); - REQUIRE(result); // controlboard_nws_yarp open reported successful + bool result_dev = dd_dev.open(p_dev); + REQUIRE(result_dev); - // Check if IMultipleWrapper interface is correctly found - yarp::dev::IMultipleWrapper * i_mwrapper=nullptr; - result = dd.view(i_mwrapper); - REQUIRE(result); // IMultipleWrapper view reported successful - REQUIRE(i_mwrapper != nullptr); // IMultipleWrapper pointer not null + yarp::dev::WrapperSingle* ww_nws; + dd_nws.view(ww_nws); + bool result_att = ww_nws->attach(&dd_dev); + REQUIRE(result_att); // controlboard_nws_yarp open reported successful PolyDriver dd2; Property p2; @@ -53,7 +57,7 @@ TEST_CASE("dev::TorqueControl", "[yarp::dev]") p2.put("local","/motor/client"); p2.put("carrier","tcp"); p2.put("ignoreProtocolCheck","true"); - result = dd2.open(p2); + bool result = dd2.open(p2); REQUIRE(result); // remote_controlboard open reported successful ITorqueControl *trq = nullptr; @@ -83,7 +87,8 @@ TEST_CASE("dev::TorqueControl", "[yarp::dev]") CHECK(res.viscousNeg == 0.6); // interface seems functional CHECK(res.coulombPos == 0.7); // interface seems functional CHECK(res.coulombNeg == 0.8); // interface seems functional - CHECK(dd.close()); // close dd reported successful + CHECK(dd_nws.close()); // close dd_nws reported successful + CHECK(dd_dev.close()); // close dd_dev reported successful CHECK(dd2.close()); // close dd2 reported successful } }