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>
10
11#include <catch2/catch_amalgamated.hpp>
12#include <harness.h>
13
14using namespace yarp::dev;
15using namespace yarp::os;
16
17TEST_CASE("dev::controlBoard_nws_yarp", "[yarp::dev]")
18{
19 YARP_REQUIRE_PLUGIN("controlBoard_nws_yarp", "device");
20
21 Network::setLocalMode(true);
22
23 SECTION("Checking controlBoard_nws_yarp device")
24 {
26
28 {
30 pcfg.put("device", "controlBoard_nws_yarp");
31 pcfg.put("name", "/controlboard");
34 }
35
36 //"Close all polydrivers and check"
37 {
38 CHECK(ddnws.close());
39 }
40 }
41
42 SECTION("Test the controlBoard_nws_yarp device with fakeMotionControl device attached")
43 {
48
49 //open
50 p_nws.put("device", "controlBoard_nws_yarp");
51 p_nws.put("name", "/controlboard");
52 p_fake.put("device", "fakeMotionControl");
55
57
58 //attach
59 {
62 bool result_att = ww_nws->attach(&dd_fake);
64 }
65
67
68 //Close all polydrivers and check
69 {
72 }
73 }
74
75 SECTION("Test the controlBoard_nws_yarp device with a non-attachable device")
76 {
81
82 //open
83 p_nws.put("device", "controlBoard_nws_yarp");
84 p_nws.put("name", "/controlboard");
85 p_fake2.put("device", "fakeSpeaker");
88
90
91 //attach
92 {
95 bool result_att = ww_nws->attach(&dd_fake2);
97 }
98
100
101 //Close all polydrivers and check
102 {
103 CHECK(dd_nws.close());
105 }
106 }
107
108 SECTION("Test the controlBoard_nws_yarp device with a device attached which does not implement motion control interfaces")
109 {
114
115 //open
116 p_nws.put("device", "controlBoard_nws_yarp");
117 p_nws.put("name", "/controlboard");
118 p_fake.put("device", "fakeMotionControlMicro");
121
123
124 //attach
125 {
128 bool result_att = ww_nws->attach(&dd_fake);
130 }
131
133
134 //Close all polydrivers and check
135 {
136 CHECK(dd_nws.close());
138 }
139 }
140
141 Network::setLocalMode(false);
142}
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]")
void exec_params_test(yarp::dev::PolyDriver *pdrv)
For streams capable of holding different kinds of content, check what they actually have.
An interface to the operating system, including Port based communication.
Definition OSTestMsg.cpp:13