YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
bottle_compression_zlibTest.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("bottle_compression_zlib", "portmonitor")
23
25
28
29 struct TestCase {
30 std::string carrier;
31 std::string expected_value;
32 };
33
34 auto tc = GENERATE(
35 TestCase {"fast_tcp", "123456"},
36 TestCase {"fast_tcp+send.portmonitor+file.bottle_compression_zlib+type.dll+recv.portmonitor+file.bottle_compression_zlib+type.dll", "123456"}
37 );
38
39 SECTION("Test that normally the portmonitor is not used")
40 {
41 yarp::os::Port sender;
42 yarp::os::Port receiver;
43
44 sender.open("/send");
45 receiver.open("/recv");
46
47 bool b = yarp::os::Network::connect("/send", "/recv", tc.carrier);
48 REQUIRE(b);
49
50 sender.write(yarp::os::Value(tc.expected_value));
51
53
54 yarp::os::Value rval;
55 receiver.read(rval);
56 CHECK(rval.asString()==tc.expected_value);
57
58 receiver.close();
59 sender.close();
60 }
61
63}
TEST_CASE("pm::stats_monitorTest", "[yarp::pm]")
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::string asString() const
Get string value.
Definition Value.cpp:246
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