diff options
Diffstat (limited to 'src/mongo/bson/bsonobjbuilder_test.cpp')
-rw-r--r-- | src/mongo/bson/bsonobjbuilder_test.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/mongo/bson/bsonobjbuilder_test.cpp b/src/mongo/bson/bsonobjbuilder_test.cpp index f9bad62059f..4f11df260bb 100644 --- a/src/mongo/bson/bsonobjbuilder_test.cpp +++ b/src/mongo/bson/bsonobjbuilder_test.cpp @@ -36,6 +36,7 @@ #include "mongo/unittest/unittest.h" #include <sstream> +namespace mongo { namespace { using mongo::BSONElement; @@ -73,6 +74,14 @@ void assertBSONTypeEquals(BSONType actual, BSONType expected, T value, int i) { } } +TEST(BSONObjBuilder, AppendInt64T) { + auto obj = BSON("a" << int64_t{5} << "b" << int64_t{1ll << 40}); + ASSERT_EQ(obj["a"].type(), NumberLong); + ASSERT_EQ(obj["b"].type(), NumberLong); + ASSERT_EQ(obj["a"].Long(), 5); + ASSERT_EQ(obj["b"].Long(), 1ll << 40); +} + /** * current conversion ranges in append(unsigned n) * dbl/int max/min in comments refer to max/min encodable constants @@ -323,3 +332,4 @@ TEST(BSONObjBuilderTest, ResetToEmptyForNestedBuilderOnlyResetsInnerObj) { } } // unnamed namespace +} // namespace mongo |