YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
simulated_network_delayTest.cpp
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2026-2026 Istituto Italiano di Tecnologia (IIT)
3 * SPDX-License-Identifier: BSD-3-Clause
4 */
5
7#include <yarp/os/Network.h>
8#include <yarp/os/LogStream.h>
9#include <yarp/os/Time.h>
10#include <yarp/os/Port.h>
11
13
14#include <array>
15#include <thread>
16
17#include <catch2/catch_amalgamated.hpp>
18#include <harness.h>
19
20TEST_CASE("pm::stats_monitorTest", "[yarp::pm]")
21{
22 YARP_REQUIRE_PLUGIN("simulated_network_delay", "portmonitor")
23
25
28
29 auto tc = GENERATE(
30 "fast_tcp",
31 "fast_tcp+send.portmonitor+file.simulated_network_delay+delay_ms.10+type.dll"
32 );
33
34 SECTION("Test that normally the portmonitor is not used")
35 {
36 yarp::os::Port sender;
37 yarp::os::Port receiver;
38
39 sender.open("/send");
40 receiver.open("/recv");
41
42 bool b = yarp::os::Network::connect("/send", "/recv", tc);
43 REQUIRE(b);
44
45 yarp::os::Value val(10);
46 sender.write(val);
47
49
50 yarp::os::Value recv;
51
52 receiver.read(recv);
53 CHECK(recv.asInt16()== 10);
54
55 receiver.close();
56 sender.close();
57 }
58
60}
static bool connect(const std::string &src, const std::string &dest, const std::string &carrier="", bool quiet=true)
Request that an output port connect to an input port.
Definition Network.cpp:751
static bool setLocalMode(bool flag)
Chooses whether communication is process-local.
Definition Network.cpp:1118
Utilities for manipulating the YARP network, including initialization and shutdown.
Definition Network.h:718
A mini-server for network communication.
Definition Port.h:46
bool write(const PortWriter &writer, const PortWriter *callback=nullptr) const override
Write an object to the port.
Definition Port.cpp:395
bool read(PortReader &reader, bool willReply=false) override
Read an object from the port.
Definition Port.cpp:440
void close() override
Stop port activity.
Definition Port.cpp:330
bool open(const std::string &name) override
Start port operation, with a specific name, with automatically-chosen network parameters.
Definition Port.cpp:79
A single value (typically within a Bottle).
Definition Value.h:44
virtual std::int16_t asInt16() const
Get 16-bit integer value.
Definition Value.cpp:204
void delay(double seconds)
Wait for a certain number of seconds.
Definition Time.cpp:111
@ YARP_CLOCK_SYSTEM
Definition Time.h:28
The main, catch-all namespace for YARP.
Definition dirs.h:16
TEST_CASE("pm::stats_monitorTest", "[yarp::pm]")