Skip to content

Commit

Permalink
Fix linting errors
Browse files Browse the repository at this point in the history
Signed-off-by: Devin Bonnie <dbbonnie@amazon.com>
  • Loading branch information
dabonnie committed Apr 16, 2019
1 parent 012b9c0 commit ac80e57
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
4 changes: 2 additions & 2 deletions rclcpp/src/rclcpp/timer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ TimerBase::is_cancelled()
{
bool is_canceled = false;
if (rcl_timer_is_canceled(timer_handle_.get(), &is_canceled) != RCL_RET_OK) {
throw std::runtime_error(std::string("Couldn't get timer cancelled state: ")
+ rcl_get_error_string().str);
throw std::runtime_error(std::string("Couldn't get timer cancelled state: ") +
rcl_get_error_string().str);
}
return is_canceled;
}
Expand Down
30 changes: 15 additions & 15 deletions rclcpp/test/test_timer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

#include <chrono>
#include <exception>
#include <memory>

#include "rcl/timer.h"

Expand All @@ -26,28 +27,28 @@ using namespace std::chrono_literals;
class TestTimer : public ::testing::Test
{
protected:
void SetUp()
{
rclcpp::init(0, nullptr);
test_node = std::make_shared<rclcpp::Node>("test_timer_node");
}
void SetUp()
{
rclcpp::init(0, nullptr);
test_node = std::make_shared<rclcpp::Node>("test_timer_node");
}

void TearDown()
{
test_node.reset();
rclcpp::shutdown();
}
void TearDown()
{
test_node.reset();
rclcpp::shutdown();
}

rclcpp::Node::SharedPtr test_node;
rclcpp::Node::SharedPtr test_node;
};

TEST_F(TestTimer, test_is_cancelled)
{
try {
auto timer = test_node->create_wall_timer(1s,
[]() -> void {
printf("this is a test\n");
}
[]() -> void {
printf("this is a test\n");
}
);

// start and cancel
Expand All @@ -60,7 +61,6 @@ TEST_F(TestTimer, test_is_cancelled)
ASSERT_FALSE(timer->is_cancelled());
timer->cancel();
ASSERT_TRUE(timer->is_cancelled());

} catch (std::exception & e) {
FAIL() << e.what();
}
Expand Down

0 comments on commit ac80e57

Please sign in to comment.