summaryrefslogtreecommitdiff
path: root/src/mongo/db/ops/modifier_inc_test.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/ops/modifier_inc_test.cpp')
-rw-r--r--src/mongo/db/ops/modifier_inc_test.cpp30
1 files changed, 20 insertions, 10 deletions
diff --git a/src/mongo/db/ops/modifier_inc_test.cpp b/src/mongo/db/ops/modifier_inc_test.cpp
index 86e7a12a696..b5e76e8cfde 100644
--- a/src/mongo/db/ops/modifier_inc_test.cpp
+++ b/src/mongo/db/ops/modifier_inc_test.cpp
@@ -24,12 +24,14 @@
#include "mongo/bson/mutable/mutable_bson_test_utils.h"
#include "mongo/db/jsobj.h"
#include "mongo/db/json.h"
+#include "mongo/db/ops/log_builder.h"
#include "mongo/platform/cstdint.h"
#include "mongo/unittest/unittest.h"
namespace {
using mongo::BSONObj;
+ using mongo::LogBuilder;
using mongo::ModifierInc;
using mongo::ModifierInterface;
using mongo::NumberInt;
@@ -62,8 +64,8 @@ namespace {
return _mod.apply();
}
- Status log(Element logRoot) const {
- return _mod.log(logRoot);
+ Status log(LogBuilder* logBuilder) const {
+ return _mod.log(logBuilder);
}
ModifierInc& mod() { return _mod; }
@@ -153,7 +155,8 @@ namespace {
ASSERT_EQUALS(fromjson("{ a : 1 }"), doc);
Document logDoc;
- ASSERT_OK(incMod.log(logDoc.root()));
+ LogBuilder logBuilder(logDoc.root());
+ ASSERT_OK(incMod.log(&logBuilder));
ASSERT_EQUALS(fromjson("{ $set : { a : 1 } }"), logDoc);
}
@@ -167,7 +170,8 @@ namespace {
ASSERT_FALSE(execInfo.noOp);
Document logDoc;
- ASSERT_OK(incMod.log(logDoc.root()));
+ LogBuilder logBuilder(logDoc.root());
+ ASSERT_OK(incMod.log(&logBuilder));
ASSERT_EQUALS(fromjson("{ $set : { a : 1 } }"), logDoc);
}
@@ -184,7 +188,8 @@ namespace {
ASSERT_EQUALS(fromjson("{ a : 3 }"), doc);
Document logDoc;
- ASSERT_OK(incMod.log(logDoc.root()));
+ LogBuilder logBuilder(logDoc.root());
+ ASSERT_OK(incMod.log(&logBuilder));
ASSERT_EQUALS(fromjson("{ $set : { a : 3 } }"), logDoc);
}
@@ -201,7 +206,8 @@ namespace {
ASSERT_EQUALS(fromjson("{ a : { b : 3 } }"), doc);
Document logDoc;
- ASSERT_OK(incMod.log(logDoc.root()));
+ LogBuilder logBuilder(logDoc.root());
+ ASSERT_OK(incMod.log(&logBuilder));
ASSERT_EQUALS(fromjson("{ $set : { 'a.b' : 3 } }"), logDoc);
}
@@ -277,7 +283,8 @@ namespace {
ASSERT_EQUALS(mongo::NumberLong, doc.root()["a"].getType());
Document logDoc;
- ASSERT_OK(incMod.log(logDoc.root()));
+ LogBuilder logBuilder(logDoc.root());
+ ASSERT_OK(incMod.log(&logBuilder));
ASSERT_EQUALS(fromjson("{ $set : { a : 1 } }"), logDoc);
ASSERT_EQUALS(mongo::NumberLong, logDoc.root()["$set"]["a"].getType());
}
@@ -300,7 +307,8 @@ namespace {
ASSERT_EQUALS(mongo::NumberDouble, doc.root()["a"].getType());
Document logDoc;
- ASSERT_OK(incMod.log(logDoc.root()));
+ LogBuilder logBuilder(logDoc.root());
+ ASSERT_OK(incMod.log(&logBuilder));
ASSERT_EQUALS(fromjson("{ $set : { a : 1.0 } }"), logDoc);
ASSERT_EQUALS(mongo::NumberDouble, logDoc.root()["$set"]["a"].getType());
}
@@ -323,7 +331,8 @@ namespace {
ASSERT_EQUALS(mongo::NumberDouble, doc.root()["a"].getType());
Document logDoc;
- ASSERT_OK(incMod.log(logDoc.root()));
+ LogBuilder logBuilder(logDoc.root());
+ ASSERT_OK(incMod.log(&logBuilder));
ASSERT_EQUALS(fromjson("{ $set : { a : 1.0 } }"), logDoc);
ASSERT_EQUALS(mongo::NumberDouble, logDoc.root()["$set"]["a"].getType());
}
@@ -345,7 +354,8 @@ namespace {
ASSERT_EQUALS(mongo::NumberDouble, doc.root()["a"].getType());
Document logDoc;
- ASSERT_OK(incMod.log(logDoc.root()));
+ LogBuilder logBuilder(logDoc.root());
+ ASSERT_OK(incMod.log(&logBuilder));
ASSERT_EQUALS(fromjson("{ $set : { a : 2.0 } }"), logDoc);
ASSERT_EQUALS(mongo::NumberDouble, logDoc.root()["$set"]["a"].getType());
}