summaryrefslogtreecommitdiffstats
path: root/searchlib/src/tests/queryeval/blueprint
diff options
context:
space:
mode:
Diffstat (limited to 'searchlib/src/tests/queryeval/blueprint')
-rw-r--r--searchlib/src/tests/queryeval/blueprint/blueprint_test.cpp24
-rw-r--r--searchlib/src/tests/queryeval/blueprint/intermediate_blueprints_test.cpp2
2 files changed, 25 insertions, 1 deletions
diff --git a/searchlib/src/tests/queryeval/blueprint/blueprint_test.cpp b/searchlib/src/tests/queryeval/blueprint/blueprint_test.cpp
index 266dc6f8652..d556d997206 100644
--- a/searchlib/src/tests/queryeval/blueprint/blueprint_test.cpp
+++ b/searchlib/src/tests/queryeval/blueprint/blueprint_test.cpp
@@ -794,6 +794,30 @@ TEST("Control object sizes") {
EXPECT_EQUAL(88u, sizeof(LeafBlueprint));
}
+Blueprint::Options make_opts(bool sort_by_cost, bool allow_force_strict, bool keep_order) {
+ return Blueprint::Options().sort_by_cost(sort_by_cost).allow_force_strict(allow_force_strict).keep_order(keep_order);
+}
+
+void check_opts(bool sort_by_cost, bool allow_force_strict, bool keep_order) {
+ EXPECT_EQUAL(Blueprint::opt_sort_by_cost(), sort_by_cost);
+ EXPECT_EQUAL(Blueprint::opt_allow_force_strict(), allow_force_strict);
+ EXPECT_EQUAL(Blueprint::opt_keep_order(), keep_order);
+}
+
+TEST("Options binding and nesting") {
+ check_opts(false, false, false);
+ {
+ auto opts_guard1 = Blueprint::bind_opts(make_opts(true, true, false));
+ check_opts(true, true, false);
+ {
+ auto opts_guard2 = Blueprint::bind_opts(make_opts(false, false, true));
+ check_opts(false, false, true);
+ }
+ check_opts(true, true, false);
+ }
+ check_opts(false, false, false);
+}
+
TEST_MAIN() {
TEST_DEBUG("lhs.out", "rhs.out");
TEST_RUN_ALL();
diff --git a/searchlib/src/tests/queryeval/blueprint/intermediate_blueprints_test.cpp b/searchlib/src/tests/queryeval/blueprint/intermediate_blueprints_test.cpp
index 9338436348b..d3b6a90e5db 100644
--- a/searchlib/src/tests/queryeval/blueprint/intermediate_blueprints_test.cpp
+++ b/searchlib/src/tests/queryeval/blueprint/intermediate_blueprints_test.cpp
@@ -579,7 +579,7 @@ optimize_and_compare(Blueprint::UP top, Blueprint::UP expect, bool strict = true
top->setDocIdLimit(1000);
expect->setDocIdLimit(1000);
TEST_DO(compare(*top, *expect, false));
- auto opts = Blueprint::Options::default_options().sort_by_cost(sort_by_cost);
+ auto opts = Blueprint::Options().sort_by_cost(sort_by_cost);
top = Blueprint::optimize_and_sort(std::move(top), strict, opts);
TEST_DO(compare(*top, *expect, true));
expect = Blueprint::optimize_and_sort(std::move(expect), strict, opts);