summaryrefslogtreecommitdiffstats
path: root/document
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2022-04-19 14:11:08 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2022-04-19 14:11:08 +0000
commit8e1933cef234f0ad58ba09de24ec6d399bf6580a (patch)
tree44c4ce048bef83e9e355b598f3d5bf5a775acbab /document
parentd89395263f2bff208c76b8fc5a9d72cfe49f2ed7 (diff)
GC void test code.
Diffstat (limited to 'document')
-rw-r--r--document/src/tests/fieldpathupdatetestcase.cpp124
1 files changed, 0 insertions, 124 deletions
diff --git a/document/src/tests/fieldpathupdatetestcase.cpp b/document/src/tests/fieldpathupdatetestcase.cpp
index 0e6cf3a7c7e..89a95c1d62f 100644
--- a/document/src/tests/fieldpathupdatetestcase.cpp
+++ b/document/src/tests/fieldpathupdatetestcase.cpp
@@ -131,130 +131,6 @@ FieldPathUpdateTestCase::TearDown()
{
}
-#if 0 // TODO Need to figure out different way of testing this
- DocumenttypesConfig getRepoConfig() {
- const int struct2_id = 64;
- DocumenttypesConfigBuilderHelper builder;
- builder.document(
- 42, "test",
- Struct("test.header")
- .addField("primitive1", DataType::T_INT)
- .addField("l1s1", Struct("struct3")
- .addField("primitive1", DataType::T_INT)
- .addField("ss", Struct("struct2")
- .setId(struct2_id)
- .addField("primitive1", DataType::T_INT)
- .addField("primitive2", DataType::T_INT)
- .addField("iarray", Array(DataType::T_INT))
- .addField("sarray", Array(
- Struct("struct1")
- .addField("primitive1",
- DataType::T_INT)
- .addField("primitive2",
- DataType::T_INT)))
- .addField("smap", Map(DataType::T_STRING,
- DataType::T_STRING)))
- .addField("structmap",
- Map(DataType::T_STRING, struct2_id))
- .addField("wset", Wset(DataType::T_STRING))
- .addField("structwset", Wset(struct2_id))),
- Struct("test.body"));
- return builder.config();
-}
-
-Document::UP
-createTestDocument(const DocumentTypeRepo &repo)
-{
- const DocumentType* type(repo.getDocumentType("test"));
- const DataType* struct3(repo.getDataType(*type, "struct3"));
- const DataType* struct2(repo.getDataType(*type, "struct2"));
- const DataType* iarr(repo.getDataType(*type, "Array<Int>"));
- const DataType* sarr(repo.getDataType(*type, "Array<struct1>"));
- const DataType* struct1(repo.getDataType(*type, "struct1"));
- const DataType* smap(repo.getDataType(*type, "Map<String,String>"));
- const DataType* structmap(repo.getDataType(*type, "Map<String,struct2>"));
- const DataType* wset(repo.getDataType(*type, "WeightedSet<String>"));
- const DataType* structwset(repo.getDataType(*type, "WeightedSet<struct2>"));
- Document::UP doc(new Document(*type, DocumentId("id:ns:test::1")));
- doc->setRepo(repo);
- doc->setValue("primitive1", IntFieldValue(1));
- StructFieldValue l1s1(*struct3);
- l1s1.setValue("primitive1", IntFieldValue(2));
-
- StructFieldValue l2s1(*struct2);
- l2s1.setValue("primitive1", IntFieldValue(3));
- l2s1.setValue("primitive2", IntFieldValue(4));
- StructFieldValue l2s2(*struct2);
- l2s2.setValue("primitive1", IntFieldValue(5));
- l2s2.setValue("primitive2", IntFieldValue(6));
- ArrayFieldValue iarr1(*iarr);
- iarr1.add(IntFieldValue(11));
- iarr1.add(IntFieldValue(12));
- iarr1.add(IntFieldValue(13));
- ArrayFieldValue sarr1(*sarr);
- StructFieldValue l3s1(*struct1);
- l3s1.setValue("primitive1", IntFieldValue(1));
- l3s1.setValue("primitive2", IntFieldValue(2));
- sarr1.add(l3s1);
- sarr1.add(l3s1);
- MapFieldValue smap1(*smap);
- smap1.put(StringFieldValue("leonardo"), StringFieldValue("dicaprio"));
- smap1.put(StringFieldValue("ellen"), StringFieldValue("page"));
- smap1.put(StringFieldValue("joseph"), StringFieldValue("gordon-levitt"));
- l2s1.setValue("smap", smap1);
- l2s1.setValue("iarray", iarr1);
- l2s1.setValue("sarray", sarr1);
-
- l1s1.setValue("ss", l2s1);
- MapFieldValue structmap1(*structmap);
- structmap1.put(StringFieldValue("test"), l2s1);
- l1s1.setValue("structmap", structmap1);
-
- WeightedSetFieldValue wwset1(*wset);
- WSetHelper wset1(wwset1);
- wset1.add("foo");
- wset1.add("bar");
- wset1.add("zoo");
- l1s1.setValue("wset", wwset1);
-
- WeightedSetFieldValue wset2(*structwset);
- wset2.add(l2s1);
- wset2.add(l2s2);
- l1s1.setValue("structwset", wset2);
-
- doc->setValue("l1s1", l1s1);
- return doc;
-}
-
-TEST_F(FieldPathUpdateTestCase, testWhereClause)
-{
- DocumentTypeRepo repo(getRepoConfig());
- Document::UP doc(createTestDocument(repo));
- std::string where = "test.l1s1.structmap.value.smap{$x} == \"dicaprio\"";
- TestFieldPathUpdate update("l1s1.structmap.value.smap{$x}", where);
- update.applyTo(*doc);
- EXPECT_EQ(std::string("dicaprio"), update._str);
-}
-
-TEST_F(FieldPathUpdateTestCase, testBrokenWhereClause)
-{
- DocumentTypeRepo repo(getRepoConfig());
- Document::UP doc(createTestDocument(repo));
- std::string where = "l1s1.structmap.value.smap{$x} == \"dicaprio\"";
- TestFieldPathUpdate update("l1s1.structmap.value.smap{$x}", where);
- update.applyTo(*doc);
- EXPECT_EQ(std::string(""), update._str);
-}
-
-TEST_F(FieldPathUpdateTestCase, testNoIterateMapValues)
-{
- DocumentTypeRepo repo(getRepoConfig());
- Document::UP doc(createTestDocument(repo));
- TestFieldPathUpdate update("l1s1.structwset.primitive1", "true");
- update.applyTo(*doc);
- EXPECT_EQ(std::string("3;5"), update._str);
-}
-#endif
TEST_F(FieldPathUpdateTestCase, testRemoveField)
{
auto doc = std::make_unique<Document>(*_foobar_type, DocumentId("id:ns:foobar::things:thangs"));