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 #397

Merged
merged 1 commit into from
Feb 4, 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
9 changes: 6 additions & 3 deletions test_communication/test/test_action_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ send_goals(
size_t test_index = 0;
bool invalid_feedback = false;
auto start = std::chrono::steady_clock::now();
RCLCPP_SCOPE_EXIT({
RCLCPP_SCOPE_EXIT(
{
auto end = std::chrono::steady_clock::now();
std::chrono::duration<float> diff = (end - start);
RCLCPP_INFO(logger, "sent goals for %f seconds\n", diff.count());
Expand Down Expand Up @@ -191,7 +192,8 @@ generate_nested_message_goal_tests()
test.result_is_valid =
[initial_value, expected_result_value](auto result) -> bool {
if (result->nested_field.int32_value != expected_result_value) {
fprintf(stderr, "expected result %d but got %d for initial value %d\n",
fprintf(
stderr, "expected result %d but got %d for initial value %d\n",
expected_result_value, result->nested_field.int32_value, initial_value);
return false;
}
Expand All @@ -200,7 +202,8 @@ generate_nested_message_goal_tests()
test.feedback_is_valid =
[initial_value, expected_feedback_value](auto feedback) -> bool {
if (feedback->nested_different_pkg.sec != expected_feedback_value) {
fprintf(stderr, "expected feedback %d but got %d for initial value %d\n",
fprintf(
stderr, "expected feedback %d but got %d for initial value %d\n",
expected_feedback_value, feedback->nested_different_pkg.sec, initial_value);
return false;
}
Expand Down
57 changes: 26 additions & 31 deletions test_communication/test/test_messages_c.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@ class CLASSNAME (TestMessagesFixture, RMW_IMPLEMENTATION) : public ::testing::Te
rcl_init_options_t init_options = rcl_get_zero_initialized_init_options();
ret = rcl_init_options_init(&init_options, rcl_get_default_allocator());
ASSERT_EQ(RCL_RET_OK, ret) << rcl_get_error_string().str;
OSRF_TESTING_TOOLS_CPP_SCOPE_EXIT({
OSRF_TESTING_TOOLS_CPP_SCOPE_EXIT(
{
EXPECT_EQ(RCL_RET_OK, rcl_init_options_fini(&init_options)) << rcl_get_error_string().str;
});
this->context_ptr = new rcl_context_t;
Expand Down Expand Up @@ -731,8 +732,7 @@ void verify_message(test_msgs__msg__Arrays & message, size_t msg_num)
EXPECT_EQ(expected_msg.uint32_values[i], message.uint32_values[i]);
EXPECT_EQ(expected_msg.int64_values[i], message.int64_values[i]);
EXPECT_EQ(expected_msg.uint64_values[i], message.uint64_values[i]);
EXPECT_EQ(0, strcmp(expected_msg.string_values[i].data,
message.string_values[i].data));
EXPECT_EQ(0, strcmp(expected_msg.string_values[i].data, message.string_values[i].data));
}

auto msg_exit = make_scope_exit(
Expand Down Expand Up @@ -935,60 +935,55 @@ void verify_message(test_msgs__msg__UnboundedSequences & message, size_t msg_num
test_msgs__msg__UnboundedSequences expected_msg;
get_message(&expected_msg, msg_num);
for (size_t i = 0; i < expected_msg.bool_values.size; ++i) {
EXPECT_EQ(expected_msg.bool_values.data[i],
message.bool_values.data[i]);
EXPECT_EQ(expected_msg.bool_values.data[i], message.bool_values.data[i]);
}
for (size_t i = 0; i < expected_msg.byte_values.size; ++i) {
EXPECT_EQ(expected_msg.byte_values.data[i],
message.byte_values.data[i]);
EXPECT_EQ(expected_msg.byte_values.data[i], message.byte_values.data[i]);
}
for (size_t i = 0; i < expected_msg.char_values.size; ++i) {
EXPECT_EQ(expected_msg.char_values.data[i],
message.char_values.data[i]);
EXPECT_EQ(expected_msg.char_values.data[i], message.char_values.data[i]);
}
for (size_t i = 0; i < expected_msg.float32_values.size; ++i) {
EXPECT_FLOAT_EQ(expected_msg.float32_values.data[i],
message.float32_values.data[i]);
EXPECT_FLOAT_EQ(
expected_msg.float32_values.data[i], message.float32_values.data[i]);
}
for (size_t i = 0; i < expected_msg.float64_values.size; ++i) {
EXPECT_DOUBLE_EQ(expected_msg.float64_values.data[i],
message.float64_values.data[i]);
EXPECT_DOUBLE_EQ(
expected_msg.float64_values.data[i], message.float64_values.data[i]);
}
for (size_t i = 0; i < expected_msg.int8_values.size; ++i) {
EXPECT_EQ(expected_msg.int8_values.data[i],
message.int8_values.data[i]);
EXPECT_EQ(expected_msg.int8_values.data[i], message.int8_values.data[i]);
}
for (size_t i = 0; i < expected_msg.uint8_values.size; ++i) {
EXPECT_EQ(expected_msg.uint8_values.data[i],
message.uint8_values.data[i]);
EXPECT_EQ(expected_msg.uint8_values.data[i], message.uint8_values.data[i]);
}
for (size_t i = 0; i < expected_msg.int16_values.size; ++i) {
EXPECT_EQ(expected_msg.int16_values.data[i],
message.int16_values.data[i]);
EXPECT_EQ(expected_msg.int16_values.data[i], message.int16_values.data[i]);
}
for (size_t i = 0; i < expected_msg.uint16_values.size; ++i) {
EXPECT_EQ(expected_msg.uint16_values.data[i],
message.uint16_values.data[i]);
EXPECT_EQ(
expected_msg.uint16_values.data[i], message.uint16_values.data[i]);
}
for (size_t i = 0; i < expected_msg.int32_values.size; ++i) {
EXPECT_EQ(expected_msg.int32_values.data[i],
message.int32_values.data[i]);
EXPECT_EQ(expected_msg.int32_values.data[i], message.int32_values.data[i]);
}
for (size_t i = 0; i < expected_msg.uint32_values.size; ++i) {
EXPECT_EQ(expected_msg.uint32_values.data[i],
message.uint32_values.data[i]);
EXPECT_EQ(
expected_msg.uint32_values.data[i], message.uint32_values.data[i]);
}
for (size_t i = 0; i < expected_msg.int64_values.size; ++i) {
EXPECT_EQ(expected_msg.int64_values.data[i],
message.int64_values.data[i]);
EXPECT_EQ(expected_msg.int64_values.data[i], message.int64_values.data[i]);
}
for (size_t i = 0; i < expected_msg.uint64_values.size; ++i) {
EXPECT_EQ(expected_msg.uint64_values.data[i],
message.uint64_values.data[i]);
EXPECT_EQ(
expected_msg.uint64_values.data[i], message.uint64_values.data[i]);
}
for (size_t i = 0; i < expected_msg.string_values.size; ++i) {
EXPECT_EQ(0, strcmp(message.string_values.data[i].data,
expected_msg.string_values.data[i].data));
EXPECT_EQ(
0,
strcmp(
message.string_values.data[i].data,
expected_msg.string_values.data[i].data));
}

auto msg_exit = make_scope_exit(
Expand Down
11 changes: 5 additions & 6 deletions test_communication/test/test_publisher_subscriber.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,18 +142,17 @@ int main(int argc, char ** argv)
} else if (message == "Arrays") {
subscriber = subscribe<test_msgs::msg::Arrays>(
node, message, messages_arrays, received_messages);
publish<test_msgs::msg::Arrays>(node, message,
messages_arrays);
publish<test_msgs::msg::Arrays>(node, message, messages_arrays);
} else if (message == "UnboundedSequences") {
subscriber = subscribe<test_msgs::msg::UnboundedSequences>(
node, message, messages_unbounded_sequences, received_messages);
publish<test_msgs::msg::UnboundedSequences>(node, message,
messages_unbounded_sequences);
publish<test_msgs::msg::UnboundedSequences>(
node, message, messages_unbounded_sequences);
} else if (message == "BoundedSequences") {
subscriber = subscribe<test_msgs::msg::BoundedSequences>(
node, message, messages_bounded_sequences, received_messages);
publish<test_msgs::msg::BoundedSequences>(node, message,
messages_bounded_sequences);
publish<test_msgs::msg::BoundedSequences>(
node, message, messages_bounded_sequences);
} else if (message == "MultiNested") {
subscriber = subscribe<test_msgs::msg::MultiNested>(
node, message, messages_multi_nested, received_messages);
Expand Down
3 changes: 2 additions & 1 deletion test_communication/test/test_requester.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ int request(
printf("received reply #%zu of %zu\n", service_index + 1, services.size());
++service_index;
} else {
fprintf(stderr, "received reply for request #%zu does not match the expected reply\n",
fprintf(
stderr, "received reply for request #%zu does not match the expected reply\n",
service_index + 1);
rc = 2;
break;
Expand Down
4 changes: 2 additions & 2 deletions test_quality_of_service/test/qos_test_publisher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ void QosTestPublisher::publish_message()
message_buffer << this->name_ << ": testing " << std::to_string(this->increment_count());
message.data = message_buffer.str();

RCLCPP_INFO(this->get_logger(), "%s: publishing '%s'",
this->name_.c_str(),
RCLCPP_INFO(
this->get_logger(), "%s: publishing '%s'", this->name_.c_str(),
message.data.c_str());
this->publisher_->publish(message);
}
Expand Down
4 changes: 2 additions & 2 deletions test_quality_of_service/test/qos_test_subscriber.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ QosTestSubscriber::QosTestSubscriber(

void QosTestSubscriber::listen_to_message(const std_msgs::msg::String::SharedPtr received_message)
{
RCLCPP_INFO(this->get_logger(), "%s: subscriber heard [%s]",
this->name_.c_str(),
RCLCPP_INFO(
this->get_logger(), "%s: subscriber heard [%s]", this->name_.c_str(),
received_message->data.c_str());
this->increment_count();
}
Expand Down
6 changes: 3 additions & 3 deletions test_rclcpp/include/test_rclcpp/utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ void wait_for_subscriber(
}
int64_t time_slept_count =
std::chrono::duration_cast<std::chrono::microseconds>(time_slept).count();
printf("Waited %" PRId64 " microseconds for the subscriber to %s topic '%s'\n",
time_slept_count,
to_be_available ? "connect to" : "disconnect from",
printf(
"Waited %" PRId64 " microseconds for the subscriber to %s topic '%s'\n",
time_slept_count, to_be_available ? "connect to" : "disconnect from",
topic_name.c_str());
}

Expand Down
28 changes: 16 additions & 12 deletions test_rclcpp/test/parameter_fixtures.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,8 @@ void test_get_parameters_sync(
{
printf("Listing parameters with recursive depth\n");
// Test recursive depth (=0)
auto parameters_and_prefixes = parameters_client->list_parameters({"foo", "bar"},
rcl_interfaces::srv::ListParameters::Request::DEPTH_RECURSIVE);
auto parameters_and_prefixes = parameters_client->list_parameters(
{"foo", "bar"}, rcl_interfaces::srv::ListParameters::Request::DEPTH_RECURSIVE);
for (auto & name : parameters_and_prefixes.names) {
EXPECT_TRUE(name == "foo" || name == "bar" || name == "foo.first" || name == "foo.second");
}
Expand Down Expand Up @@ -190,14 +190,15 @@ void test_get_parameters_sync(

printf("Listing parameters with recursive depth\n");
// List all of the parameters, using an empty prefix list and depth=0
parameters_and_prefixes = parameters_client->list_parameters({},
rcl_interfaces::srv::ListParameters::Request::DEPTH_RECURSIVE);
parameters_and_prefixes = parameters_client->list_parameters(
{}, rcl_interfaces::srv::ListParameters::Request::DEPTH_RECURSIVE);
std::vector<std::string> all_names = {
"foo", "bar", "barstr", "baz", "foo.first", "foo.second", "foobar", "use_sim_time"
};
EXPECT_EQ(parameters_and_prefixes.names.size(), all_names.size());
for (auto & name : all_names) {
EXPECT_NE(std::find(
EXPECT_NE(
std::find(
parameters_and_prefixes.names.cbegin(),
parameters_and_prefixes.names.cend(),
name),
Expand All @@ -208,7 +209,8 @@ void test_get_parameters_sync(
parameters_and_prefixes = parameters_client->list_parameters({}, 100);
EXPECT_EQ(parameters_and_prefixes.names.size(), all_names.size());
for (auto & name : all_names) {
EXPECT_NE(std::find(
EXPECT_NE(
std::find(
parameters_and_prefixes.names.cbegin(),
parameters_and_prefixes.names.cend(),
name),
Expand All @@ -222,7 +224,8 @@ void test_get_parameters_sync(
};
EXPECT_EQ(parameters_and_prefixes.names.size(), depth_one_names.size());
for (auto & name : depth_one_names) {
EXPECT_NE(std::find(
EXPECT_NE(
std::find(
parameters_and_prefixes.names.cbegin(),
parameters_and_prefixes.names.cend(),
name),
Expand All @@ -236,8 +239,8 @@ void test_get_parameters_async(
{
printf("Listing parameters with recursive depth\n");
// Test recursive depth (=0)
auto result = parameters_client->list_parameters({"foo", "bar"},
rcl_interfaces::srv::ListParameters::Request::DEPTH_RECURSIVE);
auto result = parameters_client->list_parameters(
{"foo", "bar"}, rcl_interfaces::srv::ListParameters::Request::DEPTH_RECURSIVE);
rclcpp::spin_until_future_complete(node, result);
auto parameters_and_prefixes = result.get();
for (auto & name : parameters_and_prefixes.names) {
Expand Down Expand Up @@ -311,16 +314,17 @@ void test_get_parameters_async(

printf("Listing parameters with recursive depth\n");
// List all of the parameters, using an empty prefix list
auto result5 = parameters_client->list_parameters({},
rcl_interfaces::srv::ListParameters::Request::DEPTH_RECURSIVE);
auto result5 = parameters_client->list_parameters(
{}, rcl_interfaces::srv::ListParameters::Request::DEPTH_RECURSIVE);
rclcpp::spin_until_future_complete(node, result5);
parameters_and_prefixes = result5.get();
std::vector<std::string> all_names = {
"foo", "bar", "barstr", "baz", "foo.first", "foo.second", "foobar", "use_sim_time"
};
EXPECT_EQ(parameters_and_prefixes.names.size(), all_names.size());
for (auto & name : all_names) {
EXPECT_NE(std::find(
EXPECT_NE(
std::find(
parameters_and_prefixes.names.cbegin(),
parameters_and_prefixes.names.cend(),
name),
Expand Down
5 changes: 3 additions & 2 deletions test_rclcpp/test/test_client_scope_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,9 @@ TEST(CLASSNAME(service_client, RMW_IMPLEMENTATION), client_scope_regression_test
printf("sending first request\n");
std::cout.flush();
auto result1 = client1->async_send_request(request1);
if (rclcpp::spin_until_future_complete(node,
result1) != rclcpp::executor::FutureReturnCode::SUCCESS)
if (
rclcpp::spin_until_future_complete(node, result1) !=
rclcpp::executor::FutureReturnCode::SUCCESS)
{
FAIL();
}
Expand Down
3 changes: 2 additions & 1 deletion test_rclcpp/test/test_intra_process.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,8 @@ TEST(CLASSNAME(test_intra_process_within_one_node, RMW_IMPLEMENTATION), nominal_
int i = 0;
executor.spin_node_once(node, std::chrono::milliseconds(0));
while ((counter == 3 || counter == 4) && i < max_loops) {
printf("spin_node_some() - callback (%s) expected - try %d/%d\n",
printf(
"spin_node_some() - callback (%s) expected - try %d/%d\n",
counter == 3 ? "4 and 5" : "5", ++i, max_loops);
std::this_thread::sleep_for(sleep_per_loop);
executor.spin_node_once(node, std::chrono::milliseconds(0));
Expand Down
Loading