From d6fbd3957c2a70b9ca25e6eea508603ca8354348 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 21 Dec 2023 02:16:40 +0000 Subject: [PATCH] style(pre-commit): autofix --- .../component_interface_tools/CMakeLists.txt | 2 +- common/component_interface_tools/package.xml | 2 +- .../test/test_service_log_checker.cpp | 76 +++++++++---------- 3 files changed, 40 insertions(+), 40 deletions(-) diff --git a/common/component_interface_tools/CMakeLists.txt b/common/component_interface_tools/CMakeLists.txt index 0852f78cfed2e..3301d4b09f892 100644 --- a/common/component_interface_tools/CMakeLists.txt +++ b/common/component_interface_tools/CMakeLists.txt @@ -13,7 +13,7 @@ if(BUILD_TESTING) ament_add_ros_isolated_gtest(test_service_log_checker test/test_service_log_checker.cpp ) - + target_link_libraries(test_service_log_checker component_interface_tools ) diff --git a/common/component_interface_tools/package.xml b/common/component_interface_tools/package.xml index 828953d9f6d2f..7e4b5dc3151e8 100644 --- a/common/component_interface_tools/package.xml +++ b/common/component_interface_tools/package.xml @@ -20,9 +20,9 @@ tier4_system_msgs yaml_cpp_vendor + ament_cmake_ros ament_lint_auto autoware_lint_common - ament_cmake_ros ament_cmake diff --git a/common/component_interface_tools/test/test_service_log_checker.cpp b/common/component_interface_tools/test/test_service_log_checker.cpp index 906ffe542aabc..74d7150ffe595 100644 --- a/common/component_interface_tools/test/test_service_log_checker.cpp +++ b/common/component_interface_tools/test/test_service_log_checker.cpp @@ -14,50 +14,50 @@ #include "gtest/gtest.h" #include "service_log_checker.hpp" + #include + #include #include -TEST(service,checker) +TEST(service, checker) { - { - using ServiceLog = tier4_system_msgs::msg::ServiceLog; - using DiagnosticArray = diagnostic_msgs::msg::DiagnosticArray; - - class PubManager : public rclcpp::Node - { - public: - PubManager() : Node("test_pub_node") - { - pub_odom_ = create_publisher("service_log", 1); - sub_odom_ = create_subscription("/diagnostics", 1, std::bind(&PubManager::on_service_log, this, std::placeholders::_1)); - } - rclcpp::Publisher::SharedPtr pub_odom_; - rclcpp::Subscription::SharedPtr sub_odom_; - bool flag=false; - void on_service_log(const DiagnosticArray::ConstSharedPtr msg) - { - if(msg->status.size()>0) - { - auto diag_array = msg->status[0].message.c_str(); - EXPECT_EQ(diag_array,"ERROR"); - flag=true; - } - } - }; - - auto checker = std::make_shared(); - - auto test_log = std::make_shared(); - ServiceLog log; - log.type=6; - log.name="test"; - log.node="test_node"; - test_log->pub_odom_->publish(log); - - while(!test_log->flag) - { + { + using ServiceLog = tier4_system_msgs::msg::ServiceLog; + using DiagnosticArray = diagnostic_msgs::msg::DiagnosticArray; + class PubManager : public rclcpp::Node + { + public: + PubManager() : Node("test_pub_node") + { + pub_odom_ = create_publisher("service_log", 1); + sub_odom_ = create_subscription( + "/diagnostics", 1, std::bind(&PubManager::on_service_log, this, std::placeholders::_1)); + } + rclcpp::Publisher::SharedPtr pub_odom_; + rclcpp::Subscription::SharedPtr sub_odom_; + bool flag = false; + void on_service_log(const DiagnosticArray::ConstSharedPtr msg) + { + if (msg->status.size() > 0) { + auto diag_array = msg->status[0].message.c_str(); + EXPECT_EQ(diag_array, "ERROR"); + flag = true; } + } + }; + + auto checker = std::make_shared(); + + auto test_log = std::make_shared(); + ServiceLog log; + log.type = 6; + log.name = "test"; + log.node = "test_node"; + test_log->pub_odom_->publish(log); + + while (!test_log->flag) { } + } }