You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by ji...@apache.org on 2014/05/10 00:22:26 UTC

git commit: Added equal operator for stout Interval.

Repository: mesos
Updated Branches:
  refs/heads/master 93c719928 -> 2a11d35d8


Added equal operator for stout Interval.

Review: https://reviews.apache.org/r/21237


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/2a11d35d
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/2a11d35d
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/2a11d35d

Branch: refs/heads/master
Commit: 2a11d35d883b47f9d06adf409bd5d49ba2de7f0b
Parents: 93c7199
Author: Jie Yu <yu...@gmail.com>
Authored: Thu May 8 14:25:08 2014 -0700
Committer: Jie Yu <yu...@gmail.com>
Committed: Fri May 9 15:21:50 2014 -0700

----------------------------------------------------------------------
 .../3rdparty/stout/include/stout/interval.hpp       | 10 ++++++++++
 .../3rdparty/stout/tests/interval_tests.cpp         | 16 ++++++++++++++++
 2 files changed, 26 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/2a11d35d/3rdparty/libprocess/3rdparty/stout/include/stout/interval.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/include/stout/interval.hpp b/3rdparty/libprocess/3rdparty/stout/include/stout/interval.hpp
index 2423f67..cfa8e69 100644
--- a/3rdparty/libprocess/3rdparty/stout/include/stout/interval.hpp
+++ b/3rdparty/libprocess/3rdparty/stout/include/stout/interval.hpp
@@ -92,6 +92,16 @@ public:
   // Checks if this interval intersects with an interval set.
   bool intersects(const IntervalSet<T>& set) const;
 
+  bool operator == (const Interval<T>& that) const
+  {
+    return data == that.data;
+  }
+
+  bool operator != (const Interval<T>& that) const
+  {
+    return !operator == (that);
+  }
+
 private:
   friend class Bound<T>;
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/2a11d35d/3rdparty/libprocess/3rdparty/stout/tests/interval_tests.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/tests/interval_tests.cpp b/3rdparty/libprocess/3rdparty/stout/tests/interval_tests.cpp
index b251d88..a80543b 100644
--- a/3rdparty/libprocess/3rdparty/stout/tests/interval_tests.cpp
+++ b/3rdparty/libprocess/3rdparty/stout/tests/interval_tests.cpp
@@ -119,6 +119,22 @@ TEST(IntervalTest, EmptyInterval)
 }
 
 
+TEST(IntervalTest, IntervalEqual)
+{
+  Interval<int> interval((Bound<int>::closed(1), Bound<int>::open(3)));
+  Interval<int> interval2((Bound<int>::closed(1), Bound<int>::open(3)));
+  Interval<int> interval3((Bound<int>::open(1), Bound<int>::open(1)));
+  Interval<int> interval4((Bound<int>::open(1), Bound<int>::open(1)));
+  Interval<int> interval5((Bound<int>::open(2), Bound<int>::closed(3)));
+
+  EXPECT_EQ(interval, interval2);
+  EXPECT_EQ(interval3, interval4);
+  EXPECT_NE(interval, interval3);
+  EXPECT_NE(interval2, interval5);
+  EXPECT_NE(interval3, interval5);
+}
+
+
 TEST(IntervalTest, Constructor)
 {
   IntervalSet<int> set(0);