@@ -21,6 +21,13 @@ class OverlapTests
2121class ContainmentTests
2222 : public ::testing::Test
2323{
24+ public:
25+ using types = IntervalTypes <int >;
26+ };
27+
28+ class DistanceTests
29+ : public ::testing::Test
30+ {
2431public:
2532 using types = IntervalTypes <int >;
2633};
@@ -188,6 +195,7 @@ TEST_F(ContainmentTests, ExpectIntervalWithinOther)
188195 EXPECT_EQ (base.within ({-73 , -23 }), true );
189196 EXPECT_EQ (base.within ({-100 , -100 }), true );
190197 EXPECT_EQ (base.within ({100 , 100 }), true );
198+ EXPECT_EQ (base.within ({0 , 0 }), true );
191199}
192200
193201TEST_F (ContainmentTests, ExpectIntervalNotWithinOther)
@@ -200,3 +208,11 @@ TEST_F(ContainmentTests, ExpectIntervalNotWithinOther)
200208 EXPECT_EQ (base.within ({-200 , -101 }), false );
201209 EXPECT_EQ (base.within ({200 , 300 }), false );
202210}
211+
212+ TEST_F (DistanceTests, DistanceIsZeroOnOverlap)
213+ {
214+ auto base = types::interval_type{-35 , 96 };
215+
216+ auto other = types::interval_type{-20 , 600 };
217+ EXPECT_EQ (base - other, 0 );
218+ }
0 commit comments