aboutsummaryrefslogtreecommitdiffstats
path: root/searchlib/src/tests/attribute
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/attribute
parentf2e89d3361cae0e2e74bac89405a175d6ecf5e98 (diff)
Add noexcept as indicated by -Wnoeexcept
Diffstat (limited to 'searchlib/src/tests/attribute')
-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
2 files changed, 11 insertions, 10 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);