Skip to content

Commit

Permalink
Change DataWriter::write return value from bool to ReturnCode_t and f…
Browse files Browse the repository at this point in the history
…ix tests

Signed-off-by: Lucia Echevarria <[email protected]>
  • Loading branch information
LuciaEchevarria99 committed Jul 16, 2024
1 parent 21c1cee commit 2b7b576
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,20 @@
#include <atomic>
#include <thread>

#include <cpp_utils/testing/gtest_aux.hpp>
#include <gtest/gtest.h>
#include <fastdds/dds/core/detail/DDSReturnCode.hpp>

#include <cpp_utils/testing/LogChecker.hpp>
#include <cpp_utils/Log.hpp>
#include <cpp_utils/testing/gtest_aux.hpp>
#include <cpp_utils/testing/LogChecker.hpp>

#include <ddspipe_core/types/topic/filter/WildcardDdsFilterTopic.hpp>

#include <ddsrouter_core/core/DdsRouter.hpp>

#include <test_participants.hpp>

#include <gtest/gtest.h>

using namespace eprosima;
using namespace eprosima::ddspipe;
using namespace eprosima::ddsrouter::core;
Expand Down Expand Up @@ -163,7 +165,7 @@ void test_local_communication(
for (samples_sent = 0; samples_sent < samples_to_receive; samples_sent++)
{
msg.index(samples_sent);
ASSERT_TRUE(publisher.publish(msg));
ASSERT_EQ(publisher.publish(msg), eprosima::fastdds::dds::RETCODE_OK);

// If time is 0 do not wait
if (time_between_samples > 0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,20 @@
#include <atomic>
#include <thread>

#include <cpp_utils/testing/gtest_aux.hpp>
#include <gtest/gtest.h>
#include <fastdds/dds/core/detail/DDSReturnCode.hpp>

#include <cpp_utils/testing/LogChecker.hpp>
#include <cpp_utils/Log.hpp>
#include <cpp_utils/testing/gtest_aux.hpp>
#include <cpp_utils/testing/LogChecker.hpp>

#include <ddspipe_core/types/topic/filter/WildcardDdsFilterTopic.hpp>

#include <ddsrouter_core/core/DdsRouter.hpp>

#include <test_participants.hpp>

#include <gtest/gtest.h>

using namespace eprosima;
using namespace eprosima::ddspipe;
using namespace eprosima::ddsrouter::core;
Expand Down Expand Up @@ -132,7 +134,7 @@ void test_local_communication_key_dispose(
while (samples_received.load() < samples_to_receive)
{
msg.index(++samples_sent);
ASSERT_TRUE(publisher.publish(msg)) << samples_sent;
ASSERT_EQ(publisher.publish(msg), fastdds::dds::RETCODE_OK) << samples_sent;

// If time is 0 do not wait
if (time_between_samples > 0)
Expand All @@ -150,7 +152,7 @@ void test_local_communication_key_dispose(
while (samples_received.load() < samples_to_receive)
{
msg.index(++samples_sent);
ASSERT_TRUE(publisher.publish(msg)) << samples_sent;
ASSERT_EQ(publisher.publish(msg), fastdds::dds::RETCODE_OK) << samples_sent;

// If time is 0 do not wait
if (time_between_samples > 0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,9 @@
#include <iostream>
#include <condition_variable>

#include <gtest/gtest.h>

#include <cpp_utils/testing/gtest_aux.hpp>
#include <cpp_utils/Log.hpp>

#include <ddspipe_participants/configuration/SimpleParticipantConfiguration.hpp>

#include <ddsrouter_core/core/DdsRouter.hpp>

#include <fastdds/dds/common/InstanceHandle.hpp>
#include <fastdds/dds/core/detail/DDSReturnCode.hpp>
#include <fastdds/dds/core/detail/DDSReturnCode.hpp>
#include <fastdds/dds/domain/DomainParticipant.hpp>
#include <fastdds/dds/domain/DomainParticipantFactory.hpp>
#include <fastdds/dds/publisher/DataWriter.hpp>
Expand All @@ -45,9 +37,18 @@
#include <fastdds/rtps/attributes/RTPSParticipantAttributes.hpp>
#include <fastdds/rtps/transport/UDPv4TransportDescriptor.hpp>

#include <cpp_utils/testing/gtest_aux.hpp>
#include <cpp_utils/Log.hpp>

#include <ddspipe_participants/configuration/SimpleParticipantConfiguration.hpp>

#include <ddsrouter_core/core/DdsRouter.hpp>

#include "HelloWorld/HelloWorldPubSubTypes.hpp"
#include "HelloWorldKeyed/HelloWorldKeyedPubSubTypes.hpp"

#include <gtest/gtest.h>


namespace test {

Expand Down Expand Up @@ -154,7 +155,7 @@ class TestPublisher
}

//! Publish a sample
bool publish(
eprosima::fastdds::dds::ReturnCode_t publish(
MsgStruct msg)
{
hello_.index(msg.index());
Expand Down Expand Up @@ -238,7 +239,7 @@ class TestPublisher
};

template <>
bool TestPublisher<HelloWorldKeyed>::publish(
eprosima::fastdds::dds::ReturnCode_t TestPublisher<HelloWorldKeyed>::publish(
HelloWorldKeyed msg)
{
hello_.index(msg.index());
Expand Down

0 comments on commit 2b7b576

Please sign in to comment.