diff options
Diffstat (limited to 'src/mongo/unittest/unittest_test.cpp')
-rw-r--r-- | src/mongo/unittest/unittest_test.cpp | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/src/mongo/unittest/unittest_test.cpp b/src/mongo/unittest/unittest_test.cpp index 37d1805a951..c9d8fa7a9a8 100644 --- a/src/mongo/unittest/unittest_test.cpp +++ b/src/mongo/unittest/unittest_test.cpp @@ -35,6 +35,7 @@ #include <limits> #include <string> +#include "mongo/bson/bsonobjbuilder.h" #include "mongo/stdx/functional.h" #include "mongo/unittest/death_test.h" #include "mongo/unittest/unittest.h" @@ -138,6 +139,56 @@ TEST(UnitTestSelfTest, TestNoDoubleEvaluation) { ASSERT_TEST_FAILS_MATCH(ASSERT_EQ(0, ++i), "(0 == 1)"); } +TEST(UnitTestSelfTest, BSONObjEQ) { + ASSERT_BSONOBJ_EQ(BSON("foo" + << "bar"), + BSON("foo" + << "bar")); +} + +TEST(UnitTestSelfTest, BSONObjNE) { + ASSERT_BSONOBJ_NE(BSON("foo" + << "bar"), + BSON("foo" + << "baz")); +} + +TEST(UnitTestSelfTest, BSONObjLT) { + ASSERT_BSONOBJ_LT(BSON("foo" + << "bar"), + BSON("foo" + << "baz")); +} + +TEST(UnitTestSelfTest, BSONObjLTE) { + ASSERT_BSONOBJ_LTE(BSON("foo" + << "bar"), + BSON("foo" + << "baz")); + ASSERT_BSONOBJ_LTE(BSON("foo" + << "bar"), + BSON("foo" + << "bar")); +} + +TEST(UnitTestSelfTest, BSONObjGT) { + ASSERT_BSONOBJ_GT(BSON("foo" + << "baz"), + BSON("foo" + << "bar")); +} + +TEST(UnitTestSelfTest, BSONObjGTE) { + ASSERT_BSONOBJ_GTE(BSON("foo" + << "baz"), + BSON("foo" + << "bar")); + ASSERT_BSONOBJ_GTE(BSON("foo" + << "bar"), + BSON("foo" + << "bar")); +} + DEATH_TEST(DeathTestSelfTest, TestDeath, "Invariant failure false") { invariant(false); } |