Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
filippobrizzi committed Oct 25, 2024
1 parent a8b3f28 commit ea890e4
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions modules/ipc/tests/pub_sub_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,23 @@
#include "hephaestus/types_proto/dummy_type.h" // NOLINT(misc-include-cleaner)
#include "hephaestus/utils/exception.h"

namespace heph::ipc::tests {
namespace heph::ipc::zenoh::tests {

namespace {
void checkMessageExchange(bool subscriber_dedicated_callback_thread) {
auto mt = random::createRNG();
ipc::zenoh::Config config{};
auto session = ipc::zenoh::createSession(std::move(config));
Config config{};
auto session = createSession(std::move(config));
const auto topic =
ipc::TopicConfig(fmt::format("test_topic/{}", random::random<std::string>(mt, 10, false, true)));

ipc::zenoh::Publisher<types::DummyType> publisher(session, topic);
Publisher<types::DummyType> publisher(session, topic);

types::DummyType received_message;
std::atomic_flag stop_flag = ATOMIC_FLAG_INIT;
auto subscriber = ipc::zenoh::createSubscriber<types::DummyType>(
auto subscriber = createSubscriber<types::DummyType>(
session, topic,
[&received_message, &stop_flag]([[maybe_unused]] const ipc::zenoh::MessageMetadata& metadata,
[&received_message, &stop_flag]([[maybe_unused]] const MessageMetadata& metadata,
const std::shared_ptr<types::DummyType>& message) {
received_message = *message;
stop_flag.test_and_set();
Expand All @@ -59,17 +59,17 @@ TEST(PublisherSubscriber, MessageExchange) {

TEST(PublisherSubscriber, MismatchType) {
auto mt = random::createRNG();
ipc::zenoh::Config config{};
auto session = ipc::zenoh::createSession(std::move(config));
Config config{};
auto session = createSession(std::move(config));
const auto topic =
ipc::TopicConfig(fmt::format("test_topic/{}", random::random<std::string>(mt, 10, false, true)));

ipc::zenoh::Publisher<types::DummyType> publisher(session, topic);
Publisher<types::DummyType> publisher(session, topic);

std::atomic_flag stop_flag = ATOMIC_FLAG_INIT;
auto subscriber = ipc::zenoh::createSubscriber<types::DummyPrimitivesType>(
auto subscriber = createSubscriber<types::DummyPrimitivesType>(
session, topic,
[&stop_flag]([[maybe_unused]] const ipc::zenoh::MessageMetadata& metadata,
[&stop_flag]([[maybe_unused]] const MessageMetadata& metadata,
const std::shared_ptr<types::DummyPrimitivesType>& message) {
(void)metadata;
(void)message;
Expand All @@ -87,4 +87,4 @@ TEST(PublisherSubscriber, MismatchType) {
}

} // namespace
} // namespace heph::ipc::tests
} // namespace heph::ipc::zenoh::tests

0 comments on commit ea890e4

Please sign in to comment.