TEST(CollectionOptions, SimpleRoundTrip) { CollectionOptions options; checkRoundTrip(options); options.capped = true; options.cappedSize = 10240; options.cappedMaxDocs = 1111; checkRoundTrip(options); options.setNoIdIndex(); checkRoundTrip(options); }
TEST(CollectionOptions, ParseEngineField) { CollectionOptions opts; ASSERT_OK(opts.parse(fromjson( "{unknownField: 1, " "storageEngine: {storageEngine1: {x: 1, y: 2}, storageEngine2: {a: 1, b:2}}}"))); checkRoundTrip(opts); // Unrecognized field should not be present in BSON representation. BSONObj obj = opts.toBSON(); ASSERT_FALSE(obj.hasField("unknownField")); // Check "storageEngine" field. ASSERT_TRUE(obj.hasField("storageEngine")); ASSERT_TRUE(obj.getField("storageEngine").isABSONObj()); BSONObj storageEngine = obj.getObjectField("storageEngine"); // Check individual storage storageEngine fields. ASSERT_TRUE(storageEngine.getField("storageEngine1").isABSONObj()); BSONObj storageEngine1 = storageEngine.getObjectField("storageEngine1"); ASSERT_EQUALS(1, storageEngine1.getIntField("x")); ASSERT_EQUALS(2, storageEngine1.getIntField("y")); ASSERT_TRUE(storageEngine.getField("storageEngine2").isABSONObj()); BSONObj storageEngine2 = storageEngine.getObjectField("storageEngine2"); ASSERT_EQUALS(1, storageEngine2.getIntField("a")); ASSERT_EQUALS(2, storageEngine2.getIntField("b")); }
TEST(CollectionOptions, ResetStorageEngineField) { CollectionOptions opts; ASSERT_OK(opts.parse(fromjson("{storageEngine: {storageEngine1: {x: 1}}}"))); checkRoundTrip(opts); CollectionOptions defaultOpts; ASSERT_TRUE(defaultOpts.storageEngine.isEmpty()); }
void SDTestObject::test<5>() // conversion of String to and from UUID, Date and URI. { SDCleanupCheck check; LLSD v; LLUUID nullUUID; LLUUID someUUID; someUUID.generate(); v = nullUUID; checkRoundTrip("null uuid", v, "00000000-0000-0000-0000-000000000000", nullUUID); v = someUUID; checkRoundTrip("random uuid", v, 0, someUUID); LLDate epoch; LLDate beta("2003-04-30T04:00:00Z"); LLDate oneOh("2003-06-23T04:00:00Z"); v = epoch; checkRoundTrip("epoch date", v, 0, epoch); v = beta; checkRoundTrip("beta date", v, "2003-04-30T04:00:00Z", beta); v = oneOh; checkRoundTrip("1.0 date", v, "2003-06-23T04:00:00Z", oneOh); LLURI empty; LLURI path("http://slurl.com/secondlife/Ambleside/57/104/26/"); LLURI mail("mailto:[email protected]"); v = empty; checkRoundTrip("empty URI", v, 0, empty); v = path; checkRoundTrip("path URI", v, "http://slurl.com/secondlife/Ambleside/57/104/26/", path); v = mail; checkRoundTrip("mail URI", v, "mailto:[email protected]", mail); }