-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added rmw_publisher_allocation and rmw_subscription_allocation relate…
…d tests (#137) * Added rmw_publisher_allocation and rmw_subscription_allocation related tests Signed-off-by: ahcorde <ahcorde@gmail.com> * Remove loaned message tests Signed-off-by: ahcorde <ahcorde@gmail.com> * Fix class name Signed-off-by: ahcorde <ahcorde@gmail.com> * Added feedback Signed-off-by: ahcorde <ahcorde@gmail.com> * make linters happy Signed-off-by: ahcorde <ahcorde@gmail.com>
- Loading branch information
Showing
3 changed files
with
91 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// Copyright 2020 Open Source Robotics Foundation, Inc. | ||
// | ||
// 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. | ||
#include <gtest/gtest.h> | ||
|
||
#include "rmw/rmw.h" | ||
|
||
#ifdef RMW_IMPLEMENTATION | ||
# define CLASSNAME_(NAME, SUFFIX) NAME ## __ ## SUFFIX | ||
# define CLASSNAME(NAME, SUFFIX) CLASSNAME_(NAME, SUFFIX) | ||
#else | ||
# define CLASSNAME(NAME, SUFFIX) NAME | ||
#endif | ||
|
||
class CLASSNAME (TestPublisherAllocator, RMW_IMPLEMENTATION) : public ::testing::Test {}; | ||
|
||
TEST_F(CLASSNAME(TestPublisherAllocator, RMW_IMPLEMENTATION), init_fini_publisher_allocation) | ||
{ | ||
if (rmw_init_publisher_allocation(nullptr, nullptr, nullptr) != RMW_RET_UNSUPPORTED) { | ||
// Add tests here when the implementation it's supported | ||
GTEST_SKIP(); | ||
} else { | ||
rmw_ret_t ret = rmw_fini_publisher_allocation(nullptr); | ||
EXPECT_EQ(ret, RMW_RET_UNSUPPORTED); | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
test_rmw_implementation/test/test_subscription_allocator.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// Copyright 2020 Open Source Robotics Foundation, Inc. | ||
// | ||
// 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. | ||
#include <gtest/gtest.h> | ||
|
||
#include "rmw/rmw.h" | ||
|
||
#ifdef RMW_IMPLEMENTATION | ||
# define CLASSNAME_(NAME, SUFFIX) NAME ## __ ## SUFFIX | ||
# define CLASSNAME(NAME, SUFFIX) CLASSNAME_(NAME, SUFFIX) | ||
#else | ||
# define CLASSNAME(NAME, SUFFIX) NAME | ||
#endif | ||
|
||
class CLASSNAME (TestSubscriptionAllocator, RMW_IMPLEMENTATION) : public ::testing::Test {}; | ||
|
||
TEST_F(CLASSNAME(TestSubscriptionAllocator, RMW_IMPLEMENTATION), init_fini_subscription_allocation) | ||
{ | ||
if (rmw_init_subscription_allocation(nullptr, nullptr, nullptr) != RMW_RET_UNSUPPORTED) { | ||
// Add tests here when the implementation it's supported | ||
GTEST_SKIP(); | ||
} else { | ||
rmw_ret_t ret = rmw_fini_subscription_allocation(nullptr); | ||
EXPECT_EQ(ret, RMW_RET_UNSUPPORTED); | ||
} | ||
} |