summaryrefslogtreecommitdiffstats
path: root/searchlib/src/tests/memoryindex
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2023-01-30 16:06:53 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2023-01-30 16:06:53 +0000
commit652f2a7d7cdea301574bae20a5149e587389f672 (patch)
tree5c848e96e817fbaa243f32d3b20c4ae88705f457 /searchlib/src/tests/memoryindex
parente2d42bca66c0fdeee60e3c21a2517c9cb80efe6b (diff)
GC som compiler pragmas not needed anymore.
Diffstat (limited to 'searchlib/src/tests/memoryindex')
-rw-r--r--searchlib/src/tests/memoryindex/field_index/field_index_test.cpp43
1 files changed, 25 insertions, 18 deletions
diff --git a/searchlib/src/tests/memoryindex/field_index/field_index_test.cpp b/searchlib/src/tests/memoryindex/field_index/field_index_test.cpp
index 5f8b6b2df48..76056029f78 100644
--- a/searchlib/src/tests/memoryindex/field_index/field_index_test.cpp
+++ b/searchlib/src/tests/memoryindex/field_index/field_index_test.cpp
@@ -76,7 +76,7 @@ private:
bool _firstDoc;
public:
- MyBuilder(const Schema &schema)
+ explicit MyBuilder(const Schema &schema)
: IndexBuilder(schema),
_ss(),
_insideWord(false),
@@ -159,9 +159,11 @@ struct SimpleMatchData {
SimpleMatchData() : term(), array() {
array.add(&term);
}
- ~SimpleMatchData() {}
+ ~SimpleMatchData();
};
+SimpleMatchData::~SimpleMatchData() = default;
+
std::string
toString(const SimpleMatchData& match_data,
bool hasElements = false,
@@ -266,6 +268,7 @@ class MockFieldIndex {
uint32_t _fieldId;
public:
+ MockFieldIndex();
~MockFieldIndex();
void
setNextWord(const vespalib::string &word) {
@@ -301,6 +304,12 @@ public:
}
};
+MockFieldIndex::MockFieldIndex()
+ : _dict(),
+ _word(),
+ _fieldId()
+{}
+
MockFieldIndex::~MockFieldIndex() = default;
/**
@@ -337,7 +346,7 @@ class MyInserter {
IOrderedFieldIndexInserter *_inserter;
public:
- MyInserter(const Schema &schema)
+ explicit MyInserter(const Schema &schema)
: _wordStoreScan(),
_mock(),
_fieldIndexes(schema, MockFieldLengthInspector()),
@@ -427,15 +436,15 @@ myremove(uint32_t docId, DocumentInverter &inv)
class MyDrainRemoves : IFieldIndexRemoveListener {
FieldIndexRemover &_remover;
public:
- virtual void remove(const vespalib::stringref, uint32_t) override { }
+ void remove(const vespalib::stringref, uint32_t) override { }
MyDrainRemoves(FieldIndexCollection &fieldIndexes, uint32_t fieldId)
: _remover(fieldIndexes.getFieldIndex(fieldId)->getDocumentRemover())
{
}
- MyDrainRemoves(IFieldIndex& field_index)
- : _remover(field_index.getDocumentRemover())
+ explicit MyDrainRemoves(IFieldIndex& field_index)
+ : _remover(field_index.getDocumentRemover())
{
}
@@ -532,22 +541,20 @@ struct FieldIndexTest : public ::testing::Test {
idx(schema, 0)
{
}
- ~FieldIndexTest() {}
+ ~FieldIndexTest() override;
SearchIterator::UP search(const vespalib::stringref word,
const SimpleMatchData& match_data) {
return make_search_iterator<FieldIndexType::has_interleaved_features>(idx.find(word), idx.getFeatureStore(), 0, match_data.array);
}
};
+template <typename FieldIndexType>
+FieldIndexTest<FieldIndexType>::~FieldIndexTest() = default;
+
+
using FieldIndexTestTypes = ::testing::Types<FieldIndex<false>, FieldIndex<true>>;
TYPED_TEST_SUITE(FieldIndexTest, FieldIndexTestTypes);
-// Disable warnings emitted by gtest generated files when using typed tests
-#pragma GCC diagnostic push
-#ifndef __clang__
-#pragma GCC diagnostic ignored "-Wsuggest-override"
-#endif
-
TYPED_TEST(FieldIndexTest, require_that_fresh_insert_works)
{
EXPECT_TRUE(assertPostingList("[]", this->idx.find("a")));
@@ -646,8 +653,6 @@ TYPED_TEST(FieldIndexTest, require_that_posting_iterator_is_working)
}
}
-#pragma GCC diagnostic pop
-
struct FieldIndexInterleavedFeaturesTest : public FieldIndexTest<FieldIndex<true>> {
SimpleMatchData match_data;
FieldIndexInterleavedFeaturesTest()
@@ -732,14 +737,16 @@ struct FieldIndexCollectionTest : public ::testing::Test {
fic(schema, MockFieldLengthInspector())
{
}
- ~FieldIndexCollectionTest() {}
+ ~FieldIndexCollectionTest();
- NormalFieldIndex::PostingList::Iterator find(const vespalib::stringref word,
- uint32_t field_id) const {
+ [[nodiscard]]NormalFieldIndex::PostingList::Iterator
+ find(const vespalib::stringref word, uint32_t field_id) const {
return find_in_field_index<false>(word, field_id, fic);
}
};
+FieldIndexCollectionTest::~FieldIndexCollectionTest() = default;
+
TEST_F(FieldIndexCollectionTest, require_that_multiple_posting_lists_across_multiple_fields_can_exist)
{
WrapInserter(fic, 0).word("a").add(10).word("b").add(11).add(15).flush();