summaryrefslogtreecommitdiff
path: root/src/mongo/dbtests/jsobjtests.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/dbtests/jsobjtests.cpp')
-rw-r--r--src/mongo/dbtests/jsobjtests.cpp36
1 files changed, 18 insertions, 18 deletions
diff --git a/src/mongo/dbtests/jsobjtests.cpp b/src/mongo/dbtests/jsobjtests.cpp
index 0c20c6f0f9b..16baa542c18 100644
--- a/src/mongo/dbtests/jsobjtests.cpp
+++ b/src/mongo/dbtests/jsobjtests.cpp
@@ -179,13 +179,13 @@ public:
void run() {
{
BufBuilder b(0);
- b.appendStr("foo");
+ b.appendCStr("foo");
ASSERT_EQUALS(4, b.len());
ASSERT(strcmp("foo", b.buf()) == 0);
}
{
mongo::StackBufBuilder b;
- b.appendStr("foo");
+ b.appendCStr("foo");
ASSERT_EQUALS(4, b.len());
ASSERT(strcmp("foo", b.buf()) == 0);
}
@@ -200,7 +200,7 @@ public:
try {
for (; written <= 64 * 1024 * 1024 + 1; ++written)
// (re)alloc past the buffer 64mb limit
- b.appendStr("a");
+ b.appendCStr("a");
} catch (const AssertionException&) {
}
// assert half of max buffer size was allocated before exception is thrown
@@ -505,7 +505,7 @@ public:
bb << "a" << 1;
BSONObj tmp = bb.asTempObj();
ASSERT(tmp.objsize() == 4 + (1 + 2 + 4) + 1);
- ASSERT(tmp.valid());
+ ASSERT_OK(mongo::validateBSON(tmp));
ASSERT(tmp.hasField("a"));
ASSERT(!tmp.hasField("b"));
ASSERT_BSONOBJ_EQ(tmp, BSON("a" << 1));
@@ -513,7 +513,7 @@ public:
bb << "b" << 2;
BSONObj obj = bb.obj();
ASSERT_EQUALS(obj.objsize(), 4 + (1 + 2 + 4) + (1 + 2 + 4) + 1);
- ASSERT(obj.valid());
+ ASSERT_OK(mongo::validateBSON(obj));
ASSERT(obj.hasField("a"));
ASSERT(obj.hasField("b"));
ASSERT_BSONOBJ_EQ(obj, BSON("a" << 1 << "b" << 2));
@@ -523,7 +523,7 @@ public:
bb << "a" << GT << 1;
BSONObj tmp = bb.asTempObj();
ASSERT(tmp.objsize() == 4 + (1 + 2 + (4 + 1 + 4 + 4 + 1)) + 1);
- ASSERT(tmp.valid());
+ ASSERT_OK(mongo::validateBSON(tmp));
ASSERT(tmp.hasField("a"));
ASSERT(!tmp.hasField("b"));
ASSERT_BSONOBJ_EQ(tmp, BSON("a" << BSON("$gt" << 1)));
@@ -532,7 +532,7 @@ public:
BSONObj obj = bb.obj();
ASSERT(obj.objsize() ==
4 + (1 + 2 + (4 + 1 + 4 + 4 + 1)) + (1 + 2 + (4 + 1 + 4 + 4 + 1)) + 1);
- ASSERT(obj.valid());
+ ASSERT_OK(mongo::validateBSON(obj));
ASSERT(obj.hasField("a"));
ASSERT(obj.hasField("b"));
ASSERT_BSONOBJ_EQ(obj, BSON("a" << BSON("$gt" << 1) << "b" << BSON("$lt" << 2)));
@@ -542,7 +542,7 @@ public:
bb << "a" << 1;
BSONObj tmp = bb.asTempObj();
ASSERT(tmp.objsize() == 4 + (1 + 2 + 4) + 1);
- ASSERT(tmp.valid());
+ ASSERT_OK(mongo::validateBSON(tmp));
ASSERT(tmp.hasField("a"));
ASSERT(!tmp.hasField("b"));
ASSERT_BSONOBJ_EQ(tmp, BSON("a" << 1));
@@ -554,7 +554,7 @@ public:
}
bb << "b" << arr.arr();
BSONObj obj = bb.obj();
- ASSERT(obj.valid());
+ ASSERT_OK(mongo::validateBSON(obj));
ASSERT(obj.hasField("a"));
ASSERT(obj.hasField("b"));
}
@@ -756,8 +756,8 @@ class Base {
public:
virtual ~Base() {}
void run() {
- ASSERT(valid().valid());
- ASSERT(!invalid().valid());
+ ASSERT_OK(mongo::validateBSON(valid()));
+ ASSERT(!mongo::validateBSON(invalid()).isOK());
}
protected:
@@ -806,7 +806,7 @@ public:
b.appendNull("a");
BSONObj o = b.done();
set(o, 4, mongo::Undefined);
- ASSERT(o.valid());
+ ASSERT_OK(mongo::validateBSON(o));
}
};
@@ -990,7 +990,7 @@ public:
void run() {
const char data[] = {0x07, 0x00, 0x00, 0x00, char(type_), 'a', 0x00};
BSONObj o(data);
- ASSERT(!o.valid());
+ ASSERT(!mongo::validateBSON(o).isOK());
}
private:
@@ -1329,7 +1329,7 @@ public:
b2.done();
b1.append("f", 10.0);
BSONObj ret = b1.done();
- ASSERT(ret.valid());
+ ASSERT_OK(mongo::validateBSON(ret));
ASSERT(ret.woCompare(fromjson("{a:'bcd',foo:{ggg:44},f:10}")) == 0);
}
};
@@ -1350,7 +1350,7 @@ public:
BSONObj o = BSON("now" << DATENOW);
Date_t after = jsTime();
- ASSERT(o.valid());
+ ASSERT_OK(mongo::validateBSON(o));
BSONElement e = o["now"];
ASSERT(e.type() == Date);
@@ -1368,7 +1368,7 @@ public:
b.appendTimeT("now", aTime);
BSONObj o = b.obj();
- ASSERT(o.valid());
+ ASSERT_OK(mongo::validateBSON(o));
BSONElement e = o["now"];
ASSERT_EQUALS(Date, e.type());
@@ -1382,8 +1382,8 @@ public:
BSONObj min = BSON("a" << MINKEY);
BSONObj max = BSON("b" << MAXKEY);
- ASSERT(min.valid());
- ASSERT(max.valid());
+ ASSERT_OK(mongo::validateBSON(min));
+ ASSERT_OK(mongo::validateBSON(max));
BSONElement minElement = min["a"];
BSONElement maxElement = max["b"];