aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTor Egge <Tor.Egge@online.no>2022-04-25 11:42:29 +0200
committerTor Egge <Tor.Egge@online.no>2022-04-25 11:43:23 +0200
commiteed0423f9bb4719e2e37d72b2fcc42acaa5e76b1 (patch)
treeb589771481d9553c94ae271292c64c902bc1e5ad
parent989ffbd7a9a7b5aecb4256de76f07c23f899f40c (diff)
Avoid bitwise and with boolean arguments.
-rw-r--r--searchlib/src/tests/query/querybuilder_test.cpp30
1 files changed, 23 insertions, 7 deletions
diff --git a/searchlib/src/tests/query/querybuilder_test.cpp b/searchlib/src/tests/query/querybuilder_test.cpp
index 5b410879fa0..aad632fdb70 100644
--- a/searchlib/src/tests/query/querybuilder_test.cpp
+++ b/searchlib/src/tests/query/querybuilder_test.cpp
@@ -138,13 +138,29 @@ template <class Term>
bool checkTerm(const Term *term, const typename Term::Type &t, const string &f,
int32_t i, Weight w, bool ranked = true,
bool use_position_data = true) {
- return EXPECT_TRUE(term != 0) &&
- (EXPECT_TRUE(compareTerms(t, term->getTerm())) &
- EXPECT_EQUAL(f, term->getView()) &
- EXPECT_EQUAL(i, term->getId()) &
- EXPECT_EQUAL(w.percent(), term->getWeight().percent()) &
- EXPECT_EQUAL(ranked, term->isRanked()) &
- EXPECT_EQUAL(use_position_data, term->usePositionData()));
+ if (!EXPECT_TRUE(term != nullptr)) {
+ return false;
+ }
+ bool result = true;
+ if (!EXPECT_TRUE(compareTerms(t, term->getTerm()))) {
+ result = false;
+ }
+ if (!EXPECT_EQUAL(f, term->getView())) {
+ result = false;
+ }
+ if (!EXPECT_EQUAL(i, term->getId())) {
+ result = false;
+ }
+ if (!EXPECT_EQUAL(w.percent(), term->getWeight().percent())) {
+ result = false;
+ }
+ if (!EXPECT_EQUAL(ranked, term->isRanked())) {
+ result = false;
+ }
+ if (!EXPECT_EQUAL(use_position_data, term->usePositionData())) {
+ result = false;
+ }
+ return result;
}
template <class NodeType>