YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
fakeDevice_nws_yarp_test.cpp
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2023-2023 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::Fake_nws_yarp", "[yarp::dev]")
17{
18 YARP_REQUIRE_PLUGIN("fakeDeviceUnwrapped", "device");
19 YARP_REQUIRE_PLUGIN("fakeDevice_nws_yarp", "device");
20
21 Network::setLocalMode(true);
22
23 SECTION("Checking Fake_nws_yarp device opening without attached device")
24 {
25 PolyDriver dd;
26
27 //Checking opening Fake_nws_yarp polydriver with no attached device
28 {
30 p_cfg.put("device", "fakeDevice_nws_yarp");
31 REQUIRE(dd.open(p_cfg));
32 }
33
35
36 //Close all polydrivers and check
37 {
38 CHECK(dd.close());
39 }
40 }
41
42 SECTION("Checking Fake_nws_yarp device")
43 {
46
47 //Checking opening Fake_nws_yarp polydriver
48 {
50 pnws_cfg.put("device", "fakeDevice_nws_yarp");
52
54 pdev_cfg.put("device", "fakeDeviceUnwrapped");
56
59 bool result_att = ww_nws->attach(&ddfake);
61 }
62
64
65 //Close all polydrivers and check
66 {
67 CHECK(ddnws.close());
69 }
70 }
71
72 Network::setLocalMode(false);
73}
A container for a device driver.
Definition PolyDriver.h:23
bool close() override
Close the DeviceDriver.
bool open(const std::string &txt)
Construct and configure a device by its common name.
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
TEST_CASE("dev::Fake_nws_yarp", "[yarp::dev]")
For streams capable of holding different kinds of content, check what they actually have.
void delay(double seconds)
Wait for a certain number of seconds.
Definition Time.cpp:111
An interface to the operating system, including Port based communication.