diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2017-03-09 00:21:14 +0100 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2017-03-09 00:21:14 +0100 |
commit | 94eea5f229b0a4034676002a423b226185a10820 (patch) | |
tree | fddc26a218c233f7b3b509525370d0f6d7ef17c8 /document | |
parent | 68c336f802bba1974186c085ee7725a12980e244 (diff) |
deiniline destructors
Diffstat (limited to 'document')
-rw-r--r-- | document/src/tests/documenttestcase.cpp | 35 | ||||
-rw-r--r-- | document/src/tests/documentupdatetestcase.cpp | 49 | ||||
-rw-r--r-- | document/src/tests/fieldpathupdatetestcase.cpp | 79 | ||||
-rw-r--r-- | document/src/tests/gid_filter_test.cpp | 15 |
4 files changed, 106 insertions, 72 deletions
diff --git a/document/src/tests/documenttestcase.cpp b/document/src/tests/documenttestcase.cpp index 29ccefc1d86..25c7fa2ac57 100644 --- a/document/src/tests/documenttestcase.cpp +++ b/document/src/tests/documenttestcase.cpp @@ -104,20 +104,26 @@ void DocumentTest::testFieldPath() } } +class Handler : public FieldValue::IteratorHandler { +public: + Handler(); + ~Handler(); + const std::string & getResult() const { return _result; } +private: + virtual void onPrimitive(const Content&) { _result += 'P'; } + virtual void onCollectionStart(const Content&) { _result += '['; } + virtual void onCollectionEnd(const Content&) { _result += ']'; } + virtual void onStructStart(const Content&) { _result += '<'; } + virtual void onStructEnd(const Content&) { _result += '>'; } + std::string _result; +}; + +Handler::Handler() { } +Handler::~Handler() { } + + void DocumentTest::testTraversing() { - class Handler : public FieldValue::IteratorHandler { - public: - const std::string & getResult() const { return _result; } - private: - virtual void onPrimitive(const Content&) { _result += 'P'; } - virtual void onCollectionStart(const Content&) { _result += '['; } - virtual void onCollectionEnd(const Content&) { _result += ']'; } - virtual void onStructStart(const Content&) { _result += '<'; } - virtual void onStructEnd(const Content&) { _result += '>'; } - std::string _result; - }; - Field primitive1("primitive1", 1, *DataType::INT, true); Field primitive2("primitive2", 2, *DataType::INT, true); StructDataType struct1("struct1"); @@ -180,6 +186,8 @@ void DocumentTest::testTraversing() class VariableIteratorHandler : public FieldValue::IteratorHandler { public: + VariableIteratorHandler(); + ~VariableIteratorHandler(); std::string retVal; virtual void onPrimitive(const Content & fv) { @@ -190,6 +198,9 @@ public: }; }; +VariableIteratorHandler::VariableIteratorHandler() {} +VariableIteratorHandler::~VariableIteratorHandler() {} + void DocumentTest::testVariables() { diff --git a/document/src/tests/documentupdatetestcase.cpp b/document/src/tests/documentupdatetestcase.cpp index 6ed36527734..f0784bf2ba7 100644 --- a/document/src/tests/documentupdatetestcase.cpp +++ b/document/src/tests/documentupdatetestcase.cpp @@ -488,17 +488,8 @@ struct WeightedSetAutoCreateFixture const Field& field; DocumentUpdate update; - WeightedSetAutoCreateFixture() - : repo(makeConfig()), - docType(repo.getDocumentType("test")), - doc(*docType, DocumentId("doc::testdoc")), - field(docType->getField("strwset")), - update(*docType, DocumentId("doc::testdoc")) - { - update.addUpdate(FieldUpdate(field) - .addUpdate(MapValueUpdate(StringFieldValue("foo"), - ArithmeticValueUpdate(ArithmeticValueUpdate::Add, 1)))); - } + ~WeightedSetAutoCreateFixture(); + WeightedSetAutoCreateFixture(); void applyUpdateToDocument() { update.applyTo(doc); @@ -518,6 +509,18 @@ struct WeightedSetAutoCreateFixture } }; +WeightedSetAutoCreateFixture::~WeightedSetAutoCreateFixture() {} +WeightedSetAutoCreateFixture::WeightedSetAutoCreateFixture() + : repo(makeConfig()), + docType(repo.getDocumentType("test")), + doc(*docType, DocumentId("doc::testdoc")), + field(docType->getField("strwset")), + update(*docType, DocumentId("doc::testdoc")) +{ + update.addUpdate(FieldUpdate(field) + .addUpdate(MapValueUpdate(StringFieldValue("foo"), + ArithmeticValueUpdate(ArithmeticValueUpdate::Add, 1)))); +} } // anon ns void @@ -1048,18 +1051,22 @@ struct CreateIfNonExistentFixture TestDocMan docMan; Document::UP document; DocumentUpdate::UP update; - CreateIfNonExistentFixture() - : docMan(), - document(docMan.createDocument()), - update(new DocumentUpdate(*document->getDataType(), - document->getId())) - { - update->addUpdate(FieldUpdate(document->getField("headerval")) - .addUpdate(AssignValueUpdate(IntFieldValue(1)))); - update->setCreateIfNonExistent(true); - } + ~CreateIfNonExistentFixture(); + CreateIfNonExistentFixture(); }; +CreateIfNonExistentFixture::~CreateIfNonExistentFixture() {} +CreateIfNonExistentFixture::CreateIfNonExistentFixture() + : docMan(), + document(docMan.createDocument()), + update(new DocumentUpdate(*document->getDataType(), + document->getId())) +{ + update->addUpdate(FieldUpdate(document->getField("headerval")) + .addUpdate(AssignValueUpdate(IntFieldValue(1)))); + update->setCreateIfNonExistent(true); +} + void DocumentUpdateTest::testThatCreateIfNonExistentFlagIsSerialized50AndDeserialized50() { diff --git a/document/src/tests/fieldpathupdatetestcase.cpp b/document/src/tests/fieldpathupdatetestcase.cpp index 3f14629f1e1..991c1d6b908 100644 --- a/document/src/tests/fieldpathupdatetestcase.cpp +++ b/document/src/tests/fieldpathupdatetestcase.cpp @@ -282,18 +282,11 @@ struct TestFieldPathUpdate : FieldPathUpdate mutable std::string _str; - TestFieldPathUpdate(const DocumentTypeRepo& repo, - const DataType *type, - const std::string& fieldPath, - const std::string& whereClause) - : FieldPathUpdate(repo, *type, fieldPath, whereClause) - { - } + ~TestFieldPathUpdate(); + TestFieldPathUpdate(const DocumentTypeRepo& repo, const DataType *type, + const std::string& fieldPath, const std::string& whereClause); - TestFieldPathUpdate(const TestFieldPathUpdate& other) - : FieldPathUpdate(other) - { - } + TestFieldPathUpdate(const TestFieldPathUpdate& other); std::unique_ptr<FieldValue::IteratorHandler> getIteratorHandler(Document&) const { @@ -312,6 +305,18 @@ struct TestFieldPathUpdate : FieldPathUpdate uint8_t getSerializedType() const override { assert(false); return 7; } }; +TestFieldPathUpdate::~TestFieldPathUpdate() { } +TestFieldPathUpdate::TestFieldPathUpdate(const DocumentTypeRepo& repo, const DataType *type, + const std::string& fieldPath, const std::string& whereClause) + : FieldPathUpdate(repo, *type, fieldPath, whereClause) +{ +} + +TestFieldPathUpdate::TestFieldPathUpdate(const TestFieldPathUpdate& other) + : FieldPathUpdate(other) +{ +} + void FieldPathUpdateTestCase::setUp() { @@ -851,9 +856,13 @@ struct Keys { vespalib::string key1; vespalib::string key2; vespalib::string key3; - Keys() : key1("foo"), key2("bar"), key3("zoo") {} + Keys(); + ~Keys(); }; +Keys::Keys() : key1("foo"), key2("bar"), key3("zoo") {} +Keys::~Keys() {} + struct Fixture { Document::UP doc; MapFieldValue mfv; @@ -864,32 +873,36 @@ struct Fixture { doc_type.getField("structmap").getDataType()); } - Fixture(const DocumentType &doc_type, const Keys &k) - : doc(new Document(doc_type, DocumentId("doc:planet:express"))), - mfv(getMapType(doc_type)), - fv1(getMapType(doc_type).getValueType()), - fv2(getMapType(doc_type).getValueType()), - fv3(getMapType(doc_type).getValueType()), - fv4(getMapType(doc_type).getValueType()) { + ~Fixture(); + Fixture(const DocumentType &doc_type, const Keys &k); +}; - fv1.setValue("title", StringFieldValue("fry")); - fv1.setValue("rating", IntFieldValue(30)); - mfv.put(StringFieldValue(k.key1), fv1); +Fixture::~Fixture() { } +Fixture::Fixture(const DocumentType &doc_type, const Keys &k) + : doc(new Document(doc_type, DocumentId("doc:planet:express"))), + mfv(getMapType(doc_type)), + fv1(getMapType(doc_type).getValueType()), + fv2(getMapType(doc_type).getValueType()), + fv3(getMapType(doc_type).getValueType()), + fv4(getMapType(doc_type).getValueType()) +{ + fv1.setValue("title", StringFieldValue("fry")); + fv1.setValue("rating", IntFieldValue(30)); + mfv.put(StringFieldValue(k.key1), fv1); - fv2.setValue("title", StringFieldValue("farnsworth")); - fv2.setValue("rating", IntFieldValue(60)); - mfv.put(StringFieldValue(k.key2), fv2); + fv2.setValue("title", StringFieldValue("farnsworth")); + fv2.setValue("rating", IntFieldValue(60)); + mfv.put(StringFieldValue(k.key2), fv2); - fv3.setValue("title", StringFieldValue("zoidberg")); - fv3.setValue("rating", IntFieldValue(-20)); - mfv.put(StringFieldValue(k.key3), fv3); + fv3.setValue("title", StringFieldValue("zoidberg")); + fv3.setValue("rating", IntFieldValue(-20)); + mfv.put(StringFieldValue(k.key3), fv3); - doc->setValue("structmap", mfv); + doc->setValue("structmap", mfv); - fv4.setValue("title", StringFieldValue("farnsworth")); - fv4.setValue("rating", IntFieldValue(48)); - } -}; + fv4.setValue("title", StringFieldValue("farnsworth")); + fv4.setValue("rating", IntFieldValue(48)); +} } // namespace diff --git a/document/src/tests/gid_filter_test.cpp b/document/src/tests/gid_filter_test.cpp index 9caf55f6a0b..02a47bffe6f 100644 --- a/document/src/tests/gid_filter_test.cpp +++ b/document/src/tests/gid_filter_test.cpp @@ -17,12 +17,8 @@ class GidFilterTest : public CppUnit::TestFixture { BucketIdFactory _id_factory; std::unique_ptr<Node> _root; - Fixture(vespalib::stringref selection) - : _repo(), - _id_factory(), - _root(Parser(_repo.getTypeRepo(), _id_factory).parse(selection)) - { - } + Fixture(vespalib::stringref selection); + ~Fixture(); Fixture(Fixture&&) = default; Fixture& operator=(Fixture&&) = default; @@ -87,6 +83,13 @@ public: void composite_group_comparison_sub_expressions_not_supported(); }; +GidFilterTest::Fixture::Fixture(vespalib::stringref selection) + : _repo(), + _id_factory(), + _root(Parser(_repo.getTypeRepo(), _id_factory).parse(selection)) +{ } +GidFilterTest::Fixture::~Fixture() { } + CPPUNIT_TEST_SUITE_REGISTRATION(GidFilterTest); void |