aboutsummaryrefslogtreecommitdiffstats
path: root/document/src/tests/fieldsettest.cpp
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2020-08-07 17:23:06 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2020-08-07 17:23:06 +0000
commit3fa3912a3af1d75751425bf11eae1b4e3940a8c7 (patch)
tree29ebb03b74f25a672438f45e9159f4e0fc96bc4b /document/src/tests/fieldsettest.cpp
parentcab80fdeb028a82403eaf13a99b31a5b6483712e (diff)
Make FieldCollection immutable.
Diffstat (limited to 'document/src/tests/fieldsettest.cpp')
-rw-r--r--document/src/tests/fieldsettest.cpp27
1 files changed, 8 insertions, 19 deletions
diff --git a/document/src/tests/fieldsettest.cpp b/document/src/tests/fieldsettest.cpp
index 5f2caddcdb1..37c55385c0f 100644
--- a/document/src/tests/fieldsettest.cpp
+++ b/document/src/tests/fieldsettest.cpp
@@ -289,25 +289,14 @@ TEST(FieldCollectionTest, testHash ) {
TestDocMan testDocMan;
const DocumentTypeRepo& repo = testDocMan.getTypeRepo();
const DocumentType & type = *repo.getDocumentType("testdoctype1");
- FieldCollection fc(type);
- EXPECT_EQ(0ul, fc.hash());
- fc.insertField(type.getField("headerval"));
- EXPECT_EQ(0ul, fc.hash());
- fc.complete();
- EXPECT_EQ(0x548599858c77ef83ul, fc.hash());
- fc.insertField(type.getField("hstringval")).complete();
- EXPECT_EQ(0x4a7ff2406d36a9b0ul, fc.hash());
- fc.insertField(type.getField("headerval")).complete();
- EXPECT_EQ(0x4a7ff2406d36a9b0ul, fc.hash());
-
- FieldCollection fc2(type);
- EXPECT_EQ(0ul, fc2.hash());
- fc2.insertField(type.getField("hstringval")).complete();
- EXPECT_EQ(0x1e0918531b19734ul, fc2.hash());
- fc2.insertField(type.getField("headerval")).complete();
- EXPECT_EQ(fc.hash(), fc2.hash());
- fc2.insertField(type.getField("headerval")).complete();
- EXPECT_EQ(fc.hash(), fc2.hash());
+ Field::Set set;
+ EXPECT_EQ(0ul, FieldCollection(type, set).hash());
+ set.insert(&type.getField("headerval"));
+ EXPECT_EQ(0x548599858c77ef83ul, FieldCollection(type, set).hash());
+ set.insert(&type.getField("hstringval"));
+ EXPECT_EQ(0x4a7ff2406d36a9b0ul, FieldCollection(type, set).hash());
+ set.erase(&type.getField("headerval"));
+ EXPECT_EQ(0x1e0918531b19734ul, FieldCollection(type, set).hash());
}
} // document