summaryrefslogtreecommitdiffstats
path: root/searchlib/src/tests
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2020-10-07 11:16:08 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2020-10-07 11:16:35 +0000
commit9bb9d8e14827ecc4dba2d43e2d9e76248c120e1d (patch)
tree9e64c1471c0391410c824f75e2dc1fbfa8585229 /searchlib/src/tests
parentf2e89d3361cae0e2e74bac89405a175d6ecf5e98 (diff)
Add noexcept as indicated by -Wnoeexcept
Diffstat (limited to 'searchlib/src/tests')
-rw-r--r--searchlib/src/tests/attribute/posting_list_merger/posting_list_merger_test.cpp12
-rw-r--r--searchlib/src/tests/attribute/searchable/attribute_searchable_adapter_test.cpp9
-rw-r--r--searchlib/src/tests/memoryindex/field_index_remover/field_index_remover_test.cpp4
-rw-r--r--searchlib/src/tests/query/querybuilder_test.cpp4
-rw-r--r--searchlib/src/tests/queryeval/predicate/predicate_blueprint_test.cpp8
-rw-r--r--searchlib/src/tests/transactionlog/chunks_test.cpp2
-rw-r--r--searchlib/src/tests/transactionlog/translogclient_test.cpp2
7 files changed, 21 insertions, 20 deletions
diff --git a/searchlib/src/tests/attribute/posting_list_merger/posting_list_merger_test.cpp b/searchlib/src/tests/attribute/posting_list_merger/posting_list_merger_test.cpp
index 99b22e02e2e..5976b02c5cf 100644
--- a/searchlib/src/tests/attribute/posting_list_merger/posting_list_merger_test.cpp
+++ b/searchlib/src/tests/attribute/posting_list_merger/posting_list_merger_test.cpp
@@ -11,17 +11,17 @@ using search::attribute::PostingListMerger;
struct Posting {
uint32_t lid;
int32_t weight;
- Posting(uint32_t lid_, int32_t weight_)
+ Posting(uint32_t lid_, int32_t weight_) noexcept
: lid(lid_),
weight(weight_)
{
}
- bool operator==(const Posting &rhs) const {
+ bool operator==(const Posting &rhs) const noexcept {
return ((lid == rhs.lid) && (weight == rhs.weight));
}
- bool operator<(const Posting &rhs) const { return lid < rhs.lid; }
+ bool operator<(const Posting &rhs) const noexcept { return lid < rhs.lid; }
};
std::ostream &operator<<(std::ostream &os, const Posting &posting)
@@ -35,11 +35,11 @@ class WeightedPostingList
{
std::vector<Posting> _entries;
public:
- WeightedPostingList(std::vector<Posting> entries)
+ WeightedPostingList(std::vector<Posting> entries) noexcept
: _entries(std::move(entries))
{
}
- ~WeightedPostingList() { }
+ ~WeightedPostingList() = default;
template <typename Func>
void foreach(Func func) const {
@@ -67,7 +67,7 @@ struct WeightedFixture
{
}
- ~WeightedFixture() { }
+ ~WeightedFixture() = default;
void reserveArray(uint32_t postingsCount, size_t postingsSize) { _merger.reserveArray(postingsCount, postingsSize); }
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 87aea2e3e8c..7328fe2c7ff 100644
--- a/searchlib/src/tests/attribute/searchable/attribute_searchable_adapter_test.cpp
+++ b/searchlib/src/tests/attribute/searchable/attribute_searchable_adapter_test.cpp
@@ -140,8 +140,9 @@ struct Result {
uint32_t docid;
double raw_score;
int32_t match_weight;
- Hit(uint32_t id, double raw, int32_t match_weight_in)
- : docid(id), raw_score(raw), match_weight(match_weight_in) {}
+ Hit(uint32_t id, double raw, int32_t match_weight_in) noexcept
+ : docid(id), raw_score(raw), match_weight(match_weight_in)
+ {}
};
size_t est_hits;
bool est_empty;
@@ -590,7 +591,7 @@ TEST("require that attribute weighted set term works") {
TEST("require that predicate query in non-predicate field yields empty.") {
MyAttributeManager attribute_manager = makeAttributeManager("foo");
- PredicateQueryTerm::UP term(new PredicateQueryTerm);
+ auto term = std::make_unique<PredicateQueryTerm>();
SimplePredicateQuery node(std::move(term), field, 0, Weight(1));
Result result = do_search(attribute_manager, node, true);
EXPECT_TRUE(result.est_empty);
@@ -605,7 +606,7 @@ TEST("require that predicate query in predicate field yields results.") {
const_cast<PredicateAttribute::IntervalRange *>(attr->getIntervalRangeVector())[2] = 1u;
MyAttributeManager attribute_manager(attr);
- PredicateQueryTerm::UP term(new PredicateQueryTerm);
+ auto term = std::make_unique<PredicateQueryTerm>();
SimplePredicateQuery node(std::move(term), field, 0, Weight(1));
Result result = do_search(attribute_manager, node, true);
EXPECT_FALSE(result.est_empty);
diff --git a/searchlib/src/tests/memoryindex/field_index_remover/field_index_remover_test.cpp b/searchlib/src/tests/memoryindex/field_index_remover/field_index_remover_test.cpp
index af7ea9be481..584a8121b16 100644
--- a/searchlib/src/tests/memoryindex/field_index_remover/field_index_remover_test.cpp
+++ b/searchlib/src/tests/memoryindex/field_index_remover/field_index_remover_test.cpp
@@ -16,10 +16,10 @@ using namespace search::memoryindex;
struct WordFieldPair {
vespalib::string _word;
uint32_t _fieldId;
- WordFieldPair(vespalib::stringref word, uint32_t fieldId)
+ WordFieldPair(vespalib::stringref word, uint32_t fieldId) noexcept
: _word(word), _fieldId(fieldId)
{}
- bool operator<(const WordFieldPair &rhs) const {
+ bool operator<(const WordFieldPair &rhs) const noexcept {
if (_word != rhs._word) {
return _word < rhs._word;
}
diff --git a/searchlib/src/tests/query/querybuilder_test.cpp b/searchlib/src/tests/query/querybuilder_test.cpp
index 269600d26d4..5a5a5eafb2c 100644
--- a/searchlib/src/tests/query/querybuilder_test.cpp
+++ b/searchlib/src/tests/query/querybuilder_test.cpp
@@ -38,7 +38,7 @@ const uint32_t x_aspect = 0;
const Location location(position, max_distance, x_aspect);
PredicateQueryTerm::UP getPredicateQueryTerm() {
- PredicateQueryTerm::UP pqt(new PredicateQueryTerm);
+ auto pqt = std::make_unique<PredicateQueryTerm>();
pqt->addFeature("key", "value");
pqt->addRangeFeature("key2", 42, 0xfff);
return pqt;
@@ -242,7 +242,7 @@ void checkQueryTreeTypes(Node *node) {
EXPECT_TRUE(checkTerm(string_term, str[5], view[5], id[5], weight[5]));
auto* predicateQuery = as_node<PredicateQuery>(and_node->getChildren()[5]);
- PredicateQueryTerm::UP pqt(new PredicateQueryTerm);
+ auto pqt = std::make_unique<PredicateQueryTerm>();
EXPECT_TRUE(checkTerm(predicateQuery, getPredicateQueryTerm(), view[3], id[3], weight[3]));
auto* dotProduct = as_node<DotProduct>(and_node->getChildren()[6]);
diff --git a/searchlib/src/tests/queryeval/predicate/predicate_blueprint_test.cpp b/searchlib/src/tests/queryeval/predicate/predicate_blueprint_test.cpp
index 28b0d103040..3dd2ec26dea 100644
--- a/searchlib/src/tests/queryeval/predicate/predicate_blueprint_test.cpp
+++ b/searchlib/src/tests/queryeval/predicate/predicate_blueprint_test.cpp
@@ -40,9 +40,9 @@ struct Fixture {
Fixture()
: field(42, 0),
- attribute(new PredicateAttribute("f", attribute::Config(attribute::BasicType::PREDICATE))),
- query(PredicateQueryTerm::UP(new PredicateQueryTerm),
- "view", 0, Weight(1)) {
+ attribute(std::make_shared<PredicateAttribute>("f", attribute::Config(attribute::BasicType::PREDICATE))),
+ query(std::make_unique<PredicateQueryTerm>(),"view", 0, Weight(1))
+ {
query.getTerm()->addFeature("key", "value");
query.getTerm()->addRangeFeature("range_key", 42);
}
@@ -219,7 +219,7 @@ TEST_F("require that blueprint can set up search with subqueries", Fixture) {
std::vector<Interval>{{0x0002ffff}};
f.indexDocument(doc_id, annotations);
- SimplePredicateQuery query(PredicateQueryTerm::UP(new PredicateQueryTerm),
+ SimplePredicateQuery query(std::make_unique<PredicateQueryTerm>(),
"view", 0, Weight(1));
query.getTerm()->addFeature("key", "value", 1);
query.getTerm()->addFeature("key2", "value", 2);
diff --git a/searchlib/src/tests/transactionlog/chunks_test.cpp b/searchlib/src/tests/transactionlog/chunks_test.cpp
index 4a74dd7f5bc..a3cf9f8bd92 100644
--- a/searchlib/src/tests/transactionlog/chunks_test.cpp
+++ b/searchlib/src/tests/transactionlog/chunks_test.cpp
@@ -79,7 +79,7 @@ TEST("test empty commitchunk") {
struct Counter : public search::IDestructorCallback {
std::atomic<uint32_t> & _counter;
- Counter(std::atomic<uint32_t> & counter) : _counter(counter) { _counter++; }
+ Counter(std::atomic<uint32_t> & counter) noexcept : _counter(counter) { _counter++; }
~Counter() override { _counter--; }
};
diff --git a/searchlib/src/tests/transactionlog/translogclient_test.cpp b/searchlib/src/tests/transactionlog/translogclient_test.cpp
index fffb70467a3..e097eebd42c 100644
--- a/searchlib/src/tests/transactionlog/translogclient_test.cpp
+++ b/searchlib/src/tests/transactionlog/translogclient_test.cpp
@@ -311,7 +311,7 @@ using Counter = std::atomic<size_t>;
class CountDone : public IDestructorCallback {
public:
- explicit CountDone(Counter & inFlight) : _inFlight(inFlight) { ++_inFlight; }
+ explicit CountDone(Counter & inFlight) noexcept : _inFlight(inFlight) { ++_inFlight; }
~CountDone() override { --_inFlight; }
private:
Counter & _inFlight;