Skip to content

Commit

Permalink
Merge pull request #786 from ApexAI/iox-#563-move-tests-in-posh-into-…
Browse files Browse the repository at this point in the history
…anonymous-namespace

Iox #563 move tests in posh into anonymous namespace
  • Loading branch information
elBoberido authored May 14, 2021
2 parents dec1f6b + cca1434 commit 708ab65
Show file tree
Hide file tree
Showing 81 changed files with 347 additions and 243 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

using namespace ::testing;
using ::testing::_;
using ::testing::Return;


int main(int argc, char* argv[])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,10 @@
#include <gmock/gmock.h>
#include <gtest/gtest.h>

namespace
{
using namespace ::testing;
using ::testing::Return;

namespace example
{
namespace test
{
/// @req IOX_SWRS_112, IOX_SWRS_200
/// @brief Test goal: "This test suite verifies that the BaseClass function is verified"
/// @pre describe what needs to be done in setup()
Expand All @@ -51,5 +48,4 @@ TEST_F(ExampleBaseClass_test, GetMemberVariableFromCtor)
EXPECT_THAT(sut2.getMemberVariable(), Eq(99U));
}

} // namespace test
} // namespace example
} // namespace
2 changes: 1 addition & 1 deletion iceoryx_binding_c/test/moduletests/main.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright (c) 2019 by Robert Bosch GmbH. All rights reserved.
// Copyright (c) 2021 by Apex.AI inc. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -18,7 +19,6 @@

using namespace ::testing;
using ::testing::_;
using ::testing::Return;

int main(int argc, char* argv[])
{
Expand Down
2 changes: 1 addition & 1 deletion iceoryx_dds/test/moduletests/main.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright (c) 2019 by Robert Bosch GmbH. All rights reserved.
// Copyright (c) 2021 by Apex.AI inc. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -18,7 +19,6 @@

using namespace ::testing;
using ::testing::_;
using ::testing::Return;

int main(int argc, char* argv[])
{
Expand Down
1 change: 0 additions & 1 deletion iceoryx_dds/test/moduletests/test_iox_to_dds.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
using namespace ::testing;
using ::testing::_;
using ::testing::InSequence;
using ::testing::Return;
using ::testing::SetArgPointee;

// ======================================== Helpers ======================================== //
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@

#include "test.hpp"

namespace
{
using namespace ::testing;
using ::testing::Return;

using namespace iox::gw;

Expand All @@ -42,3 +43,5 @@ TEST_F(InterfacePortRequestStackBlowup_test, RouDiMustContinue)
// we don't care if there are capro messages or not, we just want to have a check that there was no segfault
EXPECT_THAT(sut.getCaProMessage(caproMessage), AnyOf(true, false));
}

} // namespace
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
#include <mutex>
#include <thread>

namespace
{
using namespace ::testing;
using namespace iox;
using namespace iox::units;
Expand Down Expand Up @@ -266,3 +268,5 @@ TEST_F(CMqInterfaceStartupRace_test, ObsoleteRegAck)
auto response = m_appQueue->timedReceive(10_ms);
EXPECT_THAT(response.has_error(), Eq(true));
}

} // namespace
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,13 @@
#include <stdlib.h>
#include <thread>

namespace
{
using namespace ::testing;
using namespace iox::popo;
using namespace iox::cxx;
using namespace iox::mepoo;
using namespace iox::posix;
using ::testing::Return;

struct DummySample
{
Expand Down Expand Up @@ -252,3 +253,5 @@ TEST_F(ChunkBuildingBlocks_IntegrationTest, TwoHopsThreeThreadsNoSoFi)
ASSERT_FALSE(m_chunkReceiver.hasLostChunks());
EXPECT_EQ(m_sendCounter, m_receiveCounter);
}

} // namespace
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,14 @@
#include <sstream>
#include <thread>

namespace
{
using namespace ::testing;
using namespace iox::popo;
using namespace iox::capro;
using namespace iox::cxx;
using namespace iox::mepoo;
using namespace iox::posix;
using ::testing::Return;

struct DummySample
{
Expand Down Expand Up @@ -383,3 +384,5 @@ TIMING_TEST_F(PortUser_IntegrationTest, MultiProducer, Repeat(5), [&] {
TIMING_TEST_EXPECT_TRUE(m_sendCounter.load(std::memory_order_relaxed) == m_receiveCounter);
TIMING_TEST_EXPECT_FALSE(PortUser_IntegrationTest::m_subscriberPortUserMultiProducer.hasLostChunksSinceLastCall());
});

} // namespace
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,14 @@

#include "test.hpp"

namespace
{
using namespace ::testing;
using ::testing::Return;

using namespace iox::popo;
using namespace iox::capro;
using namespace iox::runtime;

namespace
{
void onSampleReceivedCallback(Subscriber<int>* subscriber IOX_MAYBE_UNUSED)
{
}
Expand Down Expand Up @@ -58,7 +57,6 @@ class PubSubListener_IntegrationTest : public RouDi_GTest
std::unique_ptr<Subscriber<int>> m_subscriber;
std::unique_ptr<UntypedSubscriber> m_untypedSubscriber;
};
} // namespace

/// @note Here we test that the trigger reset methods are called correctly in the d'tor of SubscriberImpl. They must not
/// be called in the BaseSubscriber d'tor since the SubscriberImpl was attached to the Listener. When it goes out of
Expand Down Expand Up @@ -90,3 +88,4 @@ TEST_F(PubSubListener_IntegrationTest, UntypedSubscriberGoesOutOfScopeAndDetachi
m_untypedSubscriber.reset();
}

} // namespace
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright (c) 2019 by Robert Bosch GmbH. All rights reserved.
// Copyright (c) 2021 by Apex.AI inc. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -20,7 +21,6 @@

using namespace ::testing;
using ::testing::_;
using ::testing::Return;

int main(int argc, char* argv[])
{
Expand Down
5 changes: 4 additions & 1 deletion iceoryx_posh/test/integrationtests/test_posh_mepoo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,12 @@

#include "test.hpp"

namespace
{
using namespace ::testing;
using namespace iox::units::duration_literals;
using iox::mepoo::MePooConfig;
using iox::roudi::RouDiEnvironment;
using ::testing::Return;

using iox::posix::Timer;

Expand Down Expand Up @@ -445,3 +446,5 @@ TIMING_TEST_F(Mepoo_IntegrationTest, MempoolCreationTimeDefaultConfig, Repeat(5)
auto maxtime = 2000_ms;
EXPECT_THAT(timediff, Le(maxtime));
});

} // namespace
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,14 @@

#include "test.hpp"

namespace
{
using namespace ::testing;
using ::testing::Return;

using namespace iox;
using namespace iox::popo;
using namespace iox::cxx;

namespace
{
template <typename T>
struct ComplexDataType
{
Expand Down Expand Up @@ -81,7 +80,6 @@ class PublisherSubscriberCommunication_test : public RouDi_GTest
capro::ServiceDescription m_serviceDescription{
"PublisherSubscriberCommunication", "IntegrationTest", "AllHailHypnotoad"};
};
} // namespace

TEST_F(PublisherSubscriberCommunication_test, SendingComplexDataType_forward_list)
{
Expand Down Expand Up @@ -464,3 +462,5 @@ TEST_F(PublisherSubscriberCommunication_test, MixedOptionsSetupWorksWithBlocking
EXPECT_THAT(subscriberNonBlocking->take().has_error(), Eq(true));

}

} // namespace
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright (c) 2019, 2021 by Robert Bosch GmbH. All rights reserved.
// Copyright (c) 2021 by Apex.AI Inc. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -15,10 +16,15 @@
// SPDX-License-Identifier: Apache-2.0

#include "iceoryx_posh/runtime/posh_runtime.hpp"
#include "iceoryx_posh/testing/roudi_gtest.hpp"
#include "iceoryx_utils/cxx/convert.hpp"
#include "test_roudi_service_discovery.hpp"

class RoudiFindService_test : public RouDiServiceDiscoveryTest
namespace
{
using iox::capro::IdString_t;
using iox::runtime::InstanceContainer;

class RoudiFindService_test : public RouDi_GTest
{
public:
void SetUp()
Expand Down Expand Up @@ -195,7 +201,9 @@ TEST_F(RoudiFindService_test, SubscribeAnyInstance)
senderRuntime->offerService({"service1", "instance3"});
this->InterOpWait();
InstanceContainer instanceContainerExp;
InitContainer(instanceContainerExp, {"instance1", "instance2", "instance3"});
instanceContainerExp.push_back("instance1");
instanceContainerExp.push_back("instance2");
instanceContainerExp.push_back("instance3");

auto instanceContainer = receiverRuntime->findService({"service1", iox::capro::AnyServiceString});

Expand Down Expand Up @@ -397,3 +405,5 @@ TEST_F(RoudiFindService_test, findServiceInstanceContainerOverflowError)

ASSERT_THAT(instanceContainer.has_error(), Eq(true));
}

} // namespace
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@

#include "test.hpp"

namespace
{
using namespace ::testing;
using namespace iox::roudi;
using ::testing::Return;

class RouDiEnvironment_test : public Test
{
Expand All @@ -35,3 +36,5 @@ TEST_F(RouDiEnvironment_test, StartingRouDiTwiceLeadsToError)
RouDiEnvironment m_sut{iox::RouDiConfig_t().setDefaults()};
EXPECT_DEATH({ RouDiEnvironment m_sut2{iox::RouDiConfig_t().setDefaults()}; }, ".*");
}

} // namespace
4 changes: 4 additions & 0 deletions iceoryx_posh/test/moduletests/test_base_port.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
#include "iceoryx_utils/cxx/helplets.hpp"
#include "test.hpp"

namespace
{
using namespace ::testing;
using namespace iox::capro;
using namespace iox::popo;
Expand Down Expand Up @@ -175,3 +177,5 @@ TYPED_TEST(BasePort_test, CallingGetRuntimeNameWorks)
using PortData_t = typename TestFixture::PortData_t;
EXPECT_THAT(this->sut.getRuntimeName(), Eq(expectedProcessName<PortData_t>()));
}

} // namespace
5 changes: 5 additions & 0 deletions iceoryx_posh/test/moduletests/test_capro_message.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright (c) 2020 by Robert Bosch GmbH. All rights reserved.
// Copyright (c) 2021 by Apex.AI Inc. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -21,6 +22,8 @@
#include "iceoryx_utils/cxx/generic_raii.hpp"
#include "test.hpp"

namespace
{
using namespace ::testing;
using namespace iox::capro;

Expand Down Expand Up @@ -58,3 +61,5 @@ TEST_F(CaproMessage_test, DefaultArgsOfCtor)
EXPECT_EQ(CaproMessageSubType::NOSUBTYPE, testObj.m_subType);
EXPECT_EQ(nullptr, testObj.m_chunkQueueData);
}

} // namespace
Loading

0 comments on commit 708ab65

Please sign in to comment.