22 #include <robottestingframework/dll/Plugin.h>
23 #include <robottestingframework/TestAssert.h>
25 #include "SkinWrapperTest.h"
28 using namespace robottestingframework;
29 using namespace yarp::os;
30 using namespace yarp::dev;
37 SkinWrapperTest::SkinWrapperTest() :
38 yarp::robottestingframework::TestCase(
"SkinWrapperTest")
44 SkinWrapperTest::~SkinWrapperTest()
50 bool SkinWrapperTest::setup(Property &property)
54 p.put(
"device",
"skinWrapper");
55 p.put(
"robotName",
"fakeiCub");
56 p.put(
"name",
"/testSkinWrapper");
58 p.put(
"total_taxels",10);
59 p.put(
"subdevice",
"fakeAnalogSensor");
60 ROBOTTESTINGFRAMEWORK_TEST_REPORT(
"Opening the skinWrapper with one port");
61 ROBOTTESTINGFRAMEWORK_TEST_CHECK(dd1.open(p),
"Unable to open the device!");
63 BufferedPort<Bottle> port,portrpc;
64 portrpc.open(
"/fakeiCub2/skin/rpc:i");
65 port.open(
"/fakeiCub2/skin");
67 p.put(
"robotName",
"fakeiCub2");
68 ROBOTTESTINGFRAMEWORK_TEST_REPORT(
"Opening the skinWrapper with one port (address conflict case)");
69 ROBOTTESTINGFRAMEWORK_TEST_CHECK(!dd2.open(p),
"Unable to open the device as expected");
74 p2.put(
"device",
"skinWrapper");
75 p2.put(
"robotName",
"fakeiCub3");
76 p2.put(
"name",
"/testSkinWrapperMultip");
78 p2.put(
"total_taxels",3);
79 p2.put(
"subdevice",
"fakeAnalogSensor");
80 p2.fromString(
"(ports (left_hand left_forearm left_arm)) (left_hand 0 0 0 0) (left_forearm 0 0 0 0) (left_arm 0 0 0 0)",
false);
81 ROBOTTESTINGFRAMEWORK_TEST_REPORT(
"Opening the skinWrapper with multiple ports");
82 ROBOTTESTINGFRAMEWORK_TEST_CHECK(dd3.open(p2),
"Unable to open the device!");
84 port.open(
"/fakeiCub4/skin/left_hand");
85 portrpc.open(
"/fakeiCub4/skin/left_forearm/rpc:i");
86 p2.unput(
"robotName");
87 p2.put(
"robotName",
"fakeiCub4");
88 ROBOTTESTINGFRAMEWORK_TEST_REPORT(
"Opening the skinWrapper with multiple ports (address conflict case)");
89 ROBOTTESTINGFRAMEWORK_TEST_CHECK(!dd4.open(p2),
"Unable to open the device as expected");
98 void SkinWrapperTest::tearDown()
100 ROBOTTESTINGFRAMEWORK_TEST_REPORT(
"Closing the skinWrapper");
101 ROBOTTESTINGFRAMEWORK_ASSERT_FAIL_IF_FALSE(dd1.close() && dd2.close() && dd3.close() && dd4.close(),
"Unable to close the device!");
106 void SkinWrapperTest::run()
109 result = Network::exists(
"/fakeiCub/skin/rpc:i");
110 result &= Network::exists(
"/fakeiCub/skin");
111 result &= Network::exists(
"/fakeiCub3/skin/left_hand");
112 result &= Network::exists(
"/fakeiCub3/skin/left_hand/rpc:i");
113 result &= Network::exists(
"/fakeiCub3/skin/left_forearm");
114 result &= Network::exists(
"/fakeiCub3/skin/left_forearm/rpc:i");
115 result &= Network::exists(
"/fakeiCub3/skin/left_arm");
116 result &= Network::exists(
"/fakeiCub3/skin/left_arm/rpc:i");
117 ROBOTTESTINGFRAMEWORK_TEST_REPORT(
"Checking if all ports has been opened successfully");
118 ROBOTTESTINGFRAMEWORK_TEST_CHECK(result,
"ports opened succefully");
119 ROBOTTESTINGFRAMEWORK_TEST_REPORT(
"Checking the validity of devices");
120 ROBOTTESTINGFRAMEWORK_TEST_CHECK(dd1.isValid() && !dd2.isValid() && dd3.isValid() && !dd4.isValid(),
"dd1 and dd3 valid, dd2 and dd4 not valid as expected");
This test verifies the functionalities of skinWrapper after the removal of analogServer from icub-mai...