aboutsummaryrefslogtreecommitdiffstats
path: root/searchlib/src/tests/attribute
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2017-03-09 13:35:46 +0100
committerHenning Baldersheim <balder@yahoo-inc.com>2017-03-09 13:35:46 +0100
commit27821c298d6f61b025e400812cdd71871c1e3982 (patch)
tree377a8ae20b41f46631db2098c1b8eb41f477bce9 /searchlib/src/tests/attribute
parent7f3e8265707321bf3156e2fe4d4f6e56d17ed557 (diff)
Deinline destructorsi and use -Winline gcc option.
Diffstat (limited to 'searchlib/src/tests/attribute')
-rw-r--r--searchlib/src/tests/attribute/imported_attribute_vector/imported_attribute_vector_test.cpp21
-rw-r--r--searchlib/src/tests/attribute/searchable/attribute_searchable_adapter_test.cpp46
-rw-r--r--searchlib/src/tests/attribute/searchcontext/searchcontext.cpp50
3 files changed, 78 insertions, 39 deletions
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 62b337bfc59..5ed1b62bfb0 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
@@ -73,14 +73,8 @@ struct Fixture {
std::shared_ptr<ImportedAttributeVector> imported_attr;
std::shared_ptr<MockGidToLidMapperFactory> mapper_factory;
- Fixture()
- : target_attr(create_single_attribute<IntegerAttribute>(BasicType::INT32)),
- reference_attr(create_reference_attribute()),
- imported_attr(create_attribute_vector_from_members()),
- mapper_factory(std::make_shared<MockGidToLidMapperFactory>())
- {
- reference_attr->setGidToLidMapperFactory(mapper_factory);
- }
+ Fixture();
+ ~Fixture();
void map_reference(DocId from_lid, GlobalId via_gid, DocId to_lid) {
assert(from_lid < reference_attr->getNumDocs());
@@ -178,6 +172,17 @@ struct Fixture {
}
};
+Fixture::Fixture()
+ : target_attr(create_single_attribute<IntegerAttribute>(BasicType::INT32)),
+ reference_attr(create_reference_attribute()),
+ imported_attr(create_attribute_vector_from_members()),
+ mapper_factory(std::make_shared<MockGidToLidMapperFactory>())
+{
+ reference_attr->setGidToLidMapperFactory(mapper_factory);
+}
+
+Fixture::~Fixture() {}
+
template <typename AttrValueType, typename PredicateType>
void assert_multi_value_matches(const Fixture& f,
DocId lid,
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 f5b12d5c74c..a780cbbd229 100644
--- a/searchlib/src/tests/attribute/searchable/attribute_searchable_adapter_test.cpp
+++ b/searchlib/src/tests/attribute/searchable/attribute_searchable_adapter_test.cpp
@@ -79,17 +79,11 @@ class MyAttributeManager : public IAttributeManager {
AttributeVector::SP _other;
public:
- MyAttributeManager(MyAttributeManager && rhs) :
- IAttributeManager(),
- _attribute_vector(std::move(rhs._attribute_vector)),
- _other(std::move(rhs._other))
- {
- }
- explicit MyAttributeManager(AttributeVector *attr)
- : _attribute_vector(attr), _other() {}
+ MyAttributeManager(MyAttributeManager && rhs);
+ explicit MyAttributeManager(AttributeVector *attr);
- explicit MyAttributeManager(AttributeVector::SP attr)
- : _attribute_vector(attr), _other() {}
+ explicit MyAttributeManager(AttributeVector::SP attr);
+ ~MyAttributeManager();
void set_other(AttributeVector::SP attr) {
_other = attr;
@@ -143,11 +137,8 @@ struct Result {
std::vector<Hit> hits;
vespalib::string iterator_dump;
- Result(size_t est_hits_in, bool est_empty_in)
- : est_hits(est_hits_in), est_empty(est_empty_in),
- has_minmax(false), min_weight(0), max_weight(0),
- wand_hits(0), wand_initial_threshold(0), wand_boost_factor(0.0),
- hits(), iterator_dump() {}
+ Result(size_t est_hits_in, bool est_empty_in);
+ ~Result();
void set_minmax(int32_t min, int32_t max) {
has_minmax = true;
@@ -156,6 +147,31 @@ struct Result {
}
};
+Result::Result(size_t est_hits_in, bool est_empty_in)
+ : est_hits(est_hits_in), est_empty(est_empty_in), has_minmax(false), min_weight(0), max_weight(0), wand_hits(0),
+ wand_initial_threshold(0), wand_boost_factor(0.0), hits(), iterator_dump()
+{}
+
+Result::~Result() {}
+
+
+MyAttributeManager::MyAttributeManager(MyAttributeManager && rhs)
+ : IAttributeManager(),
+ _attribute_vector(std::move(rhs._attribute_vector)),
+ _other(std::move(rhs._other))
+{}
+MyAttributeManager::MyAttributeManager(AttributeVector *attr)
+ : _attribute_vector(attr),
+ _other()
+{}
+
+MyAttributeManager::MyAttributeManager(AttributeVector::SP attr)
+ : _attribute_vector(std::move(attr)),
+ _other()
+{}
+
+MyAttributeManager::~MyAttributeManager() {}
+
void extract_posting_info(Result &result, const PostingInfo *postingInfo) {
if (postingInfo != NULL) {
const MinMaxPostingInfo *minMax = dynamic_cast<const MinMaxPostingInfo *>(postingInfo);
diff --git a/searchlib/src/tests/attribute/searchcontext/searchcontext.cpp b/searchlib/src/tests/attribute/searchcontext/searchcontext.cpp
index 138e406c988..32da1743343 100644
--- a/searchlib/src/tests/attribute/searchcontext/searchcontext.cpp
+++ b/searchlib/src/tests/attribute/searchcontext/searchcontext.cpp
@@ -61,7 +61,8 @@ using fef::TermFieldMatchDataPosition;
class DocSet : public std::set<uint32_t>
{
public:
- DocSet() : std::set<uint32_t>() {}
+ DocSet();
+ ~DocSet();
DocSet(const uint32_t *b, const uint32_t *e) : std::set<uint32_t>(b, e) {}
DocSet & put(const uint32_t &v) {
insert(v);
@@ -69,6 +70,9 @@ public:
}
};
+DocSet::DocSet() : std::set<uint32_t>() {}
+DocSet::~DocSet() {}
+
template <typename V, typename T>
class PostingList
{
@@ -78,7 +82,8 @@ private:
DocSet _hits;
public:
- PostingList(V & vec, T value) : _vec(&vec), _value(value), _hits() {}
+ PostingList(V & vec, T value);
+ ~PostingList();
const V & getAttribute() const { return *_vec; }
V & getAttribute() { return *_vec; }
const T & getValue() const { return _value; }
@@ -87,6 +92,12 @@ public:
uint32_t getHitCount() const { return _hits.size(); }
};
+template <typename V, typename T>
+PostingList<V, T>::PostingList(V & vec, T value) : _vec(&vec), _value(value), _hits() {}
+
+template <typename V, typename T>
+PostingList<V, T>::~PostingList() {}
+
class DocRange
{
public:
@@ -608,20 +619,8 @@ void SearchContextTest::testSearch(const ConfigMap & cfgs) {
template<typename T, typename A>
class Verifier : public search::test::SearchIteratorVerifier {
public:
- Verifier(T key, const vespalib::string & keyAsString, const vespalib::string & name, const Config & cfg) :
- _attribute(AttributeFactory::createAttribute(name + "-initrange", cfg)),
- _sc()
- {
- SearchContextTest::addDocs(*_attribute, getDocIdLimit());
- for (uint32_t doc : getExpectedDocIds()) {
- EXPECT_TRUE(nullptr != dynamic_cast<A *>(_attribute.get()));
- EXPECT_TRUE(dynamic_cast<A *>(_attribute.get())->update(doc, key));
- }
- _attribute->commit(true);
- _sc = SearchContextTest::getSearch(*_attribute, keyAsString);
- ASSERT_TRUE(_sc->valid());
- _sc->fetchPostings(true);
- }
+ Verifier(T key, const vespalib::string & keyAsString, const vespalib::string & name, const Config & cfg);
+ ~Verifier();
SearchIterator::UP create(bool strict) const override {
return _sc->createIterator(&_dummy, strict);
}
@@ -632,6 +631,25 @@ private:
};
template<typename T, typename A>
+Verifier<T, A>::Verifier(T key, const vespalib::string & keyAsString, const vespalib::string & name, const Config & cfg)
+ :_attribute(AttributeFactory::createAttribute(name + "-initrange", cfg)),
+ _sc()
+{
+ SearchContextTest::addDocs(*_attribute, getDocIdLimit());
+ for (uint32_t doc : getExpectedDocIds()) {
+ EXPECT_TRUE(nullptr != dynamic_cast<A *>(_attribute.get()));
+ EXPECT_TRUE(dynamic_cast<A *>(_attribute.get())->update(doc, key));
+ }
+ _attribute->commit(true);
+ _sc = SearchContextTest::getSearch(*_attribute, keyAsString);
+ ASSERT_TRUE(_sc->valid());
+ _sc->fetchPostings(true);
+}
+
+template<typename T, typename A>
+Verifier<T, A>::~Verifier() {}
+
+template<typename T, typename A>
void SearchContextTest::testSearchIterator(T key, const vespalib::string &keyAsString, const ConfigMap &cfgs) {
for (const auto & cfg : cfgs) {