Skip to content

Commit

Permalink
iox-#27 Add tests for typed client
Browse files Browse the repository at this point in the history
  • Loading branch information
elBoberido committed Feb 24, 2022
1 parent a880ffa commit c7bc62f
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 2 deletions.
1 change: 0 additions & 1 deletion iceoryx_posh/test/mocks/client_mock.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ class MockClientPortUser : public MockBasePort
MOCK_METHOD(bool, isConditionVariableSet, (), (const, noexcept));
};

template <typename T>
class MockBaseClient
{
public:
Expand Down
61 changes: 61 additions & 0 deletions iceoryx_posh/test/moduletests/test_popo_client.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
// Copyright (c) 20221 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.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// SPDX-License-Identifier: Apache-2.0

#include "iceoryx_posh/popo/client.hpp"
#include "iceoryx_posh/testing/mocks/chunk_mock.hpp"
#include "mocks/client_mock.hpp"

#include "test.hpp"

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

struct DummyRequest
{
uint64_t data{0};
};
struct DummyResponse
{
uint64_t data{0};
};

using TestClient = ClientImpl<DummyRequest, DummyResponse, MockBaseClient>;

class ClientTest : public Test
{
public:
void SetUp() override
{
}

void TearDown() override
{
}

protected:
ChunkMock<DummyRequest, RequestHeader> requestMock;
ChunkMock<DummyResponse, ResponseHeader> responseMock;

ServiceDescription sd{"a one", "a two", "a three"};
static constexpr uint64_t RESPONSE_QUEUE_CAPACITY{123U};
ClientOptions options{RESPONSE_QUEUE_CAPACITY};
TestClient sut{sd, options};
};
} // namespace
2 changes: 1 addition & 1 deletion iceoryx_posh/test/moduletests/test_popo_untyped_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ using namespace iox::capro;
using namespace iox::popo;
using ::testing::_;

using TestUntypedClient = iox::popo::UntypedClientImpl<MockBaseClient<void>>;
using TestUntypedClient = iox::popo::UntypedClientImpl<MockBaseClient>;

class UntypedClient_test : public Test
{
Expand Down

0 comments on commit c7bc62f

Please sign in to comment.