Skip to content

Commit

Permalink
Change return values to enum in test
Browse files Browse the repository at this point in the history
Signed-off-by: Jorge Perez <[email protected]>
  • Loading branch information
Blast545 committed Jun 3, 2020
1 parent 95c27a4 commit 97dbf13
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions rcl/test/rcl/test_localhost.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,19 @@
#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(0, localhost_var);
EXPECT_EQ(RMW_LOCALHOST_ONLY_DEFAULT, localhost_var);

ASSERT_TRUE(rcutils_set_env("ROS_LOCALHOST_ONLY", "1"));
EXPECT_EQ(RCL_RET_OK, rcl_get_localhost_only(&localhost_var));
EXPECT_EQ(1, 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(0, localhost_var);
EXPECT_EQ(RMW_LOCALHOST_ONLY_DEFAULT, localhost_var);

EXPECT_EQ(RCL_RET_INVALID_ARGUMENT, rcl_get_localhost_only(nullptr));
}

0 comments on commit 97dbf13

Please sign in to comment.