summaryrefslogtreecommitdiff
path: root/src/mongo/db/pipeline/expression_test.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/pipeline/expression_test.cpp')
-rw-r--r--src/mongo/db/pipeline/expression_test.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/mongo/db/pipeline/expression_test.cpp b/src/mongo/db/pipeline/expression_test.cpp
index b2610e97bdb..345c5042f09 100644
--- a/src/mongo/db/pipeline/expression_test.cpp
+++ b/src/mongo/db/pipeline/expression_test.cpp
@@ -2193,6 +2193,22 @@ TEST(ExpressionFromAccumulators, StdDevSamp) {
{{}, Value(BSONNULL)}});
}
+TEST(ExpressionPowTest, NegativeOneRaisedToNegativeOddExponentShouldOutPutNegativeOne) {
+ assertExpectedResults("$pow",
+ {
+ {{Value(-1), Value(-1)}, Value(-1)},
+ {{Value(-1), Value(-2)}, Value(1)},
+ {{Value(-1), Value(-3)}, Value(-1)},
+
+ {{Value(-1LL), Value(0LL)}, Value(1LL)},
+ {{Value(-1LL), Value(-1LL)}, Value(-1LL)},
+ {{Value(-1LL), Value(-2LL)}, Value(1LL)},
+ {{Value(-1LL), Value(-3LL)}, Value(-1LL)},
+ {{Value(-1LL), Value(-4LL)}, Value(1LL)},
+ {{Value(-1LL), Value(-5LL)}, Value(-1LL)},
+ });
+}
+
namespace FieldPath {
/** The provided field path does not pass validation. */