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 | |
parent | 68c336f802bba1974186c085ee7725a12980e244 (diff) |
deiniline destructors
21 files changed, 313 insertions, 201 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 diff --git a/messagebus/src/tests/advancedrouting/advancedrouting.cpp b/messagebus/src/tests/advancedrouting/advancedrouting.cpp index 384c9be667f..26e62ca7956 100644 --- a/messagebus/src/tests/advancedrouting/advancedrouting.cpp +++ b/messagebus/src/tests/advancedrouting/advancedrouting.cpp @@ -32,6 +32,7 @@ public: public: TestData(); + ~TestData(); bool start(); }; @@ -47,6 +48,7 @@ public: TEST_APPHOOK(Test); +TestData::~TestData() {} TestData::TestData() : _slobrok(), _retryPolicy(new RetryTransientErrorsPolicy()), diff --git a/messagebus/src/tests/choke/choke.cpp b/messagebus/src/tests/choke/choke.cpp index 023554250cc..4c223f6a55a 100644 --- a/messagebus/src/tests/choke/choke.cpp +++ b/messagebus/src/tests/choke/choke.cpp @@ -30,6 +30,7 @@ public: public: TestData(); + ~TestData(); bool start(); }; @@ -65,6 +66,8 @@ TestData::TestData() : // empty } +TestData::~TestData() {} + bool TestData::start() { diff --git a/messagebus/src/tests/messageordering/messageordering.cpp b/messagebus/src/tests/messageordering/messageordering.cpp index a502769a9e8..0c102915cb1 100644 --- a/messagebus/src/tests/messageordering/messageordering.cpp +++ b/messagebus/src/tests/messageordering/messageordering.cpp @@ -88,51 +88,60 @@ class VerifyReplyReceptor : public IReplyHandler std::string _failure; int _replyCount; public: - VerifyReplyReceptor() - : _mon(), - _failure(), - _replyCount(0) - {} - void handleReply(Reply::UP reply) - { - vespalib::MonitorGuard lock(_mon); - if (reply->hasErrors()) { - std::ostringstream ss; - ss << "Reply failed with " - << reply->getError(0).getMessage() - << "\n" - << reply->getTrace().toString(); + ~VerifyReplyReceptor(); + VerifyReplyReceptor(); + void handleReply(Reply::UP reply); + void waitUntilDone(int waitForCount) const; + const std::string& getFailure() const { return _failure; } +}; + +VerifyReplyReceptor::~VerifyReplyReceptor() {} +VerifyReplyReceptor::VerifyReplyReceptor() + : _mon(), + _failure(), + _replyCount(0) +{} + +void +VerifyReplyReceptor::handleReply(Reply::UP reply) +{ + vespalib::MonitorGuard lock(_mon); + if (reply->hasErrors()) { + std::ostringstream ss; + ss << "Reply failed with " + << reply->getError(0).getMessage() + << "\n" + << reply->getTrace().toString(); + if (_failure.empty()) { + _failure = ss.str(); + } + LOG(warning, "%s", ss.str().c_str()); + } else { + vespalib::string expected(vespalib::make_vespa_string("%d", _replyCount)); + SimpleReply& simpleReply(static_cast<SimpleReply&>(*reply)); + if (simpleReply.getValue() != expected) { + std::stringstream ss; + ss << "Received out-of-sequence reply! Expected " + << expected + << ", but got " + << simpleReply.getValue(); + LOG(warning, "%s", ss.str().c_str()); if (_failure.empty()) { _failure = ss.str(); } - LOG(warning, "%s", ss.str().c_str()); - } else { - vespalib::string expected(vespalib::make_vespa_string("%d", _replyCount)); - SimpleReply& simpleReply(static_cast<SimpleReply&>(*reply)); - if (simpleReply.getValue() != expected) { - std::stringstream ss; - ss << "Received out-of-sequence reply! Expected " - << expected - << ", but got " - << simpleReply.getValue(); - LOG(warning, "%s", ss.str().c_str()); - if (_failure.empty()) { - _failure = ss.str(); - } - } } - ++_replyCount; - lock.broadcast(); } - void waitUntilDone(int waitForCount) const - { - vespalib::MonitorGuard lock(_mon); - while (_replyCount < waitForCount) { - lock.wait(1000); - } + ++_replyCount; + lock.broadcast(); +} +void +VerifyReplyReceptor::waitUntilDone(int waitForCount) const +{ + vespalib::MonitorGuard lock(_mon); + while (_replyCount < waitForCount) { + lock.wait(1000); } - const std::string& getFailure() const { return _failure; } -}; +} int Test::Main() diff --git a/messagebus/src/tests/resender/resender.cpp b/messagebus/src/tests/resender/resender.cpp index a067616d1ba..c559f244a62 100644 --- a/messagebus/src/tests/resender/resender.cpp +++ b/messagebus/src/tests/resender/resender.cpp @@ -55,6 +55,7 @@ public: Receptor _dstHandler; public: + ~TestData(); TestData(); bool start(); }; @@ -88,9 +89,9 @@ TestData::TestData() : RPCNetworkParams().setIdentity(Identity("dst")).setSlobrokConfig(_slobrok.config())), _dstSession(), _dstHandler() -{ - // empty -} +{ } + +TestData::~TestData() {} bool TestData::start() diff --git a/messagebus/src/tests/routing/routing.cpp b/messagebus/src/tests/routing/routing.cpp index 23698279137..be0a69e855a 100644 --- a/messagebus/src/tests/routing/routing.cpp +++ b/messagebus/src/tests/routing/routing.cpp @@ -476,6 +476,7 @@ public: public: TestData(); + ~TestData(); bool start(); }; @@ -570,6 +571,8 @@ TestData::TestData() : _retryPolicy->setBaseDelay(0); } +TestData::~TestData() {} + bool TestData::start() { diff --git a/messagebus/src/tests/routingcontext/routingcontext.cpp b/messagebus/src/tests/routingcontext/routingcontext.cpp index 02c7ef6dd72..d8d76a3069c 100644 --- a/messagebus/src/tests/routingcontext/routingcontext.cpp +++ b/messagebus/src/tests/routingcontext/routingcontext.cpp @@ -202,6 +202,7 @@ public: public: TestData(); + ~TestData(); bool start(); }; @@ -234,6 +235,8 @@ TestData::TestData() : _retryPolicy->setBaseDelay(0); } +TestData::~TestData() {} + bool TestData::start() { diff --git a/messagebus/src/tests/sendadapter/sendadapter.cpp b/messagebus/src/tests/sendadapter/sendadapter.cpp index b25240acdac..f4973b96e31 100644 --- a/messagebus/src/tests/sendadapter/sendadapter.cpp +++ b/messagebus/src/tests/sendadapter/sendadapter.cpp @@ -55,6 +55,7 @@ public: public: TestData(); + ~TestData(); bool start(); }; @@ -91,9 +92,9 @@ TestData::TestData() : RPCNetworkParams().setIdentity(Identity("dst")).setSlobrokConfig(_slobrok.config())), _dstSession(), _dstHandler() -{ - // empty -} +{ } + +TestData::~TestData() {} bool TestData::start() diff --git a/searchlib/src/apps/fileheaderinspect/fileheaderinspect.cpp b/searchlib/src/apps/fileheaderinspect/fileheaderinspect.cpp index 0d6f8c6baf9..3f0801a3a3f 100644 --- a/searchlib/src/apps/fileheaderinspect/fileheaderinspect.cpp +++ b/searchlib/src/apps/fileheaderinspect/fileheaderinspect.cpp @@ -27,6 +27,7 @@ private: public: Application(); + ~Application(); int Main(); }; @@ -34,9 +35,9 @@ Application::Application() : _fileName(""), _delimiter(';'), _quiet(false) -{ - // empty -} +{ } + +Application::~Application() {} void diff --git a/searchlib/src/apps/tests/biglogtest.cpp b/searchlib/src/apps/tests/biglogtest.cpp index 5e81b02493e..3b943d9fd17 100644 --- a/searchlib/src/apps/tests/biglogtest.cpp +++ b/searchlib/src/apps/tests/biglogtest.cpp @@ -124,19 +124,23 @@ struct factory<LogDataStore> : DioTune vespalib::ThreadStackExecutor _executor; transactionlog::NoSyncProxy _noTlSyncer; LogDataStore _datastore; - factory(std::string dir) - : DioTune(), - _fileHeaderContext(), - _config(), - _executor(_config.getNumThreads(), 128*1024), - _noTlSyncer(), - _datastore(_executor, dir, _config, GrowStrategy(), tuning, - _fileHeaderContext, _noTlSyncer, NULL) - {} + factory(std::string dir); + ~factory(); IDataStore & operator() () { return _datastore; } }; +factory<LogDataStore>::factory(std::string dir) + : DioTune(), + _fileHeaderContext(), + _config(), + _executor(_config.getNumThreads(), 128*1024), + _noTlSyncer(), + _datastore(_executor, dir, _config, GrowStrategy(), tuning, _fileHeaderContext, _noTlSyncer, NULL) +{} + +factory<LogDataStore>::~factory() {} + template <typename DS> void Test::testDIO() diff --git a/searchlib/src/apps/vespa-ranking-expression-analyzer/vespa-ranking-expression-analyzer.cpp b/searchlib/src/apps/vespa-ranking-expression-analyzer/vespa-ranking-expression-analyzer.cpp index 872664b9f9f..7409ad4abbd 100644 --- a/searchlib/src/apps/vespa-ranking-expression-analyzer/vespa-ranking-expression-analyzer.cpp +++ b/searchlib/src/apps/vespa-ranking-expression-analyzer/vespa-ranking-expression-analyzer.cpp @@ -263,19 +263,8 @@ struct State { std::vector<vespalib::string> options; std::vector<double> options_us; - explicit State(const vespalib::string &file_name, - vespalib::string expression_in) - : name(strip_name(file_name)), - expression(std::move(expression_in)), - function(Function::parse(expression, FeatureNameExtractor())), - fun_info(function), - compiled_function(), - llvm_compile_s(0.0), - llvm_execute_us(0.0), - options(), - options_us() - { - } + State(const vespalib::string &file_name, vespalib::string expression_in); + ~State(); void benchmark_llvm_compile() { BenchmarkTimer timer(1.0); @@ -323,6 +312,21 @@ struct State { } }; +State::State(const vespalib::string &file_name, vespalib::string expression_in) + : name(strip_name(file_name)), + expression(std::move(expression_in)), + function(Function::parse(expression, FeatureNameExtractor())), + fun_info(function), + compiled_function(), + llvm_compile_s(0.0), + llvm_execute_us(0.0), + options(), + options_us() +{ +} + +State::~State() {} + //----------------------------------------------------------------------------- struct MyApp : public FastOS_Application { diff --git a/searchlib/src/tests/attribute/attributeupdater.h b/searchlib/src/tests/attribute/attributeupdater.h index 5193ca0f873..2e5b1cc2622 100644 --- a/searchlib/src/tests/attribute/attributeupdater.h +++ b/searchlib/src/tests/attribute/attributeupdater.h @@ -122,12 +122,8 @@ protected: public: AttributeUpdater(const AttributePtr & attrPtr, const std::vector<T> & values, RandomGenerator & rndGen, bool validate, uint32_t commitFreq, - uint32_t minValueCount, uint32_t maxValueCount) : - _attrPtr(attrPtr), _attrVec(*(static_cast<Vector *>(attrPtr.get()))), - _values(values), _buffer(), _getBuffer(), _rndGen(rndGen), _expected(), _timer(), _status(), _validator(), - _validate(validate), _commitFreq(commitFreq), _minValueCount(minValueCount), _maxValueCount(maxValueCount) - { - } + uint32_t minValueCount, uint32_t maxValueCount); + ~AttributeUpdater(); void resetStatus() { _status.reset(); } @@ -142,6 +138,18 @@ public: }; template <typename Vector, typename T, typename BT> +AttributeUpdater<Vector, T, BT>::AttributeUpdater(const AttributePtr & attrPtr, const std::vector<T> & values, + RandomGenerator & rndGen, bool validate, uint32_t commitFreq, + uint32_t minValueCount, uint32_t maxValueCount) + :_attrPtr(attrPtr), _attrVec(*(static_cast<Vector *>(attrPtr.get()))), _values(values), _buffer(), + _getBuffer(), _rndGen(rndGen), _expected(), _timer(), _status(), _validator(), _validate(validate), + _commitFreq(commitFreq), _minValueCount(minValueCount), _maxValueCount(maxValueCount) +{} + +template <typename Vector, typename T, typename BT> +AttributeUpdater<Vector, T, BT>::~AttributeUpdater() {} + +template <typename Vector, typename T, typename BT> class AttributeUpdaterThread : public AttributeUpdater<Vector, T, BT>, public Runnable { private: @@ -150,13 +158,22 @@ private: public: AttributeUpdaterThread(const AttributePtr & attrPtr, const std::vector<T> & values, RandomGenerator & rndGen, bool validate, uint32_t commitFreq, - uint32_t minValueCount, uint32_t maxValueCount) : - AttributeUpdater<Vector, T, BT>(attrPtr, values, rndGen, validate, commitFreq, minValueCount, maxValueCount), - Runnable(0) {} + uint32_t minValueCount, uint32_t maxValueCount); + ~AttributeUpdaterThread(); virtual void doRun(); }; +template <typename Vector, typename T, typename BT> +AttributeUpdaterThread<Vector, T, BT>::AttributeUpdaterThread(const AttributePtr & attrPtr, const std::vector<T> & values, + RandomGenerator & rndGen, bool validate, uint32_t commitFreq, + uint32_t minValueCount, uint32_t maxValueCount) + : AttributeUpdater<Vector, T, BT>(attrPtr, values, rndGen, validate, commitFreq, minValueCount, maxValueCount), + Runnable(0) +{} +template <typename Vector, typename T, typename BT> +AttributeUpdaterThread<Vector, T, BT>::~AttributeUpdaterThread() { } + template <typename Vector, typename T, typename BT> void diff --git a/searchlib/src/tests/attribute/bitvector/bitvector_test.cpp b/searchlib/src/tests/attribute/bitvector/bitvector_test.cpp index f3983a4900f..1c2ca360bd8 100644 --- a/searchlib/src/tests/attribute/bitvector/bitvector_test.cpp +++ b/searchlib/src/tests/attribute/bitvector/bitvector_test.cpp @@ -611,11 +611,8 @@ TEST_F("Test bitvectors with weighted set value string", BitVectorTest) class Verifier : public search::test::SearchIteratorVerifier { public: - Verifier() : _bv(BitVector::create(getDocIdLimit())) { - for (uint32_t docId: getExpectedDocIds()) { - _bv->setBit(docId); - } - } + Verifier(); + ~Verifier(); SearchIterator::UP create(bool strict) const override { return BitVectorIterator::create(_bv.get(), getDocIdLimit(), _tfmd, strict); @@ -626,6 +623,15 @@ private: BitVector::UP _bv; }; +Verifier::Verifier() + : _bv(BitVector::create(getDocIdLimit())) +{ + for (uint32_t docId: getExpectedDocIds()) { + _bv->setBit(docId); + } +} +Verifier::~Verifier() {} + TEST("Test that bitvector iterators adheres to SearchIterator requirements") { Verifier searchIteratorVerifier; searchIteratorVerifier.verify(); diff --git a/searchlib/src/tests/attribute/document_weight_iterator/document_weight_iterator_test.cpp b/searchlib/src/tests/attribute/document_weight_iterator/document_weight_iterator_test.cpp index 62bdbd9bf51..120c471de48 100644 --- a/searchlib/src/tests/attribute/document_weight_iterator/document_weight_iterator_test.cpp +++ b/searchlib/src/tests/attribute/document_weight_iterator/document_weight_iterator_test.cpp @@ -169,16 +169,8 @@ TEST_F("require that string iterators are created correctly", StringFixture) { class Verifier : public search::test::SearchIteratorVerifier { public: - Verifier() : - _attr(make_attribute(BasicType::INT64, CollectionType::WSET, true)) - { - add_docs(_attr, getDocIdLimit()); - auto docids = getExpectedDocIds(); - IntegerAttribute *int_attr = static_cast<IntegerAttribute *>(_attr.get()); - for (auto docid: docids) { - set_doc(int_attr, docid, int64_t(123), 1); - } - } + Verifier(); + ~Verifier(); SearchIterator::UP create(bool strict) const override { (void) strict; const IDocumentWeightAttribute *api(_attr->asDocumentWeightAttribute()); @@ -191,6 +183,19 @@ private: mutable fef::TermFieldMatchData _tfmd; AttributeVector::SP _attr; }; + +Verifier::Verifier() + : _attr(make_attribute(BasicType::INT64, CollectionType::WSET, true)) +{ + add_docs(_attr, getDocIdLimit()); + auto docids = getExpectedDocIds(); + IntegerAttribute *int_attr = static_cast<IntegerAttribute *>(_attr.get()); + for (auto docid: docids) { + set_doc(int_attr, docid, int64_t(123), 1); + } +} +Verifier::~Verifier() {} + TEST("verify document weight search iterator") { Verifier verifier; verifier.verify(); diff --git a/searchlib/src/tests/attribute/enumeratedsave/enumeratedsave_test.cpp b/searchlib/src/tests/attribute/enumeratedsave/enumeratedsave_test.cpp index df0a406aebb..c57bf0ba87c 100644 --- a/searchlib/src/tests/attribute/enumeratedsave/enumeratedsave_test.cpp +++ b/searchlib/src/tests/attribute/enumeratedsave/enumeratedsave_test.cpp @@ -102,13 +102,8 @@ private: public: typedef std::shared_ptr<MemAttr> SP; - MemAttr(void) - : _datWriter(), - _idxWriter(), - _weightWriter(), - _udatWriter() - { - } + MemAttr(); + ~MemAttr(); // Implements IAttributeSaveTarget virtual bool setup() { return true; } @@ -127,6 +122,14 @@ public: operator==(const MemAttr &rhs) const; }; +MemAttr::MemAttr() + : _datWriter(), + _idxWriter(), + _weightWriter(), + _udatWriter() +{ } +MemAttr::~MemAttr() {} + class EnumeratedSaveTest { private: diff --git a/searchlib/src/tests/attribute/enumstore/enumstore_test.cpp b/searchlib/src/tests/attribute/enumstore/enumstore_test.cpp index b9c2279995e..63d12aaf242 100644 --- a/searchlib/src/tests/attribute/enumstore/enumstore_test.cpp +++ b/searchlib/src/tests/attribute/enumstore/enumstore_test.cpp @@ -89,8 +89,8 @@ private: IndexVector _indices; ExpectedVector _expected; Reader(uint32_t generation, const IndexVector & indices, - const ExpectedVector & expected) : - _generation(generation), _indices(indices), _expected(expected) {} + const ExpectedVector & expected); + ~Reader(); }; void @@ -103,6 +103,11 @@ public: int Main(); }; +EnumStoreTest::Reader::Reader(uint32_t generation, const IndexVector & indices, const ExpectedVector & expected) + : _generation(generation), _indices(indices), _expected(expected) +{} +EnumStoreTest::Reader::~Reader() { } + void EnumStoreTest::testIndex() { diff --git a/storageframework/src/tests/thread/tickingthreadtest.cpp b/storageframework/src/tests/thread/tickingthreadtest.cpp index 3c3c23d244f..508cadc6fbd 100644 --- a/storageframework/src/tests/thread/tickingthreadtest.cpp +++ b/storageframework/src/tests/thread/tickingthreadtest.cpp @@ -57,17 +57,8 @@ struct MyApp : public TickingThread { std::vector<Context> _context; TickingThreadPool::UP _threadPool; - MyApp(int threadCount, bool doCritOverlapTest = false) - : _critOverlapCounter(0), - _doCritOverlapTest(doCritOverlapTest), - _critOverlap(false), - _threadPool(TickingThreadPool::createDefault("testApp")) - { - for (int i=0; i<threadCount; ++i) { - _threadPool->addThread(*this); - _context.push_back(Context()); - } - } + MyApp(int threadCount, bool doCritOverlapTest = false); + ~MyApp(); void start(ThreadPool& p) { _threadPool->start(p); } @@ -123,6 +114,20 @@ struct MyApp : public TickingThread { bool hasCritOverlap() { return _critOverlap; } }; +MyApp::MyApp(int threadCount, bool doCritOverlapTest) + : _critOverlapCounter(0), + _doCritOverlapTest(doCritOverlapTest), + _critOverlap(false), + _threadPool(TickingThreadPool::createDefault("testApp")) +{ + for (int i=0; i<threadCount; ++i) { + _threadPool->addThread(*this); + _context.push_back(Context()); + } +} + +MyApp::~MyApp() { } + } void @@ -304,12 +309,8 @@ struct BroadcastApp : public TickingThread { TickingThreadPool::UP _threadPool; // Set a huge wait time by default to ensure we have to notify - BroadcastApp() - : _threadPool(TickingThreadPool::createDefault( - "testApp", MilliSecTime(300000))) - { - _threadPool->addThread(*this); - } + BroadcastApp(); + ~BroadcastApp(); void start(ThreadPool& p) { _threadPool->start(p); } @@ -343,6 +344,13 @@ struct BroadcastApp : public TickingThread { } }; +BroadcastApp::BroadcastApp() + : _threadPool(TickingThreadPool::createDefault("testApp", MilliSecTime(300000))) +{ + _threadPool->addThread(*this); +} +BroadcastApp::~BroadcastApp() {} + } diff --git a/vdslib/src/tests/distribution/distributiontest.cpp b/vdslib/src/tests/distribution/distributiontest.cpp index 8886d06ca69..41e06d1941e 100644 --- a/vdslib/src/tests/distribution/distributiontest.cpp +++ b/vdslib/src/tests/distribution/distributiontest.cpp @@ -318,15 +318,8 @@ namespace { const char* _upStates; uint16_t _redundancy; - Test() - : _nodeType(&NodeType::STORAGE), - _state("distributor:10 storage:10"), - _distribution(new Distribution(Distribution::getDefaultDistributionConfig(3, 10))), - _bucketsToTest(100), - _upStates("uir"), - _redundancy(2) - { - } + Test(); + ~Test(); Test& state(const std::string& s) { _state = s; @@ -389,6 +382,16 @@ namespace { } }; + Test::Test() + : _nodeType(&NodeType::STORAGE), + _state("distributor:10 storage:10"), + _distribution(new Distribution(Distribution::getDefaultDistributionConfig(3, 10))), + _bucketsToTest(100), + _upStates("uir"), + _redundancy(2) + { } + Test::~Test() { } + std::vector<uint16_t> createNodeCountList(const std::string& source, std::vector<uint16_t>& vals) { std::vector<uint16_t> result(vals.size(), 0); |