summaryrefslogtreecommitdiff
path: root/src/mongo/dbtests/jsobjtests.cpp
diff options
context:
space:
mode:
authorBynn Lee <bynn.lee@mongodb.com>2021-02-25 21:49:58 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-03-05 22:29:26 +0000
commit51ba5d1540ea957a7fb03a08bbb1ef4f9d6e80d2 (patch)
tree4377e994a7029d48722f5501545302484e3de641 /src/mongo/dbtests/jsobjtests.cpp
parenta407cf2e8e25aad8762bb379854e10acf17793bd (diff)
downloadmongo-51ba5d1540ea957a7fb03a08bbb1ef4f9d6e80d2.tar.gz
SERVER-43762 tighten the overload set for BSONObjBuilder::appendNumber
Diffstat (limited to 'src/mongo/dbtests/jsobjtests.cpp')
-rw-r--r--src/mongo/dbtests/jsobjtests.cpp46
1 files changed, 1 insertions, 45 deletions
diff --git a/src/mongo/dbtests/jsobjtests.cpp b/src/mongo/dbtests/jsobjtests.cpp
index c3e754b8771..99f984e0c87 100644
--- a/src/mongo/dbtests/jsobjtests.cpp
+++ b/src/mongo/dbtests/jsobjtests.cpp
@@ -561,49 +561,6 @@ public:
}
};
-struct AppendIntOrLL {
- void run() {
- const long long billion = 1000 * 1000 * 1000;
-
- BSONObjBuilder b;
- b.appendIntOrLL("i1", 1);
- b.appendIntOrLL("i2", -1);
- b.appendIntOrLL("i3", 1 * billion);
- b.appendIntOrLL("i4", -1 * billion);
-
- b.appendIntOrLL("L1", 2 * billion);
- b.appendIntOrLL("L2", -2 * billion);
- b.appendIntOrLL("L3", 4 * billion);
- b.appendIntOrLL("L4", -4 * billion);
- b.appendIntOrLL("L5", 16 * billion);
- b.appendIntOrLL("L6", -16 * billion);
-
- BSONObj o = b.obj();
-
- ASSERT(o["i1"].type() == NumberInt);
- ASSERT(o["i1"].number() == 1);
- ASSERT(o["i2"].type() == NumberInt);
- ASSERT(o["i2"].number() == -1);
- ASSERT(o["i3"].type() == NumberInt);
- ASSERT(o["i3"].number() == 1 * billion);
- ASSERT(o["i4"].type() == NumberInt);
- ASSERT(o["i4"].number() == -1 * billion);
-
- ASSERT(o["L1"].isNumber());
- ASSERT(o["L1"].number() == 2 * billion);
- ASSERT(o["L2"].isNumber());
- ASSERT(o["L2"].number() == -2 * billion);
- ASSERT(o["L3"].type() == NumberLong);
- ASSERT(o["L3"].number() == 4 * billion);
- ASSERT(o["L4"].type() == NumberLong);
- ASSERT(o["L4"].number() == -4 * billion);
- ASSERT(o["L5"].type() == NumberLong);
- ASSERT(o["L5"].number() == 16 * billion);
- ASSERT(o["L6"].type() == NumberLong);
- ASSERT(o["L6"].number() == -16 * billion);
- }
-};
-
struct AppendNumber {
void run() {
BSONObjBuilder b;
@@ -619,7 +576,7 @@ struct AppendNumber {
ASSERT(o["a"].type() == NumberInt);
ASSERT(o["b"].type() == NumberDouble);
ASSERT(o["c"].type() == NumberInt);
- ASSERT(o["d"].type() == NumberDouble);
+ ASSERT(o["d"].type() == NumberLong);
ASSERT(o["e"].type() == NumberLong);
ASSERT(o["f"].type() == NumberDecimal);
}
@@ -2008,7 +1965,6 @@ public:
add<BSONObjTests::MultiKeySortOrder>();
add<BSONObjTests::Nan>();
add<BSONObjTests::AsTempObj>();
- add<BSONObjTests::AppendIntOrLL>();
add<BSONObjTests::AppendNumber>();
add<BSONObjTests::ToStringNumber>();
add<BSONObjTests::AppendAs>();