Skip to content

Commit

Permalink
Fix rcl_get_localhost_only return value
Browse files Browse the repository at this point in the history
Signed-off-by: Jorge Perez <[email protected]>
  • Loading branch information
Blast545 committed Jun 8, 2020
1 parent 526c8a6 commit 7225695
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions rcl/test/rcl/test_localhost.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,18 @@
#include "rcutils/env.h"

TEST(TestLocalhost, test_get_localhost_only) {
// TODO(Blast545): return value matching parsed value https://github.com/ros2/rcl/issues/669
ASSERT_TRUE(rcutils_set_env("ROS_LOCALHOST_ONLY", "0"));
rmw_localhost_only_t localhost_var;
EXPECT_EQ(RCL_RET_OK, rcl_get_localhost_only(&localhost_var));
EXPECT_EQ(RMW_LOCALHOST_ONLY_DEFAULT, localhost_var);
EXPECT_EQ(RMW_LOCALHOST_ONLY_DISABLED, localhost_var);

ASSERT_TRUE(rcutils_set_env("ROS_LOCALHOST_ONLY", "1"));
EXPECT_EQ(RCL_RET_OK, rcl_get_localhost_only(&localhost_var));
EXPECT_EQ(RMW_LOCALHOST_ONLY_ENABLED, localhost_var);

ASSERT_TRUE(rcutils_set_env("ROS_LOCALHOST_ONLY", "2"));
EXPECT_EQ(RCL_RET_OK, rcl_get_localhost_only(&localhost_var));
EXPECT_EQ(RMW_LOCALHOST_ONLY_DEFAULT, localhost_var);
EXPECT_EQ(RMW_LOCALHOST_ONLY_DISABLED, localhost_var);

EXPECT_EQ(RCL_RET_INVALID_ARGUMENT, rcl_get_localhost_only(nullptr));
}

0 comments on commit 7225695

Please sign in to comment.