Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

code style only: wrap after open parenthesis if not in one line #195

Merged
merged 1 commit into from
Feb 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 28 additions & 14 deletions rmw/test/test_topic_endpoint_info.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,16 @@ TEST(test_topic_endpoint_info, set_topic_type) {
ret = rmw_topic_endpoint_info_set_topic_type(nullptr, val, &allocator);
EXPECT_EQ(ret, RMW_RET_INVALID_ARGUMENT) <<
"Expected invalid argument for null topic_endpoint_info";
OSRF_TESTING_TOOLS_CPP_SCOPE_EXIT({
OSRF_TESTING_TOOLS_CPP_SCOPE_EXIT(
{
allocator.deallocate(const_cast<char *>(topic_endpoint_info.topic_type), allocator.state);
});
ret = rmw_topic_endpoint_info_set_topic_type(&topic_endpoint_info, val, &allocator);
EXPECT_EQ(ret, RMW_RET_OK) << "Expected OK for valid arguments";
// free the mallocd string and verify that the string was copied by value
free(val);
EXPECT_STREQ(topic_endpoint_info.topic_type,
EXPECT_STREQ(
topic_endpoint_info.topic_type,
"test_topic_type") << "Topic Type value is not as expected";
}

Expand All @@ -60,7 +62,8 @@ TEST(test_topic_endpoint_info, set_node_name) {
ret = rmw_topic_endpoint_info_set_node_name(nullptr, val, &allocator);
EXPECT_EQ(ret, RMW_RET_INVALID_ARGUMENT) <<
"Expected invalid argument for null topic_endpoint_info";
OSRF_TESTING_TOOLS_CPP_SCOPE_EXIT({
OSRF_TESTING_TOOLS_CPP_SCOPE_EXIT(
{
allocator.deallocate(const_cast<char *>(topic_endpoint_info.node_name), allocator.state);
});
ret = rmw_topic_endpoint_info_set_node_name(&topic_endpoint_info, val, &allocator);
Expand All @@ -82,7 +85,8 @@ TEST(test_topic_endpoint_info, set_node_namespace) {
ret = rmw_topic_endpoint_info_set_node_namespace(nullptr, val, &allocator);
EXPECT_EQ(ret, RMW_RET_INVALID_ARGUMENT) <<
"Expected invalid argument for null topic_endpoint_info";
OSRF_TESTING_TOOLS_CPP_SCOPE_EXIT({
OSRF_TESTING_TOOLS_CPP_SCOPE_EXIT(
{
allocator.deallocate(const_cast<char *>(topic_endpoint_info.node_namespace), allocator.state);
});
ret = rmw_topic_endpoint_info_set_node_namespace(&topic_endpoint_info, val, &allocator);
Expand Down Expand Up @@ -136,21 +140,27 @@ TEST(test_topic_endpoint_info, set_qos_profile) {
EXPECT_EQ(topic_endpoint_info.qos_profile.history, RMW_QOS_POLICY_HISTORY_KEEP_LAST) <<
"Unequal history";
EXPECT_EQ(topic_endpoint_info.qos_profile.depth, 0u) << "Unequal depth";
EXPECT_EQ(topic_endpoint_info.qos_profile.reliability,
EXPECT_EQ(
topic_endpoint_info.qos_profile.reliability,
RMW_QOS_POLICY_RELIABILITY_RELIABLE) << "Unequal reliability";
EXPECT_EQ(topic_endpoint_info.qos_profile.durability,
EXPECT_EQ(
topic_endpoint_info.qos_profile.durability,
RMW_QOS_POLICY_DURABILITY_VOLATILE) << "Unequal durability";
EXPECT_EQ(topic_endpoint_info.qos_profile.deadline.sec, 1u) << "Unequal deadline sec";
EXPECT_EQ(topic_endpoint_info.qos_profile.deadline.nsec, 0u) << "Unequal deadline nsec";
EXPECT_EQ(topic_endpoint_info.qos_profile.lifespan.sec, 2u) << "Unequal lifespan sec";
EXPECT_EQ(topic_endpoint_info.qos_profile.lifespan.nsec, 0u) << "Unequal lifespan nsec";
EXPECT_EQ(topic_endpoint_info.qos_profile.liveliness,
EXPECT_EQ(
topic_endpoint_info.qos_profile.liveliness,
RMW_QOS_POLICY_LIVELINESS_MANUAL_BY_NODE) << "Unequal liveliness";
EXPECT_EQ(topic_endpoint_info.qos_profile.liveliness_lease_duration.sec,
EXPECT_EQ(
topic_endpoint_info.qos_profile.liveliness_lease_duration.sec,
3u) << "Unequal liveliness lease duration sec";
EXPECT_EQ(topic_endpoint_info.qos_profile.liveliness_lease_duration.nsec,
EXPECT_EQ(
topic_endpoint_info.qos_profile.liveliness_lease_duration.nsec,
0u) << "Unequal liveliness lease duration nsec";
EXPECT_EQ(topic_endpoint_info.qos_profile.avoid_ros_namespace_conventions,
EXPECT_EQ(
topic_endpoint_info.qos_profile.avoid_ros_namespace_conventions,
false) << "Unequal avoid namespace conventions";
}

Expand All @@ -173,11 +183,14 @@ TEST(test_topic_endpoint_info, zero_init) {
EXPECT_EQ(topic_endpoint_info.qos_profile.lifespan.sec, 0u) << "Non-zero lifespan sec";
EXPECT_EQ(topic_endpoint_info.qos_profile.lifespan.nsec, 0u) << "Non-zero lifespan nsec";
EXPECT_EQ(topic_endpoint_info.qos_profile.liveliness, 0) << "Non-zero liveliness";
EXPECT_EQ(topic_endpoint_info.qos_profile.liveliness_lease_duration.sec,
EXPECT_EQ(
topic_endpoint_info.qos_profile.liveliness_lease_duration.sec,
0u) << "Non-zero liveliness lease duration sec";
EXPECT_EQ(topic_endpoint_info.qos_profile.liveliness_lease_duration.nsec,
EXPECT_EQ(
topic_endpoint_info.qos_profile.liveliness_lease_duration.nsec,
0u) << "Non-zero liveliness lease duration nsec";
EXPECT_EQ(topic_endpoint_info.qos_profile.avoid_ros_namespace_conventions,
EXPECT_EQ(
topic_endpoint_info.qos_profile.avoid_ros_namespace_conventions,
false) << "Non-zero avoid namespace conventions";
}

Expand Down Expand Up @@ -222,7 +235,8 @@ TEST(test_topic_endpoint_info, fini) {
EXPECT_FALSE(topic_endpoint_info.node_name);
EXPECT_FALSE(topic_endpoint_info.node_namespace);
EXPECT_FALSE(topic_endpoint_info.topic_type);
EXPECT_EQ(topic_endpoint_info.endpoint_type,
EXPECT_EQ(
topic_endpoint_info.endpoint_type,
RMW_ENDPOINT_INVALID) << "Endpoint type value should be invalid";
for (uint8_t i = 0; i < RMW_GID_STORAGE_SIZE; i++) {
EXPECT_EQ(topic_endpoint_info.endpoint_gid[i], 0) << "Gid value should be 0";
Expand Down
12 changes: 8 additions & 4 deletions rmw/test/test_topic_endpoint_info_array.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,18 @@ TEST(test_topic_endpoint_info_array, check_zero) {
TEST(test_topic_endpoint_info_array, check_init_with_size) {
rcutils_allocator_t allocator = rcutils_get_default_allocator();
rmw_topic_endpoint_info_array_t arr = rmw_get_zero_initialized_topic_endpoint_info_array();
OSRF_TESTING_TOOLS_CPP_SCOPE_EXIT({
OSRF_TESTING_TOOLS_CPP_SCOPE_EXIT(
{
rmw_ret_t fini_ret = rmw_topic_endpoint_info_array_fini(&arr, &allocator);
EXPECT_EQ(fini_ret, RMW_RET_OK);
});
EXPECT_EQ(rmw_topic_endpoint_info_array_init_with_size(&arr, 1, nullptr),
EXPECT_EQ(
rmw_topic_endpoint_info_array_init_with_size(&arr, 1, nullptr),
RMW_RET_INVALID_ARGUMENT);
EXPECT_EQ(rmw_topic_endpoint_info_array_init_with_size(nullptr, 1,
&allocator), RMW_RET_INVALID_ARGUMENT);
EXPECT_EQ(
rmw_topic_endpoint_info_array_init_with_size(
nullptr, 1,
&allocator), RMW_RET_INVALID_ARGUMENT);
EXPECT_FALSE(arr.info_array);
rmw_ret_t ret = rmw_topic_endpoint_info_array_init_with_size(&arr, 5, &allocator);
EXPECT_EQ(ret, RMW_RET_OK);
Expand Down