aboutsummaryrefslogtreecommitdiffstats
path: root/searchlib/src
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2018-12-19 11:43:29 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2018-12-19 12:10:01 +0000
commit0580f4d4571059d3513382f71e16c0e66363041d (patch)
tree3f5641c38f7f3cad0b4bfe040a6f8b5b2ff2c9a8 /searchlib/src
parent443ccdff7143a659761b0e295e8f2f2ad60715e2 (diff)
clion recommended cleanup while browsing test.
Diffstat (limited to 'searchlib/src')
-rw-r--r--searchlib/src/tests/attribute/attribute_test.cpp82
-rw-r--r--searchlib/src/tests/attribute/searchcontext/searchcontext.cpp64
2 files changed, 57 insertions, 89 deletions
diff --git a/searchlib/src/tests/attribute/attribute_test.cpp b/searchlib/src/tests/attribute/attribute_test.cpp
index 8637a230bf5..fd95a3716d3 100644
--- a/searchlib/src/tests/attribute/attribute_test.cpp
+++ b/searchlib/src/tests/attribute/attribute_test.cpp
@@ -180,15 +180,12 @@ private:
void testSingle();
// CollectionType::ARRAY
- template <typename BufferType>
- void printArray(const AttributePtr & ptr);
template <typename VectorType, typename BufferType>
void testArray(const AttributePtr & ptr, const std::vector<BufferType> & values);
void testArray();
// CollectionType::WSET
- template <typename BufferType>
- void printWeightedSet(const AttributePtr & ptr);
+
template <typename VectorType, typename BufferType>
void testWeightedSet(const AttributePtr & ptr, const std::vector<BufferType> & values);
void testWeightedSet();
@@ -245,10 +242,12 @@ private:
void testPendingCompaction();
public:
- AttributeTest() { }
+ AttributeTest();
int Main() override;
};
+AttributeTest::AttributeTest() = default;
+
void AttributeTest::testBaseName()
{
AttributeVector::BaseName v("attr1");
@@ -385,8 +384,8 @@ void AttributeTest::compare(VectorType & a, VectorType & b)
ASSERT_TRUE(a.getNumDocs() == b.getNumDocs());
uint32_t asz(a.getMaxValueCount());
uint32_t bsz(b.getMaxValueCount());
- BufferType *av = new BufferType[asz];
- BufferType *bv = new BufferType[bsz];
+ auto *av = new BufferType[asz];
+ auto *bv = new BufferType[bsz];
for (size_t i(0), m(a.getNumDocs()); i < m; i++) {
ASSERT_TRUE(asz >= static_cast<uint32_t>(a.getValueCount(i)));
@@ -780,7 +779,7 @@ AttributeTest::fillString(std::vector<string> & values, uint32_t numValues)
for (uint32_t i = 0; i < numValues; ++i) {
vespalib::asciistream ss;
ss << "string" << (i < 10 ? "0" : "") << i;
- values.push_back(ss.str());
+ values.emplace_back(ss.str());
}
}
@@ -833,7 +832,7 @@ void
AttributeTest::testSingle(const AttributePtr & ptr, const std::vector<BufferType> & values)
{
LOG(info, "testSingle: vector '%s' with %u documents and %lu values",
- ptr->getName().c_str(), ptr->getNumDocs(), static_cast<unsigned long>(values.size()));
+ ptr->getName().c_str(), ptr->getNumDocs(), values.size());
VectorType & v = *(static_cast<VectorType *>(ptr.get()));
uint32_t numUniques = values.size();
@@ -966,7 +965,7 @@ void
AttributeTest::testArray(const AttributePtr & ptr, const std::vector<BufferType> & values)
{
LOG(info, "testArray: vector '%s' with %i documents and %lu values",
- ptr->getName().c_str(), ptr->getNumDocs(), static_cast<unsigned long>(values.size()));
+ ptr->getName().c_str(), ptr->getNumDocs(), values.size());
VectorType & v = *(static_cast<VectorType *>(ptr.get()));
uint32_t numUniques = values.size();
@@ -1069,21 +1068,6 @@ AttributeTest::testArray(const AttributePtr & ptr, const std::vector<BufferType>
EXPECT_TRUE(!v.clearDoc(ptr->getNumDocs()));
}
-template <typename BufferType>
-void
-AttributeTest::printArray(const AttributePtr & ptr)
-{
- uint32_t bufferSize = ptr->getMaxValueCount();
- std::vector<BufferType> buffer(bufferSize);
- for (uint32_t doc = 0; doc < ptr->getNumDocs(); ++doc) {
- uint32_t valueCount = ptr->get(doc, &buffer[0], buffer.size());
- for (uint32_t i = 0; i < valueCount; ++i) {
- std::cout << "doc[" << doc << "][" << i << "] = " << buffer[i]
- << std::endl;
- }
- }
-}
-
void
AttributeTest::testArray()
{
@@ -1151,26 +1135,12 @@ AttributeTest::testArray()
// CollectionType::WSET
//-----------------------------------------------------------------------------
-template <typename BufferType>
-void
-AttributeTest::printWeightedSet(const AttributePtr & ptr)
-{
- std::vector<BufferType> buffer(ptr->getMaxValueCount());
- for (uint32_t doc = 0; doc < ptr->getNumDocs(); ++doc) {
- uint32_t valueCount = ptr->get(doc, &buffer[0], buffer.size());
- for (uint32_t i = 0; i < valueCount; ++i) {
- std::cout << "doc[" << doc << "][" << i << "] = {" << buffer[i].getValue()
- << ", " << buffer[i].getWeight() << "}" << std::endl;
- }
- }
-}
-
template <typename VectorType, typename BufferType>
void
AttributeTest::testWeightedSet(const AttributePtr & ptr, const std::vector<BufferType> & values)
{
LOG(info, "testWeightedSet: vector '%s' with %u documents and %lu values",
- ptr->getName().c_str(), ptr->getNumDocs(), static_cast<unsigned long>(values.size()));
+ ptr->getName().c_str(), ptr->getNumDocs(),values.size());
VectorType & v = *(static_cast<VectorType *>(ptr.get()));
uint32_t numDocs = v.getNumDocs();
@@ -1259,7 +1229,7 @@ AttributeTest::testWeightedSet()
std::vector<AttributeVector::WeightedInt> values;
values.reserve(numValues);
for (uint32_t i = 0; i < numValues; ++i) {
- values.push_back(AttributeVector::WeightedInt(i, i + numValues));
+ values.emplace_back(i, i + numValues);
}
{
@@ -1284,7 +1254,7 @@ AttributeTest::testWeightedSet()
std::vector<AttributeVector::WeightedFloat> values;
values.reserve(numValues);
for (uint32_t i = 0; i < numValues; ++i) {
- values.push_back(AttributeVector::WeightedFloat(i, i + numValues));
+ values.emplace_back(i, i + numValues);
}
{
@@ -1311,7 +1281,7 @@ AttributeTest::testWeightedSet()
for (uint32_t i = 0; i < numValues; ++i) {
vespalib::asciistream ss;
ss << "string" << (i < 10 ? "0" : "") << i;
- values.push_back(AttributeVector::WeightedString(ss.str(), i + numValues));
+ values.emplace_back(ss.str(), i + numValues);
}
{
@@ -1340,7 +1310,7 @@ AttributeTest::testArithmeticValueUpdate(const AttributePtr & ptr)
LOG(info, "testArithmeticValueUpdate: vector '%s'", ptr->getName().c_str());
typedef document::ArithmeticValueUpdate Arith;
- VectorType & vec = static_cast<VectorType &>(*ptr.get());
+ auto & vec = static_cast<VectorType &>(*ptr.get());
addDocs(ptr, 13);
EXPECT_EQUAL(ptr->getStatus().getUpdateCount(), 0u);
EXPECT_EQUAL(ptr->getStatus().getNonIdempotentUpdateCount(), 0u);
@@ -1509,7 +1479,7 @@ AttributeTest::testArithmeticWithUndefinedValue(const AttributePtr & ptr, BaseTy
LOG(info, "testArithmeticWithUndefinedValue: vector '%s'", ptr->getName().c_str());
typedef document::ArithmeticValueUpdate Arith;
- VectorType & vec = static_cast<VectorType &>(*ptr.get());
+ auto & vec = static_cast<VectorType &>(*ptr.get());
addDocs(ptr, 1);
ASSERT_TRUE(vec.update(0, before));
ptr->commit();
@@ -1557,7 +1527,7 @@ AttributeTest::testMapValueUpdate(const AttributePtr & ptr, BufferType initValue
LOG(info, "testMapValueUpdate: vector '%s'", ptr->getName().c_str());
typedef MapValueUpdate MapVU;
typedef ArithmeticValueUpdate ArithVU;
- VectorType & vec = static_cast<VectorType &>(*ptr.get());
+ auto & vec = static_cast<VectorType &>(*ptr.get());
addDocs(ptr, 6);
for (uint32_t doc = 0; doc < 6; ++doc) {
@@ -1708,7 +1678,7 @@ AttributeTest::testStatus()
Config cfg(BasicType::STRING, CollectionType::ARRAY);
AttributePtr ptr = createAttribute("as", cfg);
addDocs(ptr, numDocs);
- StringAttribute & sa = *(static_cast<StringAttribute *>(ptr.get()));
+ auto & sa = *(static_cast<StringAttribute *>(ptr.get()));
for (uint32_t i = 0; i < numDocs; ++i) {
EXPECT_TRUE(appendToVector(sa, i, 1, values));
}
@@ -1729,7 +1699,7 @@ AttributeTest::testStatus()
Config cfg(BasicType::STRING, CollectionType::ARRAY);
AttributePtr ptr = createAttribute("as", cfg);
addDocs(ptr, numDocs);
- StringAttribute & sa = *(static_cast<StringAttribute *>(ptr.get()));
+ auto & sa = *(static_cast<StringAttribute *>(ptr.get()));
const size_t numUniq(16);
const size_t numValuesPerDoc(16);
for (uint32_t i = 0; i < numDocs; ++i) {
@@ -1785,7 +1755,7 @@ AttributeTest::testNullProtection()
AttributeVector::DocId docId;
std::vector<string> buf(16);
AttributePtr attr = createAttribute("string", Config(BasicType::STRING, CollectionType::ARRAY));
- StringAttribute &v = static_cast<StringAttribute &>(*attr.get());
+ auto &v = static_cast<StringAttribute &>(*attr.get());
EXPECT_TRUE(v.addDoc(docId));
EXPECT_TRUE(v.append(0, good, 1));
EXPECT_TRUE(v.append(0, evil, 1));
@@ -1801,7 +1771,7 @@ AttributeTest::testNullProtection()
AttributeVector::DocId docId;
std::vector<StringAttribute::WeightedString> buf(16);
AttributePtr attr = createAttribute("string", Config(BasicType::STRING, CollectionType::WSET));
- StringAttribute &v = static_cast<StringAttribute &>(*attr.get());
+ auto &v = static_cast<StringAttribute &>(*attr.get());
EXPECT_TRUE(v.addDoc(docId));
EXPECT_TRUE(v.append(0, good, 10));
EXPECT_TRUE(v.append(0, evil, 20));
@@ -1830,7 +1800,7 @@ void
AttributeTest::testGeneration(const AttributePtr & attr, bool exactStatus)
{
LOG(info, "testGeneration(%s)", attr->getName().c_str());
- IntegerAttribute & ia = static_cast<IntegerAttribute &>(*attr.get());
+ auto & ia = static_cast<IntegerAttribute &>(*attr.get());
// add docs to trigger inc generation when data vector is full
AttributeVector::DocId docId;
EXPECT_EQUAL(0u, ia.getCurrentGeneration());
@@ -1990,12 +1960,12 @@ AttributeTest::testCompactLidSpace(const Config &config,
vespalib::string name = clsDir + "/" + bts + "-" + cts + fas + ess;
LOG(info, "testCompactLidSpace(%s)", name.c_str());
AttributePtr attr = AttributeFactory::createAttribute(name, cfg);
- VectorType &v = static_cast<VectorType &>(*attr.get());
+ auto &v = static_cast<VectorType &>(*attr.get());
attr->enableEnumeratedSave(es);
attr->addDocs(highDocs);
populate(v, 17);
AttributePtr attr2 = AttributeFactory::createAttribute(name, cfg);
- VectorType &v2 = static_cast<VectorType &>(*attr2.get());
+ auto &v2 = static_cast<VectorType &>(*attr2.get());
attr2->enableEnumeratedSave(es);
attr2->addDocs(trimmedDocs);
populate(v2, 17);
@@ -2013,7 +1983,7 @@ AttributeTest::testCompactLidSpace(const Config &config,
EXPECT_TRUE(attr3->load());
EXPECT_EQUAL(trimmedDocs, attr3->getNumDocs());
EXPECT_EQUAL(trimmedDocs, attr3->getCommittedDocIdLimit());
- VectorType &v3 = static_cast<VectorType &>(*attr3.get());
+ auto &v3 = static_cast<VectorType &>(*attr3.get());
compare<VectorType, BufferType>(v2, v3);
attr->shrinkLidSpace();
EXPECT_EQUAL(trimmedDocs, attr->getNumDocs());
@@ -2179,7 +2149,7 @@ AttributeTest::testReaderDuringLastUpdate(const Config &config, bool fs, bool co
LOG(info, "testReaderDuringLastUpdate(%s)", name.c_str());
AttributePtr attr = AttributeFactory::createAttribute(name, cfg);
- AttributeType &v = static_cast<AttributeType &>(*attr.get());
+ auto &v = static_cast<AttributeType &>(*attr.get());
constexpr uint32_t numDocs = 200;
AttributeGuard guard;
if (!compact) {
@@ -2233,7 +2203,7 @@ AttributeTest::testPendingCompaction()
Config cfg(BasicType::INT32, CollectionType::SINGLE);
cfg.setFastSearch(true);
AttributePtr v = createAttribute("sfsint32_pc", cfg);
- IntegerAttribute &iv = static_cast<IntegerAttribute &>(*v.get());
+ auto &iv = static_cast<IntegerAttribute &>(*v.get());
addClearedDocs(v, 1000); // first compaction, success
AttributeGuard guard1(v);
populateSimple(iv, 1, 3); // 2nd compaction, success
diff --git a/searchlib/src/tests/attribute/searchcontext/searchcontext.cpp b/searchlib/src/tests/attribute/searchcontext/searchcontext.cpp
index d0dc7044fb5..574b8f34caf 100644
--- a/searchlib/src/tests/attribute/searchcontext/searchcontext.cpp
+++ b/searchlib/src/tests/attribute/searchcontext/searchcontext.cpp
@@ -164,7 +164,7 @@ private:
class IteratorTester {
public:
virtual bool matches(const SearchIterator & base) const = 0;
- virtual ~IteratorTester() { }
+ virtual ~IteratorTester() = default;
};
class AttributeIteratorTester : public IteratorTester
{
@@ -278,7 +278,7 @@ private:
public:
SearchContextTest();
- ~SearchContextTest();
+ ~SearchContextTest() override;
int Main() override;
};
@@ -322,7 +322,7 @@ SearchContextTest::fillVector(std::vector<vespalib::string> & values, size_t num
for (size_t i = 0; i < numValues; ++i) {
vespalib::asciistream ss;
ss << "string" << (i < 10 ? "0" : "") << i;
- values.push_back(ss.str());
+ values.emplace_back(ss.str());
}
}
@@ -370,7 +370,7 @@ template <typename V, typename T>
void
SearchContextTest::fillPostingList(PostingList<V, T> & pl)
{
- AttributeVector & vec = dynamic_cast<AttributeVector &>(pl.getAttribute());
+ auto & vec = dynamic_cast<AttributeVector &>(pl.getAttribute());
pl.getHits().clear();
uint32_t sz = vec.getMaxValueCount();
T * buf = new T[sz];
@@ -472,7 +472,7 @@ SearchContextTest::checkResultSet(const ResultSet & rs, const DocSet & expected,
EXPECT_EQUAL(rs.getNumHits(), expected.size());
if (bitVector) {
const BitVector * vec = rs.getBitOverflow();
- if (expected.size() != 0) {
+ if ( ! expected.empty()) {
ASSERT_TRUE(vec != nullptr);
for (const auto & expect : expected) {
EXPECT_TRUE(vec->testBit(expect));
@@ -480,12 +480,10 @@ SearchContextTest::checkResultSet(const ResultSet & rs, const DocSet & expected,
}
} else {
const RankedHit * array = rs.getArray();
- if (expected.size() != 0) {
+ if ( ! expected.empty()) {
ASSERT_TRUE(array != nullptr);
uint32_t i = 0;
- for (DocSet::const_iterator iter = expected.begin();
- iter != expected.end(); ++iter, ++i)
- {
+ for (auto iter = expected.begin(); iter != expected.end(); ++iter, ++i) {
EXPECT_TRUE(array[i]._docId == *iter);
}
}
@@ -515,7 +513,7 @@ void
SearchContextTest::testSearch(V & attribute, uint32_t numDocs, const std::vector<T> & values)
{
LOG(info, "testSearch: vector '%s' with %u documents and %lu unique values",
- attribute.getName().c_str(), numDocs, static_cast<unsigned long>(values.size()));
+ attribute.getName().c_str(), numDocs, values.size());
// fill attribute vectors
addDocs(attribute, numDocs);
@@ -563,7 +561,7 @@ SearchContextTest::testMultiValueSearch(V & first, V & second, const std::vector
{
addDocs(first, second.getNumDocs());
LOG(info, "testMultiValueSearch: vector '%s' with %u documents and %lu unique values",
- first.getName().c_str(), first.getNumDocs(), static_cast<unsigned long>(values.size()));
+ first.getName().c_str(), first.getNumDocs(), values.size());
fillAttribute(first, values);
@@ -620,7 +618,7 @@ class Verifier : public search::test::SearchIteratorVerifier {
public:
Verifier(const std::vector<T> & keys, const vespalib::string & keyAsString, const vespalib::string & name,
const Config & cfg, bool withElementId);
- ~Verifier();
+ ~Verifier() override;
SearchIterator::UP
create(bool strict) const override {
_sc->fetchPostings(strict);
@@ -883,7 +881,7 @@ SearchContextTest::testSearchIterator()
Config cfg(BasicType::STRING, CollectionType::SINGLE);
cfg.setFastSearch(true);
AttributePtr ptr = AttributeFactory::createAttribute("sfs-string", cfg);
- StringAttribute * sa = dynamic_cast<StringAttribute *>(ptr.get());
+ auto * sa = dynamic_cast<StringAttribute *>(ptr.get());
addReservedDoc(*ptr);
ptr->addDocs(5);
sa->update(1, "three");
@@ -1111,7 +1109,7 @@ SearchContextTest::testRangeSearch(const AttributePtr & ptr, uint32_t numDocs, s
{
LOG(info, "testRangeSearch: vector '%s'", ptr->getName().c_str());
- VectorType & vec = dynamic_cast<VectorType &>(*ptr.get());
+ auto & vec = dynamic_cast<VectorType &>(*ptr.get());
addDocs(vec, numDocs);
@@ -1196,7 +1194,7 @@ SearchContextTest::testRangeSearchLimited()
Config cfg(BasicType::INT32, CollectionType::SINGLE);
cfg.setFastSearch(true);
AttributePtr ptr = AttributeFactory::createAttribute("limited-int32", cfg);
- IntegerAttribute & vec = dynamic_cast<IntegerAttribute &>(*ptr);
+ auto & vec = dynamic_cast<IntegerAttribute &>(*ptr);
addDocs(vec, values.size());
for (size_t i(1); i < values.size(); i++) {
EXPECT_TRUE(vec.update(i, values[i]));
@@ -1317,7 +1315,7 @@ SearchContextTest::testCaseInsensitiveSearch(const AttributePtr & ptr)
{
LOG(info, "testCaseInsensitiveSearch: vector '%s'", ptr->getName().c_str());
- StringAttribute & vec = dynamic_cast<StringAttribute &>(*ptr.get());
+ auto & vec = dynamic_cast<StringAttribute &>(*ptr.get());
uint32_t numDocs = 5 * 5;
addDocs(*ptr.get(), numDocs);
@@ -1378,7 +1376,7 @@ SearchContextTest::testRegexSearch(const AttributePtr & ptr)
{
LOG(info, "testRegexSearch: vector '%s'", ptr->getName().c_str());
- StringAttribute & vec = dynamic_cast<StringAttribute &>(*ptr.get());
+ auto & vec = dynamic_cast<StringAttribute &>(*ptr.get());
uint32_t numDocs = 6;
addDocs(*ptr.get(), numDocs);
@@ -1397,11 +1395,11 @@ SearchContextTest::testRegexSearch(const AttributePtr & ptr)
DocSet empty;
{
uint32_t docs[] = {1, 2, 3, 4, 5, 6};
- expected.push_back(DocSet(docs, docs + 6)); // "abc"
+ expected.emplace_back(docs, docs + 6); // "abc"
}
{
uint32_t docs[] = {2, 3};
- expected.push_back(DocSet(docs, docs + 2)); // "bc2de"
+ expected.emplace_back(docs, docs + 2); // "bc2de"
}
for (uint32_t i = 0; i < terms.size(); ++i) {
@@ -1444,7 +1442,7 @@ SearchContextTest::testPrefixSearch(const AttributePtr & ptr)
{
LOG(info, "testPrefixSearch: vector '%s'", ptr->getName().c_str());
- StringAttribute & vec = dynamic_cast<StringAttribute &>(*ptr.get());
+ auto & vec = dynamic_cast<StringAttribute &>(*ptr.get());
uint32_t numDocs = 6;
addDocs(*ptr.get(), numDocs);
@@ -1464,17 +1462,17 @@ SearchContextTest::testPrefixSearch(const AttributePtr & ptr)
DocSet empty;
{
uint32_t docs[] = {1, 2, 3, 4, 5, 6};
- expected.push_back(DocSet(docs, docs + 6)); // "pre"
+ expected.emplace_back(docs, docs + 6); // "pre"
}
{
uint32_t docs[] = {1, 2, 3};
- expected.push_back(DocSet(docs, docs + 3)); // "pref"
+ expected.emplace_back(docs, docs + 3); // "pref"
}
{
uint32_t docs[] = {4, 5, 6};
- expected.push_back(DocSet(docs, docs + 3)); // "prec"
+ expected.emplace_back(docs, docs + 3); // "prec"
}
- expected.push_back(DocSet()); // "prex"
+ expected.emplace_back(); // "prex"
for (uint32_t i = 0; i < 4; ++i) {
for (uint32_t j = 0; j < 3; ++j) {
@@ -1510,7 +1508,7 @@ SearchContextTest::requireThatSearchIsWorkingAfterClearDoc(const vespalib::strin
a->getName().c_str(), term.c_str());
addReservedDoc(*a);
a->addDocs(4);
- VectorType & v = dynamic_cast<VectorType &>(*a);
+ auto & v = dynamic_cast<VectorType &>(*a);
resetAttribute(v, startValue);
{
ResultSetPtr rs = performSearch(v, term);
@@ -1565,7 +1563,7 @@ SearchContextTest::requireThatSearchIsWorkingAfterLoadAndClearDoc(const vespalib
a->getName().c_str(), term.c_str());
addReservedDoc(*a);
a->addDocs(15);
- VectorType & va = dynamic_cast<VectorType &>(*a);
+ auto & va = dynamic_cast<VectorType &>(*a);
resetAttribute(va, startValue); // triggers vector vector in posting list (count 15)
AttributePtr b = AttributeFactory::createAttribute(name + "-save", cfg);
EXPECT_TRUE(a->save(b->getBaseFileName()));
@@ -1621,7 +1619,7 @@ SearchContextTest::requireThatSearchIsWorkingAfterUpdates(const vespalib::string
ValueType value2)
{
AttributePtr a = AttributeFactory::createAttribute(name, cfg);
- VectorType & va = dynamic_cast<VectorType &>(*a);
+ auto & va = dynamic_cast<VectorType &>(*a);
LOG(info, "requireThatSearchIsWorkingAfterUpdates: vector '%s'", a->getName().c_str());
addReservedDoc(*a);
a->addDocs(2);
@@ -1661,7 +1659,7 @@ SearchContextTest::requireThatFlagAttributeIsWorkingWhenNewDocsAreAdded()
{
cfg.setGrowStrategy(GrowStrategy::make(1, 0, 1));
AttributePtr a = AttributeFactory::createAttribute("flags", cfg);
- FlagAttribute & fa = dynamic_cast<FlagAttribute &>(*a);
+ auto & fa = dynamic_cast<FlagAttribute &>(*a);
addReservedDoc(fa);
fa.addDocs(1);
fa.append(1, 10, 1);
@@ -1696,7 +1694,7 @@ SearchContextTest::requireThatFlagAttributeIsWorkingWhenNewDocsAreAdded()
{
cfg.setGrowStrategy(GrowStrategy::make(4, 0, 4));
AttributePtr a = AttributeFactory::createAttribute("flags", cfg);
- FlagAttribute & fa = dynamic_cast<FlagAttribute &>(*a);
+ auto & fa = dynamic_cast<FlagAttribute &>(*a);
std::vector<uint32_t> exp50;
std::vector<uint32_t> exp60;
addReservedDoc(fa);
@@ -1739,7 +1737,7 @@ SearchContextTest::requireThatInvalidSearchTermGivesZeroHits(const vespalib::str
ValueType value)
{
AttributePtr a = AttributeFactory::createAttribute(name, cfg);
- VectorType & va = dynamic_cast<VectorType &>(*a);
+ auto & va = dynamic_cast<VectorType &>(*a);
LOG(info, "requireThatInvalidSearchTermGivesZeroHits: vector '%s'", a->getName().c_str());
addReservedDoc(*a);
a->addDocs(1);
@@ -1768,7 +1766,7 @@ SearchContextTest::requireThatFlagAttributeHandlesTheByteRange()
cfg.setFastSearch(true);
AttributePtr a = AttributeFactory::createAttribute("flags", cfg);
- FlagAttribute & fa = dynamic_cast<FlagAttribute &>(*a);
+ auto & fa = dynamic_cast<FlagAttribute &>(*a);
addReservedDoc(fa);
fa.addDocs(5);
fa.append(1, -128, 1);
@@ -1798,7 +1796,7 @@ SearchContextTest::requireThatOutOfBoundsSearchTermGivesZeroHits(const vespalib:
int64_t maxValue)
{
AttributePtr a = AttributeFactory::createAttribute(name, cfg);
- IntegerAttribute &ia = dynamic_cast<IntegerAttribute &>(*a);
+ auto &ia = dynamic_cast<IntegerAttribute &>(*a);
addReservedDoc(*a);
a->addDocs(1);
ia.update(1, maxValue);
@@ -1847,7 +1845,7 @@ SearchContextTest::requireThatSearchIteratorExposesSearchContext(const ConfigMap
vespalib::string attrName = cfg.first + attrSuffix;
AttributePtr attr = AttributeFactory::createAttribute(attrName, cfg.second);
addDocs(*attr, 2);
- AttributeType &concreteAttr = dynamic_cast<AttributeType &>(*attr);
+ auto &concreteAttr = dynamic_cast<AttributeType &>(*attr);
if (attr->hasMultiValue()) {
fillAttribute(concreteAttr, values);
} else {