From d5e14a8f61e4a8f5cf82722d479f14c7581bcec7 Mon Sep 17 00:00:00 2001 From: Henning Baldersheim Date: Wed, 3 May 2017 09:45:45 +0200 Subject: Fix warnings hidden earlier due to including application headers as system includes --- .../compaction/attribute_compaction_test.cpp | 4 +- .../imported_attribute_vector_test.cpp | 2 +- .../imported_search_context_test.cpp | 4 +- .../multi_value_mapping_test.cpp | 14 +-- .../tests/attribute/postinglist/postinglist.cpp | 45 ++++----- .../attribute_searchable_adapter_test.cpp | 2 +- .../attribute/searchcontext/searchcontext.cpp | 3 + .../src/tests/common/rcuvector/rcuvector_test.cpp | 8 +- .../datastore/array_store/array_store_test.cpp | 12 +-- .../array_store_config/array_store_config_test.cpp | 8 +- .../tests/diskindex/diskindex/diskindex_test.cpp | 5 +- .../docstore/document_store/visitcache_test.cpp | 20 ++-- .../docstore/logdatastore/logdatastore_test.cpp | 8 +- .../src/tests/features/beta/beta_features.cpp | 10 +- searchlib/src/tests/features/featurebenchmark.cpp | 20 ++-- searchlib/src/tests/features/prod_features.h | 2 + .../tests/features/prod_features_fieldmatch.cpp | 12 +-- .../src/tests/fef/properties/properties_test.cpp | 5 +- searchlib/src/tests/fef/resolver/resolver_test.cpp | 9 +- searchlib/src/tests/fef/table/table_test.cpp | 14 ++- .../src/tests/indexmetainfo/indexmetainfo_test.cpp | 4 +- .../tests/memoryindex/btree/frozenbtree_test.cpp | 112 +++++++-------------- searchlib/src/tests/nativerank/nativerank.cpp | 9 +- .../tests/queryeval/blueprint/blueprint_test.cpp | 4 +- .../multibitvectoriterator_bench.cpp | 7 +- searchlib/src/tests/ranksetup/ranksetup_test.cpp | 7 +- 26 files changed, 153 insertions(+), 197 deletions(-) (limited to 'searchlib/src/tests') diff --git a/searchlib/src/tests/attribute/compaction/attribute_compaction_test.cpp b/searchlib/src/tests/attribute/compaction/attribute_compaction_test.cpp index 03b5931c6b9..525643e377c 100644 --- a/searchlib/src/tests/attribute/compaction/attribute_compaction_test.cpp +++ b/searchlib/src/tests/attribute/compaction/attribute_compaction_test.cpp @@ -177,7 +177,7 @@ TEST_F("Test that no compaction of int8 array attribute increases address space AddressSpace afterSpace = f.getMultiValueAddressSpaceUsage("after"); // 100 * 1000 dead clusters due to new values for docids // 1 reserved cluster accounted as dead - EXPECT_EQUAL(100001, afterSpace.dead()); + EXPECT_EQUAL(100001u, afterSpace.dead()); } TEST_F("Test that compaction of int8 array attribute limits address space usage", Fixture(compactAddressSpaceAttributeConfig(true))) @@ -188,7 +188,7 @@ TEST_F("Test that compaction of int8 array attribute limits address space usage" f.hammer(range2, 101); AddressSpace afterSpace = f.getMultiValueAddressSpaceUsage("after"); // DEAD_CLUSTERS_SLACK in multi value mapping is is 64k - EXPECT_GREATER(65536, afterSpace.dead()); + EXPECT_GREATER(65536u, afterSpace.dead()); } TEST_MAIN() { TEST_RUN_ALL(); } diff --git a/searchlib/src/tests/attribute/imported_attribute_vector/imported_attribute_vector_test.cpp b/searchlib/src/tests/attribute/imported_attribute_vector/imported_attribute_vector_test.cpp index b46875cf3e6..3621537c8fd 100644 --- a/searchlib/src/tests/attribute/imported_attribute_vector/imported_attribute_vector_test.cpp +++ b/searchlib/src/tests/attribute/imported_attribute_vector/imported_attribute_vector_test.cpp @@ -23,7 +23,7 @@ TEST_F("getName() is equal to name given during construction", Fixture) { TEST_F("getNumDocs() returns number of documents in reference attribute vector", Fixture) { add_n_docs_with_undefined_values(*f.reference_attr, 42); - EXPECT_EQUAL(42, f.imported_attr->getNumDocs()); + EXPECT_EQUAL(42u, f.imported_attr->getNumDocs()); } TEST_F("hasEnum() is false for non-enum target attribute vector", Fixture) { diff --git a/searchlib/src/tests/attribute/imported_search_context/imported_search_context_test.cpp b/searchlib/src/tests/attribute/imported_search_context/imported_search_context_test.cpp index af57eec46b1..f50767d22b3 100644 --- a/searchlib/src/tests/attribute/imported_search_context/imported_search_context_test.cpp +++ b/searchlib/src/tests/attribute/imported_search_context/imported_search_context_test.cpp @@ -1,9 +1,9 @@ // Copyright 2017 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include #include #include #include +#include namespace search { namespace attribute { @@ -65,7 +65,7 @@ TEST_F("approximateHits() returns document count of reference attribute", Fixtur add_n_docs_with_undefined_values(*f.reference_attr, 101); auto ctx = f.create_context(word_term("foo")); - EXPECT_EQUAL(101, ctx->approximateHits()); + EXPECT_EQUAL(101u, ctx->approximateHits()); } TEST_F("attributeName() returns imported attribute name", Fixture) { diff --git a/searchlib/src/tests/attribute/multi_value_mapping/multi_value_mapping_test.cpp b/searchlib/src/tests/attribute/multi_value_mapping/multi_value_mapping_test.cpp index 20590a11da0..e41045c2aae 100644 --- a/searchlib/src/tests/attribute/multi_value_mapping/multi_value_mapping_test.cpp +++ b/searchlib/src/tests/attribute/multi_value_mapping/multi_value_mapping_test.cpp @@ -1,16 +1,17 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include -#include -LOG_SETUP("multivaluemapping_test"); + #include #include #include #include +#include #include #include -#include #include +#include +LOG_SETUP("multivaluemapping_test"); + using search::datastore::ArrayStoreConfig; template @@ -44,8 +45,7 @@ public: MyAttribute(MvMapping &mvMapping) : NotImplementedAttribute("test", AttributeVector::Config()), _mvMapping(mvMapping) - { - } + {} virtual bool addDoc(DocId &doc) override { _mvMapping.addDoc(doc); incNumDocs(); @@ -237,7 +237,7 @@ TEST_F("Test that old value is not overwritten while held", Fixture(3, 32, TEST_F("Test that addDoc works", Fixture(3)) { - EXPECT_EQUAL(0, f.size()); + EXPECT_EQUAL(0u, f.size()); f.addDocs(10); EXPECT_EQUAL(10u, f.size()); } diff --git a/searchlib/src/tests/attribute/postinglist/postinglist.cpp b/searchlib/src/tests/attribute/postinglist/postinglist.cpp index 271b062ebcd..35e702dcaf1 100644 --- a/searchlib/src/tests/attribute/postinglist/postinglist.cpp +++ b/searchlib/src/tests/attribute/postinglist/postinglist.cpp @@ -1,15 +1,5 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include -#include -LOG_SETUP("postinglist_test"); -#include -#include -#include -#include -#include -#include - #include #include #include @@ -17,6 +7,12 @@ LOG_SETUP("postinglist_test"); #include #include #include +#include +#include +#include + +#include +LOG_SETUP("postinglist_test"); namespace search { @@ -215,26 +211,27 @@ private: return frozen ? "frozen" : "thawed"; } public: - AttributePostingListTest(void) - : vespalib::TestApp(), - _randomValues(), - _handler(), - _intKeyStore(NULL), - _intNodeAlloc(NULL), - _intTree(NULL), - _intPostings(NULL), - _stlTree(NULL), - _randomGenerator() - { - } + AttributePostingListTest(); + ~AttributePostingListTest(); int Main(void) override; }; - +AttributePostingListTest::AttributePostingListTest() + : vespalib::TestApp(), + _randomValues(), + _handler(), + _intKeyStore(NULL), + _intNodeAlloc(NULL), + _intTree(NULL), + _intPostings(NULL), + _stlTree(NULL), + _randomGenerator() +{} +AttributePostingListTest::~AttributePostingListTest() {} void -AttributePostingListTest::allocTree(void) +AttributePostingListTest::allocTree() { _intKeyStore = new IntKeyStore; _intNodeAlloc = new IntEnumNodeAllocator(); diff --git a/searchlib/src/tests/attribute/searchable/attribute_searchable_adapter_test.cpp b/searchlib/src/tests/attribute/searchable/attribute_searchable_adapter_test.cpp index 8e624c2556a..255d22d1636 100644 --- a/searchlib/src/tests/attribute/searchable/attribute_searchable_adapter_test.cpp +++ b/searchlib/src/tests/attribute/searchable/attribute_searchable_adapter_test.cpp @@ -227,7 +227,7 @@ bool search(const Node &node, IAttributeManager &attribute_manager, } else { if (empty) { EXPECT_TRUE(result.est_empty); - EXPECT_EQUAL(0, result.est_hits); + EXPECT_EQUAL(0u, result.est_hits); } else { EXPECT_TRUE(!result.est_empty); EXPECT_EQUAL(num_docs, result.est_hits); diff --git a/searchlib/src/tests/attribute/searchcontext/searchcontext.cpp b/searchlib/src/tests/attribute/searchcontext/searchcontext.cpp index 618adb006d6..ddd2bd13707 100644 --- a/searchlib/src/tests/attribute/searchcontext/searchcontext.cpp +++ b/searchlib/src/tests/attribute/searchcontext/searchcontext.cpp @@ -280,6 +280,7 @@ private: public: SearchContextTest(); + ~SearchContextTest(); int Main() override; }; @@ -1893,6 +1894,8 @@ SearchContextTest::SearchContextTest() : initStringConfig(); } +SearchContextTest::~SearchContextTest() {} + int SearchContextTest::Main() { diff --git a/searchlib/src/tests/common/rcuvector/rcuvector_test.cpp b/searchlib/src/tests/common/rcuvector/rcuvector_test.cpp index cd6ae2c2567..9361b35ada9 100644 --- a/searchlib/src/tests/common/rcuvector/rcuvector_test.cpp +++ b/searchlib/src/tests/common/rcuvector/rcuvector_test.cpp @@ -1,7 +1,5 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include -#include -LOG_SETUP("rcuvector_test"); + #include #include @@ -278,8 +276,8 @@ TEST_F("require that shrink() does not increase allocated memory", ShrinkFixture TEST_F("require that shrink() can shrink mmap allocation", ShrinkFixture) { f.vec.shrink(2048); - EXPECT_EQUAL(2048, f.vec.size()); - EXPECT_EQUAL(3072, f.vec.capacity()); + EXPECT_EQUAL(2048u, f.vec.size()); + EXPECT_EQUAL(3072u, f.vec.capacity()); TEST_DO(f.assertOldEqualNewBuffer()); TEST_DO(f.assertEmptyHoldList()); } diff --git a/searchlib/src/tests/datastore/array_store/array_store_test.cpp b/searchlib/src/tests/datastore/array_store/array_store_test.cpp index aace9f6988a..966a3243011 100644 --- a/searchlib/src/tests/datastore/array_store/array_store_test.cpp +++ b/searchlib/src/tests/datastore/array_store/array_store_test.cpp @@ -1,12 +1,10 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include -#include -LOG_SETUP("array_store_test"); + +#include +#include #include #include #include -#include -#include #include using namespace search::datastore; @@ -316,8 +314,8 @@ TEST_F("require that address space usage is ratio between used clusters and numb f.add({2,2}); f.add({4,4,4}); // 1 cluster is reserved (buffer 0, offset 0). - EXPECT_EQUAL(3, f.store.addressSpaceUsage().used()); - EXPECT_EQUAL(1, f.store.addressSpaceUsage().dead()); + EXPECT_EQUAL(3u, f.store.addressSpaceUsage().used()); + EXPECT_EQUAL(1u, f.store.addressSpaceUsage().dead()); size_t fourgig = (1ull << 32); /* * Expected limit is sum of allocated clusters for active buffers and diff --git a/searchlib/src/tests/datastore/array_store_config/array_store_config_test.cpp b/searchlib/src/tests/datastore/array_store_config/array_store_config_test.cpp index bc7a446b3b4..e5e22c58cae 100644 --- a/searchlib/src/tests/datastore/array_store_config/array_store_config_test.cpp +++ b/searchlib/src/tests/datastore/array_store_config/array_store_config_test.cpp @@ -1,7 +1,5 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include -#include -LOG_SETUP("array_store_config_test"); + #include #include #include @@ -41,7 +39,7 @@ constexpr size_t MB = KB * KB; TEST_F("require that default allocation spec is given for all array sizes", Fixture(3, AllocSpec(4, 32, 8))) { - EXPECT_EQUAL(3, f.cfg.maxSmallArraySize()); + EXPECT_EQUAL(3u, f.cfg.maxSmallArraySize()); TEST_DO(f.assertSpec(0, AllocSpec(4, 32, 8))); TEST_DO(f.assertSpec(1, AllocSpec(4, 32, 8))); TEST_DO(f.assertSpec(2, AllocSpec(4, 32, 8))); @@ -53,7 +51,7 @@ TEST_F("require that we can generate config optimized for a given huge page", Fi 4 * KB, 8 * KB)) { - EXPECT_EQUAL(1024, f.cfg.maxSmallArraySize()); + EXPECT_EQUAL(1024u, f.cfg.maxSmallArraySize()); TEST_DO(f.assertSpec(0, 8 * KB)); // large arrays TEST_DO(f.assertSpec(1, 256 * KB)); TEST_DO(f.assertSpec(2, 256 * KB)); diff --git a/searchlib/src/tests/diskindex/diskindex/diskindex_test.cpp b/searchlib/src/tests/diskindex/diskindex/diskindex_test.cpp index adabe0e2679..2eb0fda6fbe 100644 --- a/searchlib/src/tests/diskindex/diskindex/diskindex_test.cpp +++ b/searchlib/src/tests/diskindex/diskindex/diskindex_test.cpp @@ -13,10 +13,10 @@ #include #include #include +#include #include #include #include -#include using search::BitVectorIterator; using namespace search::fef; @@ -63,6 +63,7 @@ private: void requireThatSearchIteratorsConforms(); public: Test(); + ~Test(); int Main() override; }; @@ -282,6 +283,8 @@ Test::Test() : { } +Test::~Test() {} + int Test::Main() { diff --git a/searchlib/src/tests/docstore/document_store/visitcache_test.cpp b/searchlib/src/tests/docstore/document_store/visitcache_test.cpp index 3fac4cbb954..cb41099da28 100644 --- a/searchlib/src/tests/docstore/document_store/visitcache_test.cpp +++ b/searchlib/src/tests/docstore/document_store/visitcache_test.cpp @@ -32,23 +32,23 @@ TEST("require that KeySet compares well") { EXPECT_FALSE(KeySet({1,3,5}) < KeySet({1,2})); EXPECT_TRUE(KeySet({1,2}) < KeySet({1,3,5})); EXPECT_FALSE(KeySet({1,4}) < KeySet({1,3,5})); - EXPECT_EQUAL(1, a.getKeys()[0]); - EXPECT_EQUAL(2, a.getKeys()[1]); - EXPECT_EQUAL(3, a.getKeys()[2]); - EXPECT_EQUAL(4, a.getKeys()[3]); - EXPECT_EQUAL(6, a.getKeys()[4]); - EXPECT_EQUAL(9, a.getKeys()[5]); + EXPECT_EQUAL(1u, a.getKeys()[0]); + EXPECT_EQUAL(2u, a.getKeys()[1]); + EXPECT_EQUAL(3u, a.getKeys()[2]); + EXPECT_EQUAL(4u, a.getKeys()[3]); + EXPECT_EQUAL(6u, a.getKeys()[4]); + EXPECT_EQUAL(9u, a.getKeys()[5]); } namespace { void verifyAB(const BlobSet & a) { - EXPECT_EQUAL(0, a.get(8).size()); - EXPECT_EQUAL(6, a.get(7).size()); - EXPECT_EQUAL(5, a.get(9).size()); + EXPECT_EQUAL(0u, a.get(8).size()); + EXPECT_EQUAL(6u, a.get(7).size()); + EXPECT_EQUAL(5u, a.get(9).size()); EXPECT_EQUAL(0, strncmp(a.get(7).c_str(), "aaaaaa", 6)); EXPECT_EQUAL(0, strncmp(a.get(9).c_str(), "bbbbb", 5)); - EXPECT_EQUAL(11, a.getBuffer().size()); + EXPECT_EQUAL(11u, a.getBuffer().size()); EXPECT_EQUAL(0, strncmp(a.getBuffer().c_str(), "aaaaaabbbbb", 11)); } diff --git a/searchlib/src/tests/docstore/logdatastore/logdatastore_test.cpp b/searchlib/src/tests/docstore/logdatastore/logdatastore_test.cpp index f53423a4981..c1cd330df87 100644 --- a/searchlib/src/tests/docstore/logdatastore/logdatastore_test.cpp +++ b/searchlib/src/tests/docstore/logdatastore/logdatastore_test.cpp @@ -138,7 +138,7 @@ TEST("testThatLidInfoOrdersFileChunkSize") { } TEST("test that DirectIOPadding works accordng to spec") { - constexpr size_t FILE_SIZE = 4096*3; + constexpr ssize_t FILE_SIZE = 4096*3; FastOS_File file("directio.test"); file.EnableDirectIO(); EXPECT_TRUE(file.OpenReadWrite()); @@ -855,7 +855,7 @@ TEST("test that StoreByBucket gives bucket by bucket and ordered within") { TEST("test that LidInfo has 8 bytes size and that it can represent the numbers correctly.") { - EXPECT_EQUAL(8, sizeof(LidInfo)); + EXPECT_EQUAL(8u, sizeof(LidInfo)); LidInfo a(0,0,0); EXPECT_EQUAL(0u, a.getFileId()); EXPECT_EQUAL(0u, a.getChunkId()); @@ -887,8 +887,8 @@ TEST("test that LidInfo has 8 bytes size and that it can represent the numbers c EXPECT_TRUE(a.valid()); EXPECT_FALSE(a.empty()); a = LidInfo(0xffff,0x3fffff,0xffffff80u); - EXPECT_EQUAL(0xffff, a.getFileId()); - EXPECT_EQUAL(0x3fffff, a.getChunkId()); + EXPECT_EQUAL(0xffffu, a.getFileId()); + EXPECT_EQUAL(0x3fffffu, a.getChunkId()); EXPECT_EQUAL(0xffffff80u, a.size()); EXPECT_TRUE(a.valid()); EXPECT_FALSE(a.empty()); diff --git a/searchlib/src/tests/features/beta/beta_features.cpp b/searchlib/src/tests/features/beta/beta_features.cpp index fcb769faef6..420baf29bc1 100644 --- a/searchlib/src/tests/features/beta/beta_features.cpp +++ b/searchlib/src/tests/features/beta/beta_features.cpp @@ -1,7 +1,4 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include -#include -LOG_SETUP("beta_features_test"); #include #include @@ -35,8 +32,8 @@ LOG_SETUP("beta_features_test"); #include #include #include -#include #include +#include using namespace search::features; using namespace search::fef; @@ -64,6 +61,8 @@ public: //--------------------------------------------------------------------------------------------------------------------- class Test : public FtTestApp { public: + Test(); + ~Test(); int Main() override; void testJaroWinklerDistance(); void testProximity(); @@ -84,6 +83,9 @@ private: TEST_APPHOOK(Test); +Test::Test() {} +Test::~Test() {} + int Test::Main() { diff --git a/searchlib/src/tests/features/featurebenchmark.cpp b/searchlib/src/tests/features/featurebenchmark.cpp index 40345b1c023..7e43b0e46e0 100644 --- a/searchlib/src/tests/features/featurebenchmark.cpp +++ b/searchlib/src/tests/features/featurebenchmark.cpp @@ -1,12 +1,4 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include -#include -LOG_SETUP("featurebenchmark"); - -#include -#include -#include -#include #include #include @@ -21,6 +13,11 @@ LOG_SETUP("featurebenchmark"); #include #include +#include +#include +#include +#include + using namespace search::features; using namespace search::fef; using namespace search::fef::test; @@ -131,13 +128,16 @@ private: void runNativeProximity(Config & cfg); public: - Benchmark() : _factory(), _timer(), _sample() {} + Benchmark(); + ~Benchmark(); int Main() override; }; TEST_APPHOOK(Benchmark); +Benchmark::Benchmark() : _factory(), _timer(), _sample() {} +Benchmark::~Benchmark() {} bool Benchmark::Config::isKnown(const vespalib::string & key) const @@ -167,7 +167,7 @@ Benchmark::Config::init(const vespalib::string & fileName) std::getline(is, line); if (!line.empty()) { std::vector values = FtUtil::tokenize(line, "="); - LOG_ASSERT(values.size() == 2); + assert(values.size() == 2); add(values[0], values[1]); } } diff --git a/searchlib/src/tests/features/prod_features.h b/searchlib/src/tests/features/prod_features.h index 5722a61a1f5..cc839703c98 100644 --- a/searchlib/src/tests/features/prod_features.h +++ b/searchlib/src/tests/features/prod_features.h @@ -9,6 +9,8 @@ class Test : public FtTestApp { public: + Test(); + ~Test(); int Main() override; void testFramework(); void testFtLib(); diff --git a/searchlib/src/tests/features/prod_features_fieldmatch.cpp b/searchlib/src/tests/features/prod_features_fieldmatch.cpp index f2fc7016751..089002b2b78 100644 --- a/searchlib/src/tests/features/prod_features_fieldmatch.cpp +++ b/searchlib/src/tests/features/prod_features_fieldmatch.cpp @@ -1,20 +1,20 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include -#include -LOG_SETUP(".prod_features_fieldmatch"); - -#include #include "prod_features.h" - #include +#include +LOG_SETUP(".prod_features_fieldmatch"); + using namespace search::features; using namespace search::fef; using namespace search::fef::test; using search::AttributeVector; using CollectionType = FieldInfo::CollectionType; +Test::Test() {} +Test::~Test() {} + void Test::testFieldMatch() { diff --git a/searchlib/src/tests/fef/properties/properties_test.cpp b/searchlib/src/tests/fef/properties/properties_test.cpp index b63cf82a54e..c7400d5815b 100644 --- a/searchlib/src/tests/fef/properties/properties_test.cpp +++ b/searchlib/src/tests/fef/properties/properties_test.cpp @@ -1,5 +1,4 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include #include #include #include @@ -278,9 +277,9 @@ TEST("test stuff") { { // vespa.matching.minhitsperthread EXPECT_EQUAL(matching::MinHitsPerThread::NAME, vespalib::string("vespa.matching.minhitsperthread")); - EXPECT_EQUAL(matching::MinHitsPerThread::DEFAULT_VALUE, 0); + EXPECT_EQUAL(matching::MinHitsPerThread::DEFAULT_VALUE, 0u); Properties p; - EXPECT_EQUAL(matching::MinHitsPerThread::lookup(p), 0); + EXPECT_EQUAL(matching::MinHitsPerThread::lookup(p), 0u); p.add("vespa.matching.minhitsperthread", "50"); EXPECT_EQUAL(matching::MinHitsPerThread::lookup(p), 50u); } diff --git a/searchlib/src/tests/fef/resolver/resolver_test.cpp b/searchlib/src/tests/fef/resolver/resolver_test.cpp index e7805f123ef..37a46861931 100644 --- a/searchlib/src/tests/fef/resolver/resolver_test.cpp +++ b/searchlib/src/tests/fef/resolver/resolver_test.cpp @@ -1,12 +1,13 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include -#include -LOG_SETUP("resolver_test"); + #include #include #include #include +#include +LOG_SETUP("resolver_test"); + namespace search { namespace fef { @@ -59,6 +60,7 @@ private: void requireThatWeGetUniqueBlueprints(); public: Test(); + ~Test(); int Main() override; }; @@ -68,6 +70,7 @@ Test::Test() : _factory.addPrototype(Blueprint::SP(new BaseBlueprint())); _factory.addPrototype(Blueprint::SP(new CombineBlueprint())); } +Test::~Test() {} void Test::requireThatWeGetUniqueBlueprints() diff --git a/searchlib/src/tests/fef/table/table_test.cpp b/searchlib/src/tests/fef/table/table_test.cpp index a049df231cc..a28c8e3e70f 100644 --- a/searchlib/src/tests/fef/table/table_test.cpp +++ b/searchlib/src/tests/fef/table/table_test.cpp @@ -1,16 +1,11 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include -#include -LOG_SETUP("tablemanager_test"); -#include -#include -#include -#include +#include #include #include -#include #include +#include +#include namespace search { namespace fef { @@ -29,6 +24,7 @@ private: const std::string _tables2Dir; public: TableTest(); + ~TableTest(); int Main() override; }; @@ -39,6 +35,8 @@ TableTest::TableTest() : { } +TableTest::~TableTest() {} + bool TableTest::assertTable(const Table & act, const Table & exp) { diff --git a/searchlib/src/tests/indexmetainfo/indexmetainfo_test.cpp b/searchlib/src/tests/indexmetainfo/indexmetainfo_test.cpp index 3bab4acceee..ed8146071e0 100644 --- a/searchlib/src/tests/indexmetainfo/indexmetainfo_test.cpp +++ b/searchlib/src/tests/indexmetainfo/indexmetainfo_test.cpp @@ -1,7 +1,5 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include -#include -LOG_SETUP("indexmetainfo_test"); + #include #include #include diff --git a/searchlib/src/tests/memoryindex/btree/frozenbtree_test.cpp b/searchlib/src/tests/memoryindex/btree/frozenbtree_test.cpp index 93b78bd1b10..c965cc08aa6 100644 --- a/searchlib/src/tests/memoryindex/btree/frozenbtree_test.cpp +++ b/searchlib/src/tests/memoryindex/btree/frozenbtree_test.cpp @@ -1,23 +1,18 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include -#include -LOG_SETUP("frozenbtree_test"); #define DEBUG_FROZENBTREE #define LOG_FROZENBTREEXX #include #include #include -#include #include #include #include -#include -#include -#include -#include #include +#include +LOG_SETUP("frozenbtree_test"); + using search::btree::BTreeRoot; using search::btree::BTreeNode; using search::btree::BTreeInternalNode; @@ -54,82 +49,44 @@ private: Rand48 _randomGenerator; - void - allocTree(void); - - void - freeTree(bool verbose); - - void - fillRandomValues(unsigned int count); - - void - insertRandomValues(Tree &tree, - NodeAllocator &allocator, - const std::vector &values); - - void - removeRandomValues(Tree &tree, - NodeAllocator &allocator, - const std::vector &values); - - void - lookupRandomValues(const Tree &tree, - NodeAllocator &allocator, - const std::vector &values); - - void - lookupGoneRandomValues(const Tree &tree, - NodeAllocator &allocator, - const std::vector &values); - - void - lookupFrozenRandomValues(const Tree &tree, - NodeAllocator &allocator, - const std::vector &values); - - void - sortRandomValues(void); - - void - traverseTreeIterator(const Tree &tree, - NodeAllocator &allocator, - const std::vector &sorted, - bool frozen); - - void - printSubEnumTree(BTreeNode::Ref node, - NodeAllocator &allocator, - int indent) const; - - void - printEnumTree(const Tree *tree, - NodeAllocator &allocator); - - static const char * - frozenName(bool frozen) - { + void allocTree(void); + void freeTree(bool verbose); + void fillRandomValues(unsigned int count); + void insertRandomValues(Tree &tree, NodeAllocator &allocator, const std::vector &values); + void removeRandomValues(Tree &tree, NodeAllocator &allocator, const std::vector &values); + void lookupRandomValues(const Tree &tree, NodeAllocator &allocator, const std::vector &values); + void lookupGoneRandomValues(const Tree &tree, NodeAllocator &allocator, const std::vector &values); + void lookupFrozenRandomValues(const Tree &tree, NodeAllocator &allocator, const std::vector &values); + void sortRandomValues(); + void traverseTreeIterator(const Tree &tree, NodeAllocator &allocator, + const std::vector &sorted, bool frozen); + + void printSubEnumTree(BTreeNode::Ref node, NodeAllocator &allocator, int indent) const; + void printEnumTree(const Tree *tree, NodeAllocator &allocator); + + static const char *frozenName(bool frozen) { return frozen ? "frozen" : "thawed"; } public: - FrozenBTreeTest(void) - : vespalib::TestApp(), - _randomValues(), - _sortedRandomValues(), - _generationHandler(NULL), - _allocator(NULL), - _tree(NULL), - _randomGenerator() - { - } + FrozenBTreeTest(); + ~FrozenBTreeTest(); - int Main(void) override; + int Main() override; }; - +FrozenBTreeTest::FrozenBTreeTest() + : vespalib::TestApp(), + _randomValues(), + _sortedRandomValues(), + _generationHandler(NULL), + _allocator(NULL), + _tree(NULL), + _randomGenerator() +{} +FrozenBTreeTest::~FrozenBTreeTest() {} void -FrozenBTreeTest::allocTree(void) +FrozenBTreeTest::allocTree() { assert(_generationHandler == NULL); assert(_allocator == NULL); @@ -193,8 +150,7 @@ FrozenBTreeTest::fillRandomValues(unsigned int count) { unsigned int i; - LOG(info, - "Filling %u random values", count); + LOG(info, "Filling %u random values", count); _randomValues.clear(); _randomValues.reserve(count); _randomGenerator.srand48(42); diff --git a/searchlib/src/tests/nativerank/nativerank.cpp b/searchlib/src/tests/nativerank/nativerank.cpp index 4c03f14e141..e9fb147dc3b 100644 --- a/searchlib/src/tests/nativerank/nativerank.cpp +++ b/searchlib/src/tests/nativerank/nativerank.cpp @@ -1,7 +1,4 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include -#include -LOG_SETUP("nativerank_test"); #include #include @@ -16,6 +13,9 @@ LOG_SETUP("nativerank_test"); #include #include +#include +LOG_SETUP("nativerank_test"); + using namespace search::fef; using namespace search::fef::test; using CollectionType = FieldInfo::CollectionType; @@ -56,9 +56,12 @@ private: void testNativeRank(); public: + ~Test(); int Main() override; }; +Test::~Test() {} + void Test::testNativeFieldMatch() { diff --git a/searchlib/src/tests/queryeval/blueprint/blueprint_test.cpp b/searchlib/src/tests/queryeval/blueprint/blueprint_test.cpp index e231af20361..d17ab183c0c 100644 --- a/searchlib/src/tests/queryeval/blueprint/blueprint_test.cpp +++ b/searchlib/src/tests/queryeval/blueprint/blueprint_test.cpp @@ -163,8 +163,8 @@ public: Test() : vespalib::TestApp(), _md(MatchData::makeTestInstance(100, 10)) - { - } + {} + ~Test() {} Blueprint::UP buildBlueprint1(); Blueprint::UP buildBlueprint2(); void testBlueprintBuilding(); diff --git a/searchlib/src/tests/queryeval/multibitvectoriterator/multibitvectoriterator_bench.cpp b/searchlib/src/tests/queryeval/multibitvectoriterator/multibitvectoriterator_bench.cpp index 4f99f01c290..dc0282c8ae2 100644 --- a/searchlib/src/tests/queryeval/multibitvectoriterator/multibitvectoriterator_bench.cpp +++ b/searchlib/src/tests/queryeval/multibitvectoriterator/multibitvectoriterator_bench.cpp @@ -1,7 +1,5 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include -#include -LOG_SETUP("multibitvectoriterator_test"); + #include #include #include @@ -10,6 +8,8 @@ LOG_SETUP("multibitvectoriterator_test"); #include #include #include +#include +LOG_SETUP("multibitvectoriterator_test"); using namespace search::queryeval; using namespace search::fef; @@ -20,6 +20,7 @@ using namespace search; class Test : public vespalib::TestApp { public: + ~Test() {} void benchmark(); int Main() override; template diff --git a/searchlib/src/tests/ranksetup/ranksetup_test.cpp b/searchlib/src/tests/ranksetup/ranksetup_test.cpp index 46e646b6493..608471a4dc0 100644 --- a/searchlib/src/tests/ranksetup/ranksetup_test.cpp +++ b/searchlib/src/tests/ranksetup/ranksetup_test.cpp @@ -1,11 +1,6 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include - -#include -#include -#include - #include #include @@ -247,6 +242,7 @@ private: public: RankSetupTest(); + ~RankSetupTest(); int Main() override; }; @@ -903,6 +899,7 @@ RankSetupTest::RankSetupTest() : _queryEnv.overrideAttributeManager(&_manager); } +RankSetupTest::~RankSetupTest() {} int RankSetupTest::Main() -- cgit v1.2.3