From 3d99c24d82113c83b220960e0e98bb15e5ba4b40 Mon Sep 17 00:00:00 2001 From: cbeall3 Date: Tue, 26 May 2015 12:25:33 -0400 Subject: [PATCH] Fix equality operator for Point2, and add test that would have caught this bug --- gtsam/geometry/Point2.h | 2 +- gtsam/geometry/tests/testPoint2.cpp | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/gtsam/geometry/Point2.h b/gtsam/geometry/Point2.h index 5e8b0695c..56809ae53 100644 --- a/gtsam/geometry/Point2.h +++ b/gtsam/geometry/Point2.h @@ -148,7 +148,7 @@ public: /// @{ /// equality - inline bool operator ==(const Point2& q) const {return x_==q.x_ && q.y_==q.y_;} + inline bool operator ==(const Point2& q) const {return x_==q.x_ && y_==q.y_;} /// get x double x() const {return x_;} diff --git a/gtsam/geometry/tests/testPoint2.cpp b/gtsam/geometry/tests/testPoint2.cpp index fce7955e9..55b03e08e 100644 --- a/gtsam/geometry/tests/testPoint2.cpp +++ b/gtsam/geometry/tests/testPoint2.cpp @@ -61,6 +61,12 @@ TEST(Point2, constructor) { EXPECT(assert_equal(p1, p2)); } +/* ************************************************************************* */ +TEST(Point2, equality) { + Point2 p1(1, 2), p2(1,3); + EXPECT(!(p1 == p2)); +} + /* ************************************************************************* */ TEST(Point2, Lie) { Point2 p1(1, 2), p2(4, 5);