diff options
Diffstat (limited to 'src/mongo/db/query/index_bounds_builder_test.cpp')
-rw-r--r-- | src/mongo/db/query/index_bounds_builder_test.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/mongo/db/query/index_bounds_builder_test.cpp b/src/mongo/db/query/index_bounds_builder_test.cpp index 4d84ee23a54..0130b84f84a 100644 --- a/src/mongo/db/query/index_bounds_builder_test.cpp +++ b/src/mongo/db/query/index_bounds_builder_test.cpp @@ -2979,4 +2979,19 @@ TEST(IndexBoundsBuilderTest, CanUseCoveredMatchingForExistsTrueWithSparseIndex) ASSERT_TRUE(IndexBoundsBuilder::canUseCoveredMatching(expr.get(), testIndex)); } +TEST(IndexBoundsBuilderTest, IntersectizeBasic) { + OrderedIntervalList oil1("xyz"); + oil1.intervals = {Interval(BSON("" << 0 << "" << 5), false, false)}; + + OrderedIntervalList oil2("xyz"); + oil2.intervals = {Interval(BSON("" << 1 << "" << 6), false, false)}; + + IndexBoundsBuilder::intersectize(oil1, &oil2); + + OrderedIntervalList expectedIntersection("xyz"); + expectedIntersection.intervals = {Interval(BSON("" << 1 << "" << 5), false, false)}; + + ASSERT_TRUE(oil2 == expectedIntersection); +} + } // namespace |