diff options
author | David Storch <david.storch@10gen.com> | 2016-08-26 16:23:22 -0400 |
---|---|---|
committer | David Storch <david.storch@10gen.com> | 2016-09-02 10:24:02 -0400 |
commit | 231de89b7c8e84b7b6cf638008b483ecab6ba1b6 (patch) | |
tree | 2b0143e02e4aa93ffee23c2a412264309f383d1e /src/mongo/dbtests/jsobjtests.cpp | |
parent | 54488beeea99b3046931109c170d7e51cea0964d (diff) | |
download | mongo-231de89b7c8e84b7b6cf638008b483ecab6ba1b6.tar.gz |
SERVER-24508 BSONElement::ComparatorInterface
Diffstat (limited to 'src/mongo/dbtests/jsobjtests.cpp')
-rw-r--r-- | src/mongo/dbtests/jsobjtests.cpp | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/src/mongo/dbtests/jsobjtests.cpp b/src/mongo/dbtests/jsobjtests.cpp index 72d18905a5f..a6b3fea9547 100644 --- a/src/mongo/dbtests/jsobjtests.cpp +++ b/src/mongo/dbtests/jsobjtests.cpp @@ -37,6 +37,7 @@ #include <iostream> #include "mongo/bson/bsonobj_comparator.h" +#include "mongo/bson/simple_bsonelement_comparator.h" #include "mongo/bson/util/builder.h" #include "mongo/db/bson/dotted_path_support.h" #include "mongo/db/jsobj.h" @@ -309,26 +310,29 @@ public: class IsPrefixOf : public Base { public: void run() { + SimpleBSONElementComparator eltCmp; { BSONObj k = BSON("x" << 1); - verify(!k.isPrefixOf(BSON("a" << 1))); - verify(k.isPrefixOf(BSON("x" << 1))); - verify(k.isPrefixOf(BSON("x" << 1 << "a" << 1))); - verify(!k.isPrefixOf(BSON("a" << 1 << "x" << 1))); + ASSERT(!k.isPrefixOf(BSON("a" << 1), eltCmp)); + ASSERT(k.isPrefixOf(BSON("x" << 1), eltCmp)); + ASSERT(k.isPrefixOf(BSON("x" << 1 << "a" << 1), eltCmp)); + ASSERT(!k.isPrefixOf(BSON("a" << 1 << "x" << 1), eltCmp)); } { BSONObj k = BSON("x" << 1 << "y" << 1); - verify(!k.isPrefixOf(BSON("x" << 1))); - verify(!k.isPrefixOf(BSON("x" << 1 << "z" << 1))); - verify(k.isPrefixOf(BSON("x" << 1 << "y" << 1))); - verify(k.isPrefixOf(BSON("x" << 1 << "y" << 1 << "z" << 1))); + ASSERT(!k.isPrefixOf(BSON("x" << 1), eltCmp)); + ASSERT(!k.isPrefixOf(BSON("x" << 1 << "z" << 1), eltCmp)); + ASSERT(k.isPrefixOf(BSON("x" << 1 << "y" << 1), eltCmp)); + ASSERT(k.isPrefixOf(BSON("x" << 1 << "y" << 1 << "z" << 1), eltCmp)); } { BSONObj k = BSON("x" << 1); - verify(!k.isPrefixOf(BSON("x" - << "hi"))); - verify(k.isPrefixOf(BSON("x" << 1 << "a" - << "hi"))); + ASSERT(!k.isPrefixOf(BSON("x" + << "hi"), + eltCmp)); + ASSERT(k.isPrefixOf(BSON("x" << 1 << "a" + << "hi"), + eltCmp)); } { BSONObj k = BSON("x" << 1); |