Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Nov 29, 2023
1 parent f60963f commit 2c4f3af
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 20 deletions.
2 changes: 1 addition & 1 deletion include/dynamic_graph_bridge/sot_loader.hh
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class SotLoader : public SotLoaderBasic {
geometry_msgs::msg::TransformStamped freeFlyerPose_;

public:
SotLoader(const std::string &aNodeName=std::string("SotLoader"));
SotLoader(const std::string &aNodeName = std::string("SotLoader"));
virtual ~SotLoader();

// \brief Create a thread for ROS and start the control loop.
Expand Down
4 changes: 2 additions & 2 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ if(BUILD_TESTING)
PUBLIC include "${GMOCK_INCLUDE_DIRS}"
PRIVATE ${PROJECT_SOURCE_DIR}/include)
target_compile_definitions(
test_sot_loader
PUBLIC TEST_CONFIG_PATH="${CMAKE_CURRENT_LIST_DIR}/python_scripts/")
test_sot_loader
PUBLIC TEST_CONFIG_PATH="${CMAKE_CURRENT_LIST_DIR}/python_scripts/")
target_link_libraries(test_sot_loader sot_loader "${GMOCK_LIBRARIES}")

add_launch_test(launch/launching_test_sot_loader.py)
Expand Down
1 change: 0 additions & 1 deletion tests/test_ros_interpreter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -286,5 +286,4 @@ TEST_F(TestRosInterpreter, test_call_run_script_ros_publish) {

/* Tests the result. */
ASSERT_EQ(result, "");

}
30 changes: 14 additions & 16 deletions tests/test_sot_loader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@

namespace test_sot_loader {
int l_argc;
char** l_argv;
}
char **l_argv;
} // namespace test_sot_loader

namespace dg = dynamicgraph;

Expand All @@ -20,18 +20,21 @@ class MockSotLoaderTest : public ::testing::Test {
class MockSotLoader : public SotLoader {
public:
rclcpp::Subscription<dynamic_graph_bridge_msgs::msg::Vector>::SharedPtr
subscription_;
subscription_;

~MockSotLoader() {}

void topic_callback(const dynamic_graph_bridge_msgs::msg::Vector::SharedPtr msg) const {
auto lsize=msg->data.size();
void topic_callback(
const dynamic_graph_bridge_msgs::msg::Vector::SharedPtr msg) const {
auto lsize = msg->data.size();
}

void subscribe_to_a_topic() {
subscription_ = create_subscription<dynamic_graph_bridge_msgs::msg::Vector>(
"control_ros", 1, std::bind(&MockSotLoader::topic_callback, this,
std::placeholders::_1));
subscription_ =
create_subscription<dynamic_graph_bridge_msgs::msg::Vector>(
"control_ros", 1,
std::bind(&MockSotLoader::topic_callback, this,
std::placeholders::_1));
}

void generateEvents() {
Expand Down Expand Up @@ -85,7 +88,7 @@ class MockSotLoaderTest : public ::testing::Test {
std::string result = "";
std::string standard_output = "";
std::string standard_error = "";
//start_run_python_script_ros_service(file_name, result);
// start_run_python_script_ros_service(file_name, result);

// Wait for each threads.
SotLoader::lthread_join(); // Wait 100 ms
Expand All @@ -98,15 +101,11 @@ class MockSotLoaderTest : public ::testing::Test {

// For the set of tests coded in this file.
static void SetUpTestCase() {

rclcpp::init(test_sot_loader::l_argc,
test_sot_loader::l_argv);
rclcpp::init(test_sot_loader::l_argc, test_sot_loader::l_argv);
}

// For each test specified in this file
static void TearDownTestCase() {
rclcpp::shutdown();
}
static void TearDownTestCase() { rclcpp::shutdown(); }

void SetUp() {
mockSotLoader_ptr_ = new MockSotLoader();
Expand All @@ -129,7 +128,6 @@ int main(int argc, char **argv) {
test_sot_loader::l_argc = argc;
test_sot_loader::l_argv = argv;


int r = RUN_ALL_TESTS();

return r;
Expand Down

0 comments on commit 2c4f3af

Please sign in to comment.