diff options
author | Benety Goh <benety@mongodb.com> | 2021-08-19 08:50:38 -0400 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-08-19 13:17:44 +0000 |
commit | ebf3af24d79133eddc61309d85f4267b69795d79 (patch) | |
tree | d714a4d922eec4f32771dc00e64f9d141de257d9 /src/mongo/db/pipeline/expression_test.cpp | |
parent | cbb527e1b930a4d55deb499312dce917cf491558 (diff) | |
download | mongo-ebf3af24d79133eddc61309d85f4267b69795d79.tar.gz |
SERVER-57633 fix implicit long long to double conversion in unit tests
Diffstat (limited to 'src/mongo/db/pipeline/expression_test.cpp')
-rw-r--r-- | src/mongo/db/pipeline/expression_test.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/mongo/db/pipeline/expression_test.cpp b/src/mongo/db/pipeline/expression_test.cpp index 512a965b6a4..e2488522bea 100644 --- a/src/mongo/db/pipeline/expression_test.cpp +++ b/src/mongo/db/pipeline/expression_test.cpp @@ -487,8 +487,8 @@ class LongDoubleNoOverflow : public TwoOperandBase { return BSON("" << double(numeric_limits<long long>::max())); } BSONObj expectedResult() { - return BSON("" << numeric_limits<long long>::max() + - double(numeric_limits<long long>::max())); + return BSON("" << static_cast<double>(numeric_limits<long long>::max()) + + static_cast<double>(numeric_limits<long long>::max())); } }; @@ -3317,7 +3317,7 @@ TEST(ExpressionSubtractTest, OverflowLong) { expression = Expression::parseExpression(&expCtx, obj, expCtx.variablesParseState); result = expression->evaluate({}, &expCtx.variables); ASSERT_EQ(result.getType(), BSONType::NumberDouble); - ASSERT_EQ(result.getDouble(), static_cast<double>(minLong) - maxLong); + ASSERT_EQ(result.getDouble(), static_cast<double>(minLong) - static_cast<double>(maxLong)); // minLong = -1 - maxLong. The below subtraction should fit into long long data type. obj = BSON("$subtract" << BSON_ARRAY(-1 << maxLong)); |