Skip to content

Commit

Permalink
style(pre-commit): autofix
Browse files Browse the repository at this point in the history
  • Loading branch information
pre-commit-ci[bot] committed Dec 21, 2023
1 parent 0f69c40 commit d6fbd39
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 40 deletions.
2 changes: 1 addition & 1 deletion common/component_interface_tools/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand Down
2 changes: 1 addition & 1 deletion common/component_interface_tools/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
<depend>tier4_system_msgs</depend>
<depend>yaml_cpp_vendor</depend>

<test_depend>ament_cmake_ros</test_depend>
<test_depend>ament_lint_auto</test_depend>
<test_depend>autoware_lint_common</test_depend>
<test_depend>ament_cmake_ros</test_depend>

<export>
<build_type>ament_cmake</build_type>
Expand Down
76 changes: 38 additions & 38 deletions common/component_interface_tools/test/test_service_log_checker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,50 +14,50 @@

#include "gtest/gtest.h"
#include "service_log_checker.hpp"

#include <yaml-cpp/yaml.h>

#include <memory>
#include <string>

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<ServiceLog>("service_log", 1);
sub_odom_ = create_subscription<DiagnosticArray>("/diagnostics", 1, std::bind(&PubManager::on_service_log, this, std::placeholders::_1));
}
rclcpp::Publisher<ServiceLog>::SharedPtr pub_odom_;
rclcpp::Subscription<DiagnosticArray>::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<ServiceLogChecker>();

auto test_log = std::make_shared<PubManager>();
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<ServiceLog>("service_log", 1);
sub_odom_ = create_subscription<DiagnosticArray>(
"/diagnostics", 1, std::bind(&PubManager::on_service_log, this, std::placeholders::_1));
}
rclcpp::Publisher<ServiceLog>::SharedPtr pub_odom_;
rclcpp::Subscription<DiagnosticArray>::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<ServiceLogChecker>();

auto test_log = std::make_shared<PubManager>();
ServiceLog log;
log.type = 6;
log.name = "test";
log.node = "test_node";
test_log->pub_odom_->publish(log);

while (!test_log->flag) {
}
}
}

0 comments on commit d6fbd39

Please sign in to comment.