icub-test
Loading...
Searching...
No Matches
Public Member Functions
SkinWrapperTest Class Reference

This test verifies the functionalities of skinWrapper after the removal of analogServer from icub-main. More...

#include <SkinWrapperTest.h>

Inherits yarp::robottestingframework::TestCase.

Public Member Functions

virtual bool setup (yarp::os::Property &property)
 
virtual void tearDown ()
 
virtual void run ()
 

Detailed Description

This test verifies the functionalities of skinWrapper after the removal of analogServer from icub-main.

Definition at line 34 of file SkinWrapperTest.h.

Constructor & Destructor Documentation

◆ SkinWrapperTest()

SkinWrapperTest::SkinWrapperTest ( )

Definition at line 37 of file SkinWrapperTest.cpp.

37 :
38 yarp::robottestingframework::TestCase("SkinWrapperTest")
39{
40}

◆ ~SkinWrapperTest()

SkinWrapperTest::~SkinWrapperTest ( )
virtual

Definition at line 44 of file SkinWrapperTest.cpp.

45{
46}

Member Function Documentation

◆ run()

void SkinWrapperTest::run ( )
virtual

Definition at line 106 of file SkinWrapperTest.cpp.

107{
108 bool result;
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");
121
122
123}

◆ setup()

bool SkinWrapperTest::setup ( yarp::os::Property &  property)
virtual

Definition at line 50 of file SkinWrapperTest.cpp.

51{
52 //test #1
53 Property p;
54 p.put("device","skinWrapper");
55 p.put("robotName","fakeiCub");
56 p.put("name","/testSkinWrapper");
57 p.put("period",20);
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!");
62 //test #2
63 BufferedPort<Bottle> port,portrpc;
64 portrpc.open("/fakeiCub2/skin/rpc:i");
65 port.open("/fakeiCub2/skin");
66 p.unput("robotName");
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");
70 portrpc.close();
71 port.close();
72 //test #3
73 Property p2;
74 p2.put("device","skinWrapper");
75 p2.put("robotName","fakeiCub3");
76 p2.put("name","/testSkinWrapperMultip");
77 p2.put("period",20);
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!");
83 //test #4
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");
90
91 port.close();
92 portrpc.close();
93 return true;
94}

◆ tearDown()

void SkinWrapperTest::tearDown ( )
virtual

Definition at line 98 of file SkinWrapperTest.cpp.

99{
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!");
102}

The documentation for this class was generated from the following files: