Skip to content

Commit 60a1328

Browse files
committed
Fix roslint issues
1 parent 75753e2 commit 60a1328

File tree

1 file changed

+30
-20
lines changed

1 file changed

+30
-20
lines changed

fuse_models/test/test_imu_2d.cpp

Lines changed: 30 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,13 @@
4545

4646
#include <gtest/gtest.h>
4747

48+
#include <algorithm>
4849
#include <chrono>
4950
#include <mutex>
5051
#include <string>
5152
#include <thread>
5253
#include <utility>
54+
#include <vector>
5355

5456
/**
5557
* @brief Imu2D test fixture
@@ -131,7 +133,7 @@ TEST_F(Imu2DTestFixture, BaseFrameYawAngularVelocity)
131133

132134
setCmdVel(twist);
133135

134-
using namespace std::chrono_literals;
136+
using namespace std::chrono_literals; // NOLINT(build/namespaces)
135137
std::this_thread::sleep_for(3s);
136138

137139
// Confirm the last transaction has the expect number of variables and constraints generated by the imu sensor model
@@ -175,9 +177,10 @@ TEST_F(Imu2DTestFixture, BaseFrameYawAngularVelocity)
175177
const auto& w = last_odom.twist.twist.angular.z;
176178

177179
// That is, ensure there is one fuse_variables::VelocityAngular2DStamped variable
178-
EXPECT_EQ(1, std::count_if(added_variables.begin(), added_variables.end(), [](const auto& variable) -> bool {
179-
return dynamic_cast<const fuse_variables::VelocityAngular2DStamped*>(&variable);
180-
}));
180+
EXPECT_EQ(1, std::count_if(added_variables.begin(), added_variables.end(),
181+
[](const auto& variable) -> bool { // NOLINT(whitespace/braces)
182+
return dynamic_cast<const fuse_variables::VelocityAngular2DStamped*>(&variable);
183+
})); // NOLINT(whitespace/braces)
181184

182185
// And iterate over all added variables to process it
183186
for (const auto& variable : added_variables)
@@ -197,9 +200,11 @@ TEST_F(Imu2DTestFixture, BaseFrameYawAngularVelocity)
197200
// wheel odometry twist angular velocity along the z axis
198201

199202
// That is, ensure there is one fuse_constraints::AbsoluteVelocityAngular2DStampedConstraint constraint
200-
EXPECT_EQ(1, std::count_if(added_constraints.begin(), added_constraints.end(), [](const auto& constraint) -> bool {
201-
return dynamic_cast<const fuse_constraints::AbsoluteVelocityAngular2DStampedConstraint*>(&constraint);
202-
}));
203+
EXPECT_EQ(1, std::count_if(added_constraints.begin(), added_constraints.end(),
204+
[](const auto& constraint) -> bool { // NOLINT(whitespace/braces)
205+
return dynamic_cast<const fuse_constraints::AbsoluteVelocityAngular2DStampedConstraint*>(
206+
&constraint);
207+
})); // NOLINT(whitespace/braces)
203208

204209
// And iterate over all added constraints to process it
205210
for (const auto& constraint : added_constraints)
@@ -223,9 +228,10 @@ TEST_F(Imu2DTestFixture, BaseFrameYawAngularVelocity)
223228
// axis
224229

225230
// That is, ensure there are two fuse_variables::Orientation2DStamped variables
226-
EXPECT_EQ(2, std::count_if(added_variables.begin(), added_variables.end(), [](const auto& variable) -> bool {
227-
return dynamic_cast<const fuse_variables::Orientation2DStamped*>(&variable);
228-
}));
231+
EXPECT_EQ(2, std::count_if(added_variables.begin(), added_variables.end(),
232+
[](const auto& variable) -> bool { // NOLINT(whitespace/braces)
233+
return dynamic_cast<const fuse_variables::Orientation2DStamped*>(&variable);
234+
})); // NOLINT(whitespace/braces)
229235

230236
// Iterate over all added variables to process retrieve the fuse_variables::Orientation2DStamped variables
231237
std::vector<const fuse_variables::Orientation2DStamped*> orientations;
@@ -243,7 +249,7 @@ TEST_F(Imu2DTestFixture, BaseFrameYawAngularVelocity)
243249

244250
// Sort them by stamp
245251
std::sort(orientations.begin(), orientations.end(),
246-
[](const auto& lhs, const auto& rhs) { return lhs->stamp() < rhs->stamp(); });
252+
[](const auto& lhs, const auto& rhs) { return lhs->stamp() < rhs->stamp(); }); // NOLINT(whitespace/braces)
247253

248254
// And check the angular velocity is the same as the wheel odometry one
249255
//
@@ -259,9 +265,11 @@ TEST_F(Imu2DTestFixture, BaseFrameYawAngularVelocity)
259265
// odometry twist angular velocity along the z axis
260266

261267
// That is, ensure there is one fuse_constraints::RelativePose2DStampedConstraint constraint
262-
EXPECT_EQ(1, std::count_if(added_constraints.begin(), added_constraints.end(), [](const auto& constraint) -> bool {
263-
return dynamic_cast<const fuse_constraints::RelativePose2DStampedConstraint*>(&constraint);
264-
}));
268+
EXPECT_EQ(1,
269+
std::count_if(added_constraints.begin(), added_constraints.end(),
270+
[](const auto& constraint) -> bool { // NOLINT(whitespace/braces)
271+
return dynamic_cast<const fuse_constraints::RelativePose2DStampedConstraint*>(&constraint);
272+
})); // NOLINT(whitespace/braces)
265273

266274
// And iterate over all added constraints to process it
267275
for (const auto& constraint : added_constraints)
@@ -284,17 +292,19 @@ TEST_F(Imu2DTestFixture, BaseFrameYawAngularVelocity)
284292
const auto& position1_uuid = variables[0];
285293
const auto& position2_uuid = variables[2];
286294

287-
const auto position1_iter =
288-
std::find_if(added_variables.begin(), added_variables.end(),
289-
[&position1_uuid](const auto& variable) { return variable.uuid() == position1_uuid; });
295+
const auto position1_iter = std::find_if(added_variables.begin(), added_variables.end(),
296+
[&position1_uuid](const auto& variable) { // NOLINT(whitespace/braces)
297+
return variable.uuid() == position1_uuid;
298+
}); // NOLINT(whitespace/braces)
290299
ASSERT_NE(added_variables.end(), position1_iter);
291300

292301
const auto position1 = dynamic_cast<const fuse_variables::Position2DStamped*>(&*position1_iter);
293302
ASSERT_TRUE(position1);
294303

295-
const auto position2_iter =
296-
std::find_if(added_variables.begin(), added_variables.end(),
297-
[&position2_uuid](const auto& variable) { return variable.uuid() == position2_uuid; });
304+
const auto position2_iter = std::find_if(added_variables.begin(), added_variables.end(),
305+
[&position2_uuid](const auto& variable) { // NOLINT(whitespace/braces)
306+
return variable.uuid() == position2_uuid;
307+
}); // NOLINT(whitespace/braces)
298308
ASSERT_NE(added_variables.end(), position2_iter);
299309

300310
const auto position2 = dynamic_cast<const fuse_variables::Position2DStamped*>(&*position2_iter);

0 commit comments

Comments
 (0)