Skip to content

Commit

Permalink
SERVER-939 Added defaults to fields to fix field_parser test
Browse files Browse the repository at this point in the history
  • Loading branch information
sverch committed Jan 17, 2013
1 parent 058b24e commit 5205372
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/mongo/s/field_parser_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ namespace {
BSONField<long long> ExtractionFixture::aLong("aLong");

TEST_F(ExtractionFixture, GetBool) {
BSONField<bool> notThere("otherBool");
BSONField<bool> notThere("otherBool", true);
BSONField<bool> wrongType(anObj.name());
bool val;
ASSERT_TRUE(FieldParser::extract(doc, aBool, false, &val));
Expand All @@ -99,7 +99,7 @@ namespace {
}

TEST_F(ExtractionFixture, GetBSONArray) {
BSONField<BSONArray> notThere("otherArray");
BSONField<BSONArray> notThere("otherArray", BSON_ARRAY("a" << "b"));
BSONField<BSONArray> wrongType(aString.name());
BSONArray val;
ASSERT_TRUE(FieldParser::extract(doc, anArray, BSONArray(), &val));
Expand All @@ -110,7 +110,7 @@ namespace {
}

TEST_F(ExtractionFixture, GetBSONObj) {
BSONField<BSONObj> notThere("otherObj");
BSONField<BSONObj> notThere("otherObj", BSON("b" << 1));
BSONField<BSONObj> wrongType(aString.name());
BSONObj val;
ASSERT_TRUE(FieldParser::extract(doc, anObj, BSONObj(), &val));
Expand All @@ -121,7 +121,7 @@ namespace {
}

TEST_F(ExtractionFixture, GetDate) {
BSONField<Date_t> notThere("otherDate");
BSONField<Date_t> notThere("otherDate", 99ULL);
BSONField<Date_t> wrongType(aString.name());
Date_t val;
ASSERT_TRUE(FieldParser::extract(doc, aDate, time(0), &val));
Expand All @@ -132,7 +132,7 @@ namespace {
}

TEST_F(ExtractionFixture, GetString) {
BSONField<string> notThere("otherString");
BSONField<string> notThere("otherString", "abc");
BSONField<string> wrongType(aBool.name());
string val;
ASSERT_TRUE(FieldParser::extract(doc, aString, "", &val));
Expand All @@ -143,9 +143,9 @@ namespace {
}

TEST_F(ExtractionFixture, GetOID) {
BSONField<OID> notThere("otherOID");
BSONField<OID> wrongType(aString.name());
OID defOID = OID::gen();
BSONField<OID> notThere("otherOID", defOID);
BSONField<OID> wrongType(aString.name());
OID val;
ASSERT_TRUE(FieldParser::extract(doc, anOID, OID(), &val));
ASSERT_EQUALS(val, valOID);
Expand All @@ -155,7 +155,7 @@ namespace {
}

TEST_F(ExtractionFixture, GetLong) {
BSONField<long long> notThere("otherLong");
BSONField<long long> notThere("otherLong", 0);
BSONField<long long> wrongType(aString.name());
long long val;
ASSERT_TRUE(FieldParser::extract(doc, aLong, 0, &val));
Expand Down

0 comments on commit 5205372

Please sign in to comment.