aboutsummaryrefslogtreecommitdiffstats
path: root/searchcore/src/tests/proton/document_iterator/document_iterator_test.cpp
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2022-03-07 08:14:04 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2022-03-07 08:14:04 +0000
commite658f2c3499901cf7e7750ca3d5be0e6e6953e8c (patch)
tree6b297ebd65ab7ea1c7970420982c0a3f6f9c2123 /searchcore/src/tests/proton/document_iterator/document_iterator_test.cpp
parent2e05df2de19c2d5b87befa2ee6c4fd182dcb5630 (diff)
GC redundant convenience wasy of assigning primitive field values.
Diffstat (limited to 'searchcore/src/tests/proton/document_iterator/document_iterator_test.cpp')
-rw-r--r--searchcore/src/tests/proton/document_iterator/document_iterator_test.cpp90
1 files changed, 45 insertions, 45 deletions
diff --git a/searchcore/src/tests/proton/document_iterator/document_iterator_test.cpp b/searchcore/src/tests/proton/document_iterator/document_iterator_test.cpp
index 82eac88a53e..cafdff1020f 100644
--- a/searchcore/src/tests/proton/document_iterator/document_iterator_test.cpp
+++ b/searchcore/src/tests/proton/document_iterator/document_iterator_test.cpp
@@ -338,8 +338,8 @@ const DocumentType &getAttrDocType() {
IDocumentRetriever::SP doc_with_fields(const std::string &id, Timestamp t, Bucket b) {
auto d = std::make_unique<Document>(getDocType(), DocumentId(id));
- d->set("header", "foo");
- d->set("body", "bar");
+ d->setValue("header", std::make_unique<StringFieldValue>("foo"));
+ d->setValue("body", std::make_unique<StringFieldValue>("bar"));
return std::make_shared<UnitDR>(getDocType(), std::move(d), t, b, false);
}
@@ -355,12 +355,12 @@ IDocumentRetriever::SP doc_with_attr_fields(const vespalib::string &id,
const vespalib::string &attr_ss)
{
auto d = std::make_unique<Document>(getAttrDocType(), DocumentId(id));
- d->set("header", "foo");
- d->set("body", "bar");
- d->set("aa", aa);
- d->set("ab", ab);
- d->set("dd", dd);
- d->set("ss", ss);
+ d->setValue("header", std::make_unique<StringFieldValue>("foo"));
+ d->setValue("body", std::make_unique<StringFieldValue>("bar"));
+ d->setValue("aa", std::make_unique<IntFieldValue>(aa));
+ d->setValue("ab", std::make_unique<IntFieldValue>(ab));
+ d->setValue("dd", std::make_unique<DoubleFieldValue>(dd));
+ d->setValue("ss", std::make_unique<StringFieldValue>(ss));
return std::make_shared<AttrUnitDR>(std::move(d), t, b, false, attr_aa, attr_dd, attr_ss);
}
@@ -782,7 +782,7 @@ TEST("require that fieldset limits fields returned") {
EXPECT_TRUE(res.isCompleted());
EXPECT_EQUAL(1u, res.getEntries().size());
Document expected(getDocType(), DocumentId("id:ns:foo::xxx1"));
- expected.set("header", "foo");
+ expected.setValue("header", std::make_unique<StringFieldValue>("foo"));
TEST_DO(checkEntry(res, 0, expected, Timestamp(1)));
}
@@ -838,19 +838,19 @@ TEST("require that attributes are used")
EXPECT_TRUE(res.isCompleted());
EXPECT_EQUAL(2u, res.getEntries().size());
Document expected1(getAttrDocType(), DocumentId("id:ns:foo::xx2"));
- expected1.set("header", "foo");
- expected1.set("body", "bar");
- expected1.set("aa", 27);
- expected1.set("ab", 28);
- expected1.set("dd", 2.7);
- expected1.set("ss", "x27");
+ expected1.setValue("header", std::make_unique<StringFieldValue>("foo"));
+ expected1.setValue("body", std::make_unique<StringFieldValue>("bar"));
+ expected1.setValue("aa", std::make_unique<IntFieldValue>(27));
+ expected1.setValue("ab", std::make_unique<IntFieldValue>(28));
+ expected1.setValue("dd", std::make_unique<DoubleFieldValue>(2.7));
+ expected1.setValue("ss", std::make_unique<StringFieldValue>("x27"));
Document expected2(getAttrDocType(), DocumentId("id:ns:foo::xx4"));
- expected2.set("header", "foo");
- expected2.set("body", "bar");
- expected2.set("aa", 45);
- expected2.set("ab", 46);
- expected2.set("dd", 4.5);
- expected2.set("ss", "x45");
+ expected2.setValue("header", std::make_unique<StringFieldValue>("foo"));
+ expected2.setValue("body", std::make_unique<StringFieldValue>("bar"));
+ expected2.setValue("aa", std::make_unique<IntFieldValue>(45));
+ expected2.setValue("ab", std::make_unique<IntFieldValue>(46));
+ expected2.setValue("dd", std::make_unique<DoubleFieldValue>(4.5));
+ expected2.setValue("ss", std::make_unique<StringFieldValue>("x45"));
TEST_DO(checkEntry(res, 0, expected1, Timestamp(2)));
TEST_DO(checkEntry(res, 1, expected2, Timestamp(4)));
@@ -868,19 +868,19 @@ TEST("require that attributes are used")
EXPECT_TRUE(res2.isCompleted());
EXPECT_EQUAL(2u, res2.getEntries().size());
Document expected3(getAttrDocType(), DocumentId("id:ns:foo::xx6"));
- expected3.set("header", "foo");
- expected3.set("body", "bar");
- expected3.set("aa", 27);
- expected3.set("ab", 28);
- expected3.set("dd", 2.7);
- expected3.set("ss", "x27");
+ expected3.setValue("header", std::make_unique<StringFieldValue>("foo"));
+ expected3.setValue("body", std::make_unique<StringFieldValue>("bar"));
+ expected3.setValue("aa", std::make_unique<IntFieldValue>(27));
+ expected3.setValue("ab", std::make_unique<IntFieldValue>(28));
+ expected3.setValue("dd", std::make_unique<DoubleFieldValue>(2.7));
+ expected3.setValue("ss", std::make_unique<StringFieldValue>("x27"));
Document expected4(getAttrDocType(), DocumentId("id:ns:foo::xx8"));
- expected4.set("header", "foo");
- expected4.set("body", "bar");
- expected4.set("aa", 45);
- expected4.set("ab", 46);
- expected4.set("dd", 4.5);
- expected4.set("ss", "x45");
+ expected4.setValue("header", std::make_unique<StringFieldValue>("foo"));
+ expected4.setValue("body", std::make_unique<StringFieldValue>("bar"));
+ expected4.setValue("aa", std::make_unique<IntFieldValue>(45));
+ expected4.setValue("ab", std::make_unique<IntFieldValue>(46));
+ expected4.setValue("dd", std::make_unique<DoubleFieldValue>(4.5));
+ expected4.setValue("ss", std::make_unique<StringFieldValue>("x45"));
TEST_DO(checkEntry(res2, 0, expected3, Timestamp(6)));
TEST_DO(checkEntry(res2, 1, expected4, Timestamp(8)));
@@ -898,19 +898,19 @@ TEST("require that attributes are used")
EXPECT_TRUE(res3.isCompleted());
EXPECT_EQUAL(2u, res3.getEntries().size());
Document expected5(getAttrDocType(), DocumentId("id:ns:foo::xx10"));
- expected5.set("header", "foo");
- expected5.set("body", "bar");
- expected5.set("aa", 27);
- expected5.set("ab", 28);
- expected5.set("dd", 2.7);
- expected5.set("ss", "x27");
+ expected5.setValue("header", std::make_unique<StringFieldValue>("foo"));
+ expected5.setValue("body", std::make_unique<StringFieldValue>("bar"));
+ expected5.setValue("aa", std::make_unique<IntFieldValue>(27));
+ expected5.setValue("ab", std::make_unique<IntFieldValue>(28));
+ expected5.setValue("dd", std::make_unique<DoubleFieldValue>(2.7));
+ expected5.setValue("ss", std::make_unique<StringFieldValue>("x27"));
Document expected6(getAttrDocType(), DocumentId("id:ns:foo::xx12"));
- expected6.set("header", "foo");
- expected6.set("body", "bar");
- expected6.set("aa", 45);
- expected6.set("ab", 46);
- expected6.set("dd", 4.5);
- expected6.set("ss", "x45");
+ expected6.setValue("header", std::make_unique<StringFieldValue>("foo"));
+ expected6.setValue("body", std::make_unique<StringFieldValue>("bar"));
+ expected6.setValue("aa", std::make_unique<IntFieldValue>(45));
+ expected6.setValue("ab", std::make_unique<IntFieldValue>(46));
+ expected6.setValue("dd", std::make_unique<DoubleFieldValue>(4.5));
+ expected6.setValue("ss", std::make_unique<StringFieldValue>("x45"));
TEST_DO(checkEntry(res3, 0, expected5, Timestamp(10)));
TEST_DO(checkEntry(res3, 1, expected6, Timestamp(12)));
}