summaryrefslogtreecommitdiff
path: root/src/mongo/bson/bsonobjbuilder_test.cpp
diff options
context:
space:
mode:
authorMathias Stearn <mathias@10gen.com>2016-06-02 17:55:48 -0400
committerMathias Stearn <mathias@10gen.com>2016-06-09 13:00:49 -0400
commitb354fbae71aea007759e174c31a869f55fe6502f (patch)
tree4dad411c68a1b6dd9184438e7777140519d6c65a /src/mongo/bson/bsonobjbuilder_test.cpp
parent6335744b8af97e4f5b3fb15118f24833df6e7047 (diff)
downloadmongo-b354fbae71aea007759e174c31a869f55fe6502f.tar.gz
SERVER-4536 Support appending an int64_t to a BSONObjBuilder
Diffstat (limited to 'src/mongo/bson/bsonobjbuilder_test.cpp')
-rw-r--r--src/mongo/bson/bsonobjbuilder_test.cpp10
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