diff options
author | samontea <merciers.merciers@gmail.com> | 2018-08-20 12:39:02 -0400 |
---|---|---|
committer | Ian Boros <ian.boros@10gen.com> | 2018-08-24 13:41:12 -0400 |
commit | 6937c4f829d3cd1f24745c98bb47f16fa4d8de28 (patch) | |
tree | f4f0d6e46dbb82712d1b91551604bc60216fa9d4 /src/mongo/db/query/interval_test.cpp | |
parent | 62a453c0bf4f4be713c079cec178d5b40e251862 (diff) | |
download | mongo-6937c4f829d3cd1f24745c98bb47f16fa4d8de28.tar.gz |
SERVER-35337 Implement/test existence and null comparison queries using "allPaths" indexes
Diffstat (limited to 'src/mongo/db/query/interval_test.cpp')
-rw-r--r-- | src/mongo/db/query/interval_test.cpp | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/src/mongo/db/query/interval_test.cpp b/src/mongo/db/query/interval_test.cpp index 608f7e25459..6e4e88e0404 100644 --- a/src/mongo/db/query/interval_test.cpp +++ b/src/mongo/db/query/interval_test.cpp @@ -28,14 +28,13 @@ #include "mongo/db/query/interval.h" +#include "mongo/bson/bsontypes.h" #include "mongo/db/jsobj.h" #include "mongo/unittest/unittest.h" +namespace mongo { namespace { -using mongo::BSONObj; -using mongo::Interval; - // // Comparison // @@ -316,6 +315,23 @@ TEST(Introspection, GetDirection) { ASSERT(i->getDirection() == Interval::Direction::kDirectionDescending); } +TEST(Introspection, MinToMax) { + Interval a(BSON("" << 10 << "" << 20), true, true); + ASSERT_FALSE(a.isMinToMaxInclusive()); + + Interval b(BSON("" << BSONType::MinKey << "" << BSONType::MaxKey), false, true); + ASSERT_FALSE(b.isMinToMaxInclusive()); + + Interval c(BSON("" << BSONType::MinKey << "" << BSONType::MaxKey), true, false); + ASSERT_FALSE(c.isMinToMaxInclusive()); + + BSONObjBuilder builder; + builder.appendMinKey(""); + builder.appendMaxKey(""); + Interval d(builder.obj(), true, true); + ASSERT_TRUE(d.isMinToMaxInclusive()); +} + TEST(Copying, ReverseClone) { Interval a(BSON("" << 10 << "" << 20), false, true); ASSERT(a.reverseClone() == Interval(BSON("" << 20 << "" << 10), true, false)); @@ -331,3 +347,4 @@ TEST(Copying, ReverseClone) { } // unnamed namespace +} // namespace mongo |