`this->node_options_` might still be `nullptr` for a default initialized NodeOptions instance. `use_global_arguments()` must return `this->use_global_arguments_`, in analogy to `NodeOptions::enable_rosout()`. Signed-off-by: Johannes Meyer <johannes@intermodalics.eu> Co-authored-by: Johannes Meyer <johannes@intermodalics.eu>
This commit is contained in:
parent
9c1cbdf6c7
commit
4dcb0eda68
2 changed files with 33 additions and 1 deletions
|
@ -176,7 +176,7 @@ NodeOptions::parameter_overrides(const std::vector<rclcpp::Parameter> & paramete
|
||||||
bool
|
bool
|
||||||
NodeOptions::use_global_arguments() const
|
NodeOptions::use_global_arguments() const
|
||||||
{
|
{
|
||||||
return this->node_options_->use_global_arguments;
|
return this->use_global_arguments_;
|
||||||
}
|
}
|
||||||
|
|
||||||
NodeOptions &
|
NodeOptions &
|
||||||
|
|
|
@ -105,6 +105,38 @@ TEST(TestNodeOptions, bad_ros_args) {
|
||||||
rclcpp::exceptions::UnknownROSArgsError);
|
rclcpp::exceptions::UnknownROSArgsError);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(TestNodeOptions, use_global_arguments) {
|
||||||
|
{
|
||||||
|
auto options = rclcpp::NodeOptions();
|
||||||
|
EXPECT_TRUE(options.use_global_arguments());
|
||||||
|
EXPECT_TRUE(options.get_rcl_node_options()->use_global_arguments);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
auto options = rclcpp::NodeOptions().use_global_arguments(false);
|
||||||
|
EXPECT_FALSE(options.use_global_arguments());
|
||||||
|
EXPECT_FALSE(options.get_rcl_node_options()->use_global_arguments);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
auto options = rclcpp::NodeOptions().use_global_arguments(true);
|
||||||
|
EXPECT_TRUE(options.use_global_arguments());
|
||||||
|
EXPECT_TRUE(options.get_rcl_node_options()->use_global_arguments);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
auto options = rclcpp::NodeOptions();
|
||||||
|
EXPECT_TRUE(options.use_global_arguments());
|
||||||
|
EXPECT_TRUE(options.get_rcl_node_options()->use_global_arguments);
|
||||||
|
options.use_global_arguments(false);
|
||||||
|
EXPECT_FALSE(options.use_global_arguments());
|
||||||
|
EXPECT_FALSE(options.get_rcl_node_options()->use_global_arguments);
|
||||||
|
options.use_global_arguments(true);
|
||||||
|
EXPECT_TRUE(options.use_global_arguments());
|
||||||
|
EXPECT_TRUE(options.get_rcl_node_options()->use_global_arguments);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
TEST(TestNodeOptions, enable_rosout) {
|
TEST(TestNodeOptions, enable_rosout) {
|
||||||
{
|
{
|
||||||
auto options = rclcpp::NodeOptions();
|
auto options = rclcpp::NodeOptions();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue