Skip to content

Commit 56053a4

Browse files
authored
Fix #431 (#441)
Fix #431: Missing default return in Vector3 comparison operator
1 parent 875c54e commit 56053a4

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

octomap/include/octomap/math/Vector3.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,8 @@ namespace octomath {
265265
else
266266
return false;
267267
}
268+
// all equal
269+
return false;
268270
}
269271

270272
/// @return length of the vector ("L2 norm")

octomap/src/testing/unit_tests.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,15 @@ int main(int argc, char** argv) {
5252
EXPECT_FLOAT_EQ (rotation.x(), 1.2750367);
5353
EXPECT_FLOAT_EQ (rotation.y(), (-1.1329513));
5454
EXPECT_FLOAT_EQ (rotation.z(), 0.30116868);
55+
56+
57+
Vector3 ones2 = *ones;
58+
59+
// test comparison
60+
EXPECT_TRUE(*ones < *twos);
61+
EXPECT_FALSE(*twos < *ones);
62+
EXPECT_FALSE(*ones < ones2);
63+
EXPECT_FALSE(ones2 < *ones);
5564

5665
// ------------------------------------------------------------
5766
} else if (test_name == "MathPose") {

0 commit comments

Comments
 (0)