-
Notifications
You must be signed in to change notification settings - Fork 417
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix options usage in implementation, and add test to catch that code …
…path. Signed-off-by: Emerson Knapp <eknapp@amazon.com>
- Loading branch information
Emerson Knapp
committed
Mar 29, 2019
1 parent
7591bcf
commit e82080f
Showing
3 changed files
with
72 additions
and
7 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
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,56 @@ | ||
// Copyright 2019 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 <string> | ||
#include <memory> | ||
|
||
#include "rclcpp/rclcpp.hpp" | ||
#include "test_msgs/msg/empty.hpp" | ||
|
||
class TestPublisher : public ::testing::Test | ||
{ | ||
protected: | ||
static void SetUpTestCase() | ||
{ | ||
rclcpp::init(0, nullptr); | ||
} | ||
|
||
void SetUp() | ||
{ | ||
node = std::make_shared<rclcpp::Node>("my_node", "/ns"); | ||
} | ||
|
||
void TearDown() | ||
{ | ||
node.reset(); | ||
} | ||
|
||
rclcpp::Node::SharedPtr node; | ||
}; | ||
|
||
/* | ||
Testing construction and destruction. | ||
*/ | ||
TEST_F(TestPublisher, construction_and_destruction) { | ||
rclcpp::PublisherOptions<> pub_options; | ||
auto publisher = node->create_publisher<test_msgs::msg::Empty>("topic", pub_options); | ||
|
||
rclcpp::SubscriptionOptions<> sub_options; | ||
auto subscription = node->create_subscription<test_msgs::msg::Empty>( | ||
"topic", | ||
[](std::shared_ptr<test_msgs::msg::Empty> test_msg) {(void) test_msg;}, | ||
sub_options); | ||
} |