summaryrefslogtreecommitdiff
path: root/src/mongo/db/update/arithmetic_node_test.cpp
diff options
context:
space:
mode:
authorNick Zolnierz <nicholas.zolnierz@mongodb.com>2018-11-02 09:34:19 -0400
committerNick Zolnierz <nicholas.zolnierz@mongodb.com>2018-11-30 12:18:35 -0500
commitc60c435ffd0bece5000d66cd5ada876717c89827 (patch)
tree8c081eff780ed6d56ff39731a626b7d65da9b03a /src/mongo/db/update/arithmetic_node_test.cpp
parentf3acfdec219b7a9122b4954a269c89e3604416d2 (diff)
downloadmongo-c60c435ffd0bece5000d66cd5ada876717c89827.tar.gz
SERVER-31012: expose optional way of retrieving FieldRef's for fields that were modified by an update
Diffstat (limited to 'src/mongo/db/update/arithmetic_node_test.cpp')
-rw-r--r--src/mongo/db/update/arithmetic_node_test.cpp50
1 files changed, 50 insertions, 0 deletions
diff --git a/src/mongo/db/update/arithmetic_node_test.cpp b/src/mongo/db/update/arithmetic_node_test.cpp
index 3aa6aeeeced..0bfe1a8f71a 100644
--- a/src/mongo/db/update/arithmetic_node_test.cpp
+++ b/src/mongo/db/update/arithmetic_node_test.cpp
@@ -127,6 +127,7 @@ TEST_F(ArithmeticNodeTest, ApplyIncNoOp) {
ASSERT_EQUALS(fromjson("{a: 5}"), doc);
ASSERT_TRUE(doc.isInPlaceModeEnabled());
ASSERT_EQUALS(fromjson("{}"), getLogDoc());
+ ASSERT_EQUALS(getModifiedPaths(), "{a}");
}
TEST_F(ArithmeticNodeTest, ApplyMulNoOp) {
@@ -144,6 +145,7 @@ TEST_F(ArithmeticNodeTest, ApplyMulNoOp) {
ASSERT_EQUALS(fromjson("{a: 5}"), doc);
ASSERT_TRUE(doc.isInPlaceModeEnabled());
ASSERT_EQUALS(fromjson("{}"), getLogDoc());
+ ASSERT_EQUALS(getModifiedPaths(), "{a}");
}
TEST_F(ArithmeticNodeTest, ApplyRoundingNoOp) {
@@ -161,6 +163,7 @@ TEST_F(ArithmeticNodeTest, ApplyRoundingNoOp) {
ASSERT_EQUALS(fromjson("{a: 6.022e23}"), doc);
ASSERT_TRUE(doc.isInPlaceModeEnabled());
ASSERT_EQUALS(fromjson("{}"), getLogDoc());
+ ASSERT_EQUALS(getModifiedPaths(), "{a}");
}
TEST_F(ArithmeticNodeTest, ApplyEmptyPathToCreate) {
@@ -178,6 +181,7 @@ TEST_F(ArithmeticNodeTest, ApplyEmptyPathToCreate) {
ASSERT_EQUALS(fromjson("{a: 11}"), doc);
ASSERT_TRUE(doc.isInPlaceModeEnabled());
ASSERT_EQUALS(fromjson("{$set: {a: 11}}"), getLogDoc());
+ ASSERT_EQUALS(getModifiedPaths(), "{a}");
}
TEST_F(ArithmeticNodeTest, ApplyCreatePath) {
@@ -196,6 +200,7 @@ TEST_F(ArithmeticNodeTest, ApplyCreatePath) {
ASSERT_EQUALS(fromjson("{a: {d: 5, b: {c: 6}}}"), doc);
ASSERT_FALSE(doc.isInPlaceModeEnabled());
ASSERT_EQUALS(fromjson("{$set: {'a.b.c': 6}}"), getLogDoc());
+ ASSERT_EQUALS(getModifiedPaths(), "{a.b.c}");
}
TEST_F(ArithmeticNodeTest, ApplyExtendPath) {
@@ -213,6 +218,7 @@ TEST_F(ArithmeticNodeTest, ApplyExtendPath) {
ASSERT_TRUE(result.indexesAffected);
ASSERT_EQUALS(fromjson("{a: {c: 1, b: 2}}"), doc);
ASSERT_FALSE(doc.isInPlaceModeEnabled());
+ ASSERT_EQUALS(getModifiedPaths(), "{a.b}");
}
TEST_F(ArithmeticNodeTest, ApplyCreatePathFromRoot) {
@@ -230,6 +236,7 @@ TEST_F(ArithmeticNodeTest, ApplyCreatePathFromRoot) {
ASSERT_EQUALS(fromjson("{c: 5, a: {b: 6}}"), doc);
ASSERT_FALSE(doc.isInPlaceModeEnabled());
ASSERT_EQUALS(fromjson("{$set: {'a.b': 6}}"), getLogDoc());
+ ASSERT_EQUALS(getModifiedPaths(), "{a.b}");
}
TEST_F(ArithmeticNodeTest, ApplyPositional) {
@@ -248,6 +255,7 @@ TEST_F(ArithmeticNodeTest, ApplyPositional) {
ASSERT_EQUALS(fromjson("{a: [0, 7, 2]}"), doc);
ASSERT_TRUE(doc.isInPlaceModeEnabled());
ASSERT_EQUALS(fromjson("{$set: {'a.1': 7}}"), getLogDoc());
+ ASSERT_EQUALS(getModifiedPaths(), "{a.1}");
}
TEST_F(ArithmeticNodeTest, ApplyNonViablePathToInc) {
@@ -283,6 +291,7 @@ TEST_F(ArithmeticNodeTest, ApplyNonViablePathToCreateFromReplicationIsNoOp) {
ASSERT_EQUALS(fromjson("{a: 5}"), doc);
ASSERT_TRUE(doc.isInPlaceModeEnabled());
ASSERT_EQUALS(fromjson("{}"), getLogDoc());
+ ASSERT_EQUALS(getModifiedPaths(), "{a.b}");
}
TEST_F(ArithmeticNodeTest, ApplyNoIndexDataNoLogBuilder) {
@@ -299,6 +308,7 @@ TEST_F(ArithmeticNodeTest, ApplyNoIndexDataNoLogBuilder) {
ASSERT_FALSE(result.indexesAffected);
ASSERT_EQUALS(fromjson("{a: 11}"), doc);
ASSERT_TRUE(doc.isInPlaceModeEnabled());
+ ASSERT_EQUALS(getModifiedPaths(), "{a}");
}
TEST_F(ArithmeticNodeTest, ApplyDoesNotAffectIndexes) {
@@ -315,6 +325,7 @@ TEST_F(ArithmeticNodeTest, ApplyDoesNotAffectIndexes) {
ASSERT_FALSE(result.indexesAffected);
ASSERT_EQUALS(fromjson("{a: 11}"), doc);
ASSERT_TRUE(doc.isInPlaceModeEnabled());
+ ASSERT_EQUALS(getModifiedPaths(), "{a}");
}
TEST_F(ArithmeticNodeTest, IncTypePromotionIsNotANoOp) {
@@ -331,6 +342,7 @@ TEST_F(ArithmeticNodeTest, IncTypePromotionIsNotANoOp) {
ASSERT_TRUE(result.indexesAffected);
ASSERT_EQUALS(fromjson("{a: NumberLong(2)}"), doc);
ASSERT_FALSE(doc.isInPlaceModeEnabled());
+ ASSERT_EQUALS(getModifiedPaths(), "{a}");
}
TEST_F(ArithmeticNodeTest, MulTypePromotionIsNotANoOp) {
@@ -347,6 +359,7 @@ TEST_F(ArithmeticNodeTest, MulTypePromotionIsNotANoOp) {
ASSERT_TRUE(result.indexesAffected);
ASSERT_EQUALS(fromjson("{a: NumberLong(2)}"), doc);
ASSERT_FALSE(doc.isInPlaceModeEnabled());
+ ASSERT_EQUALS(getModifiedPaths(), "{a}");
}
TEST_F(ArithmeticNodeTest, TypePromotionFromIntToDecimalIsNotANoOp) {
@@ -364,6 +377,7 @@ TEST_F(ArithmeticNodeTest, TypePromotionFromIntToDecimalIsNotANoOp) {
ASSERT_EQUALS(fromjson("{a: NumberDecimal(\"5.0\")}"), doc);
ASSERT_FALSE(doc.isInPlaceModeEnabled());
ASSERT_EQUALS(fromjson("{$set: {a: NumberDecimal(\"5.0\")}}"), getLogDoc());
+ ASSERT_EQUALS(getModifiedPaths(), "{a}");
}
TEST_F(ArithmeticNodeTest, TypePromotionFromLongToDecimalIsNotANoOp) {
@@ -381,6 +395,7 @@ TEST_F(ArithmeticNodeTest, TypePromotionFromLongToDecimalIsNotANoOp) {
ASSERT_EQUALS(fromjson("{a: NumberDecimal(\"5.0\")}"), doc);
ASSERT_FALSE(doc.isInPlaceModeEnabled());
ASSERT_EQUALS(fromjson("{$set: {a: NumberDecimal(\"5.0\")}}"), getLogDoc());
+ ASSERT_EQUALS(getModifiedPaths(), "{a}");
}
TEST_F(ArithmeticNodeTest, TypePromotionFromDoubleToDecimalIsNotANoOp) {
@@ -398,6 +413,7 @@ TEST_F(ArithmeticNodeTest, TypePromotionFromDoubleToDecimalIsNotANoOp) {
ASSERT_EQUALS(fromjson("{a: NumberDecimal(\"5.25\")}"), doc);
ASSERT_FALSE(doc.isInPlaceModeEnabled());
ASSERT_EQUALS(fromjson("{$set: {a: NumberDecimal(\"5.25\")}}"), getLogDoc());
+ ASSERT_EQUALS(getModifiedPaths(), "{a}");
}
TEST_F(ArithmeticNodeTest, ApplyPromoteToFloatingPoint) {
@@ -414,6 +430,7 @@ TEST_F(ArithmeticNodeTest, ApplyPromoteToFloatingPoint) {
ASSERT_TRUE(result.indexesAffected);
ASSERT_EQUALS(fromjson("{a: 1.2}"), doc);
ASSERT_TRUE(doc.isInPlaceModeEnabled());
+ ASSERT_EQUALS(getModifiedPaths(), "{a}");
}
TEST_F(ArithmeticNodeTest, IncrementedDecimalStaysDecimal) {
@@ -431,6 +448,7 @@ TEST_F(ArithmeticNodeTest, IncrementedDecimalStaysDecimal) {
ASSERT_EQUALS(fromjson("{a: NumberDecimal(\"11.5\")}"), doc);
ASSERT_TRUE(doc.isInPlaceModeEnabled());
ASSERT_EQUALS(fromjson("{$set: {a: NumberDecimal(\"11.5\")}}"), getLogDoc());
+ ASSERT_EQUALS(getModifiedPaths(), "{a}");
}
TEST_F(ArithmeticNodeTest, OverflowIntToLong) {
@@ -450,6 +468,7 @@ TEST_F(ArithmeticNodeTest, OverflowIntToLong) {
ASSERT_EQUALS(mongo::NumberLong, doc.root()["a"].getType());
ASSERT_EQUALS(BSON("a" << static_cast<long long>(initialValue) + 1), doc);
ASSERT_FALSE(doc.isInPlaceModeEnabled());
+ ASSERT_EQUALS(getModifiedPaths(), "{a}");
}
TEST_F(ArithmeticNodeTest, UnderflowIntToLong) {
@@ -469,6 +488,7 @@ TEST_F(ArithmeticNodeTest, UnderflowIntToLong) {
ASSERT_EQUALS(mongo::NumberLong, doc.root()["a"].getType());
ASSERT_EQUALS(BSON("a" << static_cast<long long>(initialValue) - 1), doc);
ASSERT_FALSE(doc.isInPlaceModeEnabled());
+ ASSERT_EQUALS(getModifiedPaths(), "{a}");
}
TEST_F(ArithmeticNodeTest, IncModeCanBeReused) {
@@ -486,6 +506,7 @@ TEST_F(ArithmeticNodeTest, IncModeCanBeReused) {
ASSERT_TRUE(result.indexesAffected);
ASSERT_EQUALS(fromjson("{a: 2}"), doc1);
ASSERT_TRUE(doc1.isInPlaceModeEnabled());
+ ASSERT_EQUALS(getModifiedPaths(), "{a}");
resetApplyParams();
setPathTaken("a");
@@ -495,6 +516,7 @@ TEST_F(ArithmeticNodeTest, IncModeCanBeReused) {
ASSERT_TRUE(result.indexesAffected);
ASSERT_EQUALS(fromjson("{a: 3}"), doc2);
ASSERT_TRUE(doc1.isInPlaceModeEnabled());
+ ASSERT_EQUALS(getModifiedPaths(), "{a}");
}
TEST_F(ArithmeticNodeTest, CreatedNumberHasSameTypeAsInc) {
@@ -511,6 +533,7 @@ TEST_F(ArithmeticNodeTest, CreatedNumberHasSameTypeAsInc) {
ASSERT_TRUE(result.indexesAffected);
ASSERT_EQUALS(fromjson("{b: 6, a: NumberLong(5)}"), doc);
ASSERT_FALSE(doc.isInPlaceModeEnabled());
+ ASSERT_EQUALS(getModifiedPaths(), "{a}");
}
TEST_F(ArithmeticNodeTest, CreatedNumberHasSameTypeAsMul) {
@@ -527,6 +550,7 @@ TEST_F(ArithmeticNodeTest, CreatedNumberHasSameTypeAsMul) {
ASSERT_TRUE(result.indexesAffected);
ASSERT_EQUALS(fromjson("{b: 6, a: NumberLong(0)}"), doc);
ASSERT_FALSE(doc.isInPlaceModeEnabled());
+ ASSERT_EQUALS(getModifiedPaths(), "{a}");
}
TEST_F(ArithmeticNodeTest, ApplyEmptyDocument) {
@@ -543,6 +567,7 @@ TEST_F(ArithmeticNodeTest, ApplyEmptyDocument) {
ASSERT_TRUE(result.indexesAffected);
ASSERT_EQUALS(fromjson("{a: 2}"), doc);
ASSERT_FALSE(doc.isInPlaceModeEnabled());
+ ASSERT_EQUALS(getModifiedPaths(), "{a}");
}
TEST_F(ArithmeticNodeTest, ApplyIncToObjectFails) {
@@ -624,6 +649,7 @@ TEST_F(ArithmeticNodeTest, ApplyNewPath) {
ASSERT_TRUE(result.indexesAffected);
ASSERT_EQUALS(fromjson("{b: 1, a: 2}"), doc);
ASSERT_FALSE(doc.isInPlaceModeEnabled());
+ ASSERT_EQUALS(getModifiedPaths(), "{a}");
}
TEST_F(ArithmeticNodeTest, ApplyEmptyIndexData) {
@@ -639,6 +665,7 @@ TEST_F(ArithmeticNodeTest, ApplyEmptyIndexData) {
ASSERT_TRUE(doc.isInPlaceModeEnabled());
ASSERT_EQUALS(countChildren(getLogDoc().root()), 1u);
ASSERT_EQUALS(fromjson("{$set: {a: 3}}"), getLogDoc());
+ ASSERT_EQUALS(getModifiedPaths(), "{a}");
}
TEST_F(ArithmeticNodeTest, ApplyNoOpDottedPath) {
@@ -655,6 +682,7 @@ TEST_F(ArithmeticNodeTest, ApplyNoOpDottedPath) {
ASSERT_FALSE(result.indexesAffected);
ASSERT_EQUALS(fromjson("{a: {b : 2}}"), doc);
ASSERT_TRUE(doc.isInPlaceModeEnabled());
+ ASSERT_EQUALS(getModifiedPaths(), "{a.b}");
}
TEST_F(ArithmeticNodeTest, TypePromotionOnDottedPathIsNotANoOp) {
@@ -671,6 +699,7 @@ TEST_F(ArithmeticNodeTest, TypePromotionOnDottedPathIsNotANoOp) {
ASSERT_TRUE(result.indexesAffected);
ASSERT_EQUALS(fromjson("{a: {b : NumberLong(2)}}"), doc);
ASSERT_FALSE(doc.isInPlaceModeEnabled());
+ ASSERT_EQUALS(getModifiedPaths(), "{a.b}");
}
TEST_F(ArithmeticNodeTest, ApplyPathNotViableArray) {
@@ -702,6 +731,7 @@ TEST_F(ArithmeticNodeTest, ApplyInPlaceDottedPath) {
ASSERT_TRUE(result.indexesAffected);
ASSERT_EQUALS(fromjson("{a: {b: 3}}"), doc);
ASSERT_TRUE(doc.isInPlaceModeEnabled());
+ ASSERT_EQUALS(getModifiedPaths(), "{a.b}");
}
TEST_F(ArithmeticNodeTest, ApplyPromotionDottedPath) {
@@ -718,6 +748,7 @@ TEST_F(ArithmeticNodeTest, ApplyPromotionDottedPath) {
ASSERT_TRUE(result.indexesAffected);
ASSERT_EQUALS(fromjson("{a: {b: NumberLong(5)}}"), doc);
ASSERT_FALSE(doc.isInPlaceModeEnabled());
+ ASSERT_EQUALS(getModifiedPaths(), "{a.b}");
}
TEST_F(ArithmeticNodeTest, ApplyDottedPathEmptyDoc) {
@@ -734,6 +765,7 @@ TEST_F(ArithmeticNodeTest, ApplyDottedPathEmptyDoc) {
ASSERT_TRUE(result.indexesAffected);
ASSERT_EQUALS(fromjson("{a: {b: 2}}"), doc);
ASSERT_FALSE(doc.isInPlaceModeEnabled());
+ ASSERT_EQUALS(getModifiedPaths(), "{a.b}");
}
TEST_F(ArithmeticNodeTest, ApplyFieldWithDot) {
@@ -750,6 +782,7 @@ TEST_F(ArithmeticNodeTest, ApplyFieldWithDot) {
ASSERT_TRUE(result.indexesAffected);
ASSERT_EQUALS(fromjson("{'a.b':4, a: {b: 2}}"), doc);
ASSERT_FALSE(doc.isInPlaceModeEnabled());
+ ASSERT_EQUALS(getModifiedPaths(), "{a.b}");
}
TEST_F(ArithmeticNodeTest, ApplyNoOpArrayIndex) {
@@ -766,6 +799,7 @@ TEST_F(ArithmeticNodeTest, ApplyNoOpArrayIndex) {
ASSERT_FALSE(result.indexesAffected);
ASSERT_EQUALS(fromjson("{a: [{b: 0},{b: 1},{b: 2}]}"), doc);
ASSERT_TRUE(doc.isInPlaceModeEnabled());
+ ASSERT_EQUALS(getModifiedPaths(), "{a.2.b}");
}
TEST_F(ArithmeticNodeTest, TypePromotionInArrayIsNotANoOp) {
@@ -783,6 +817,7 @@ TEST_F(ArithmeticNodeTest, TypePromotionInArrayIsNotANoOp) {
ASSERT_TRUE(result.indexesAffected);
ASSERT_EQUALS(fromjson("{a: [{b: 0},{b: 1},{b: NumberLong(2)}]}"), doc);
ASSERT_FALSE(doc.isInPlaceModeEnabled());
+ ASSERT_EQUALS(getModifiedPaths(), "{a.2.b}");
}
TEST_F(ArithmeticNodeTest, ApplyNonViablePathThroughArray) {
@@ -814,6 +849,7 @@ TEST_F(ArithmeticNodeTest, ApplyInPlaceArrayIndex) {
ASSERT_TRUE(result.indexesAffected);
ASSERT_EQUALS(fromjson("{a: [{b: 0},{b: 1},{b: 3}]}"), doc);
ASSERT_TRUE(doc.isInPlaceModeEnabled());
+ ASSERT_EQUALS(getModifiedPaths(), "{a.2.b}");
}
TEST_F(ArithmeticNodeTest, ApplyAppendArray) {
@@ -831,6 +867,7 @@ TEST_F(ArithmeticNodeTest, ApplyAppendArray) {
ASSERT_TRUE(result.indexesAffected);
ASSERT_EQUALS(fromjson("{a: [{b: 0},{b: 1},{b: 2}]}"), doc);
ASSERT_FALSE(doc.isInPlaceModeEnabled());
+ ASSERT_EQUALS(getModifiedPaths(), "{a}");
}
TEST_F(ArithmeticNodeTest, ApplyPaddingArray) {
@@ -848,6 +885,7 @@ TEST_F(ArithmeticNodeTest, ApplyPaddingArray) {
ASSERT_TRUE(result.indexesAffected);
ASSERT_EQUALS(fromjson("{a: [{b: 0},null,{b: 2}]}"), doc);
ASSERT_FALSE(doc.isInPlaceModeEnabled());
+ ASSERT_EQUALS(getModifiedPaths(), "{a}");
}
TEST_F(ArithmeticNodeTest, ApplyNumericObject) {
@@ -865,6 +903,7 @@ TEST_F(ArithmeticNodeTest, ApplyNumericObject) {
ASSERT_TRUE(result.indexesAffected);
ASSERT_EQUALS(fromjson("{a: {b: 0, '2': {b: 2}}}"), doc);
ASSERT_FALSE(doc.isInPlaceModeEnabled());
+ ASSERT_EQUALS(getModifiedPaths(), "{a.2.b}");
}
TEST_F(ArithmeticNodeTest, ApplyNumericField) {
@@ -881,6 +920,7 @@ TEST_F(ArithmeticNodeTest, ApplyNumericField) {
ASSERT_TRUE(result.indexesAffected);
ASSERT_EQUALS(fromjson("{a: {'2': {b: 3}}}"), doc);
ASSERT_TRUE(doc.isInPlaceModeEnabled());
+ ASSERT_EQUALS(getModifiedPaths(), "{a.2.b}");
}
TEST_F(ArithmeticNodeTest, ApplyExtendNumericField) {
@@ -898,6 +938,7 @@ TEST_F(ArithmeticNodeTest, ApplyExtendNumericField) {
ASSERT_TRUE(result.indexesAffected);
ASSERT_EQUALS(fromjson("{a: {'2': {c: 1, b: 2}}}"), doc);
ASSERT_FALSE(doc.isInPlaceModeEnabled());
+ ASSERT_EQUALS(getModifiedPaths(), "{a.2.b}");
}
TEST_F(ArithmeticNodeTest, ApplyNumericFieldToEmptyObject) {
@@ -915,6 +956,7 @@ TEST_F(ArithmeticNodeTest, ApplyNumericFieldToEmptyObject) {
ASSERT_TRUE(result.indexesAffected);
ASSERT_EQUALS(fromjson("{a: {'2': {b: 2}}}"), doc);
ASSERT_FALSE(doc.isInPlaceModeEnabled());
+ ASSERT_EQUALS(getModifiedPaths(), "{a.2.b}");
}
TEST_F(ArithmeticNodeTest, ApplyEmptyArray) {
@@ -932,6 +974,7 @@ TEST_F(ArithmeticNodeTest, ApplyEmptyArray) {
ASSERT_TRUE(result.indexesAffected);
ASSERT_EQUALS(fromjson("{a: [null, null, {b: 2}]}"), doc);
ASSERT_FALSE(doc.isInPlaceModeEnabled());
+ ASSERT_EQUALS(getModifiedPaths(), "{a}");
}
TEST_F(ArithmeticNodeTest, ApplyLogDottedPath) {
@@ -948,6 +991,7 @@ TEST_F(ArithmeticNodeTest, ApplyLogDottedPath) {
ASSERT_FALSE(doc.isInPlaceModeEnabled());
ASSERT_EQUALS(countChildren(getLogDoc().root()), 1u);
ASSERT_EQUALS(fromjson("{$set: {'a.2.b': 2}}"), getLogDoc());
+ ASSERT_EQUALS(getModifiedPaths(), "{a}");
}
TEST_F(ArithmeticNodeTest, LogEmptyArray) {
@@ -964,6 +1008,7 @@ TEST_F(ArithmeticNodeTest, LogEmptyArray) {
ASSERT_FALSE(doc.isInPlaceModeEnabled());
ASSERT_EQUALS(countChildren(getLogDoc().root()), 1u);
ASSERT_EQUALS(fromjson("{$set: {'a.2.b': 2}}"), getLogDoc());
+ ASSERT_EQUALS(getModifiedPaths(), "{a}");
}
TEST_F(ArithmeticNodeTest, LogEmptyObject) {
@@ -980,6 +1025,7 @@ TEST_F(ArithmeticNodeTest, LogEmptyObject) {
ASSERT_FALSE(doc.isInPlaceModeEnabled());
ASSERT_EQUALS(countChildren(getLogDoc().root()), 1u);
ASSERT_EQUALS(fromjson("{$set: {'a.2.b': 2}}"), getLogDoc());
+ ASSERT_EQUALS(getModifiedPaths(), "{a.2.b}");
}
TEST_F(ArithmeticNodeTest, ApplyDeserializedDocNotNoOp) {
@@ -999,6 +1045,7 @@ TEST_F(ArithmeticNodeTest, ApplyDeserializedDocNotNoOp) {
ASSERT_EQUALS(fromjson("{a: 1, b: NumberInt(0)}"), doc);
ASSERT_FALSE(doc.isInPlaceModeEnabled());
ASSERT_EQUALS(fromjson("{$set: {b: NumberInt(0)}}"), getLogDoc());
+ ASSERT_EQUALS(getModifiedPaths(), "{b}");
}
TEST_F(ArithmeticNodeTest, ApplyToDeserializedDocNoOp) {
@@ -1018,6 +1065,7 @@ TEST_F(ArithmeticNodeTest, ApplyToDeserializedDocNoOp) {
ASSERT_EQUALS(fromjson("{a: NumberInt(2)}"), doc);
ASSERT_TRUE(doc.isInPlaceModeEnabled());
ASSERT_EQUALS(fromjson("{}"), getLogDoc());
+ ASSERT_EQUALS(getModifiedPaths(), "{a}");
}
TEST_F(ArithmeticNodeTest, ApplyToDeserializedDocNestedNoop) {
@@ -1037,6 +1085,7 @@ TEST_F(ArithmeticNodeTest, ApplyToDeserializedDocNestedNoop) {
ASSERT_EQUALS(fromjson("{a: {b: NumberInt(1)}}"), doc);
ASSERT_FALSE(doc.isInPlaceModeEnabled());
ASSERT_EQUALS(fromjson("{}"), getLogDoc());
+ ASSERT_EQUALS(getModifiedPaths(), "{a.b}");
}
TEST_F(ArithmeticNodeTest, ApplyToDeserializedDocNestedNotNoop) {
@@ -1056,6 +1105,7 @@ TEST_F(ArithmeticNodeTest, ApplyToDeserializedDocNestedNotNoop) {
ASSERT_EQUALS(fromjson("{a: {b: 3}}"), doc);
ASSERT_FALSE(doc.isInPlaceModeEnabled());
ASSERT_EQUALS(fromjson("{$set: {'a.b': 3}}"), getLogDoc());
+ ASSERT_EQUALS(getModifiedPaths(), "{a.b}");
}
} // namespace