|
| 1 | +// Copyright 2020 Open Source Robotics Foundation, Inc. |
| 2 | +// |
| 3 | +// Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +// you may not use this file except in compliance with the License. |
| 5 | +// You may obtain a copy of the License at |
| 6 | +// |
| 7 | +// http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +// |
| 9 | +// Unless required by applicable law or agreed to in writing, software |
| 10 | +// distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +// See the License for the specific language governing permissions and |
| 13 | +// limitations under the License. |
| 14 | + |
| 15 | +#include <gtest/gtest.h> |
| 16 | + |
| 17 | +#include <string> |
| 18 | +#include <vector> |
| 19 | + |
| 20 | +#include "rcl/allocator.h" |
| 21 | +#include "rcl/domain_id.h" |
| 22 | + |
| 23 | +#include "rclcpp/init_options.hpp" |
| 24 | + |
| 25 | + |
| 26 | +TEST(TestInitOptions, test_construction) { |
| 27 | + rcl_allocator_t allocator = rcl_get_default_allocator(); |
| 28 | + auto options = rclcpp::InitOptions(allocator); |
| 29 | + const rcl_init_options_t * rcl_options = options.get_rcl_init_options(); |
| 30 | + ASSERT_TRUE(rcl_options != nullptr); |
| 31 | + ASSERT_TRUE(rcl_options->impl != nullptr); |
| 32 | + |
| 33 | + { |
| 34 | + auto options_copy = rclcpp::InitOptions(options); |
| 35 | + const rcl_init_options_t * rcl_options_copy = options_copy.get_rcl_init_options(); |
| 36 | + ASSERT_TRUE(rcl_options_copy != nullptr); |
| 37 | + ASSERT_TRUE(rcl_options_copy->impl != nullptr); |
| 38 | + } |
| 39 | + |
| 40 | + { |
| 41 | + auto options_copy = options; |
| 42 | + const rcl_init_options_t * rcl_options_copy = options_copy.get_rcl_init_options(); |
| 43 | + ASSERT_TRUE(rcl_options_copy != nullptr); |
| 44 | + ASSERT_TRUE(rcl_options_copy->impl != nullptr); |
| 45 | + } |
| 46 | +} |
0 commit comments