YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
controlBoard_nws_yarp_test.cpp
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2006-2021 Istituto Italiano di Tecnologia (IIT)
3 * SPDX-License-Identifier: BSD-3-Clause
4 */
5
6#include <yarp/os/Network.h>
9
10#include <catch2/catch_amalgamated.hpp>
11#include <harness.h>
12
13using namespace yarp::dev;
14using namespace yarp::os;
15
16TEST_CASE("dev::controlBoard_nws_yarp", "[yarp::dev]")
17{
18 YARP_REQUIRE_PLUGIN("controlBoard_nws_yarp", "device");
19
20 Network::setLocalMode(true);
21
22 SECTION("Checking controlBoard_nws_yarp device")
23 {
25
27 {
29 pcfg.put("device", "controlBoard_nws_yarp");
30 pcfg.put("name", "/controlboard");
32 }
33
34 //"Close all polydrivers and check"
35 {
36 CHECK(ddnws.close());
37 }
38 }
39
40 SECTION("Test the controlBoard_nws_yarp device with fakeMotionControl device attached")
41 {
46
47 //open
48 p_nws.put("device", "controlBoard_nws_yarp");
49 p_nws.put("name", "/controlboard");
50 p_fake.put("device", "fakeMotionControl");
53
55
56 //attach
57 {
60 bool result_att = ww_nws->attach(&dd_fake);
62 }
63
65
66 //Close all polydrivers and check
67 {
70 }
71 }
72
73 SECTION("Test the controlBoard_nws_yarp device with a non-attachable device")
74 {
79
80 //open
81 p_nws.put("device", "controlBoard_nws_yarp");
82 p_nws.put("name", "/controlboard");
83 p_fake2.put("device", "fakeSpeaker");
86
88
89 //attach
90 {
93 bool result_att = ww_nws->attach(&dd_fake2);
95 }
96
98
99 //Close all polydrivers and check
100 {
101 CHECK(dd_nws.close());
103 }
104 }
105
106 SECTION("Test the controlBoard_nws_yarp device with a device attached which does not implement motion control interfaces")
107 {
112
113 //open
114 p_nws.put("device", "controlBoard_nws_yarp");
115 p_nws.put("name", "/controlboard");
116 p_fake.put("device", "fakeMotionControlMicro");
119
121
122 //attach
123 {
126 bool result_att = ww_nws->attach(&dd_fake);
128 }
129
131
132 //Close all polydrivers and check
133 {
134 CHECK(dd_nws.close());
136 }
137 }
138
139 Network::setLocalMode(false);
140}
A container for a device driver.
Definition PolyDriver.h:23
Helper interface for an object that can wrap/or "attach" to a single other device.
A mini-server for performing network communication in the background.
void close() override
Stop port activity.
bool open(const std::string &name) override
Start port operation, with a specific name, with automatically-chosen network parameters.
A class for storing options and configuration information.
Definition Property.h:33
static void delaySystem(double seconds)
TEST_CASE("dev::controlBoard_nws_yarp", "[yarp::dev]")
For streams capable of holding different kinds of content, check what they actually have.
An interface to the operating system, including Port based communication.