diff options
author | Arne H Juul <arnej27959@users.noreply.github.com> | 2021-10-19 18:29:53 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-19 18:29:53 +0200 |
commit | 8964cbed0c69e539235eb482651e6f84efd22898 (patch) | |
tree | 0652f770ca7a165035aaee67853c8456fe0cd71a /searchcore/src/tests/proton/matching/query_test.cpp | |
parent | e722ea4cb24548558a5a0b50ae483cce0bd3f31c (diff) | |
parent | 5bac27daa62f5b9136695a319a7ff5a7b8bcb602 (diff) |
Merge pull request #19622 from vespa-engine/arnej/add-true-and-false-itemsv7.486.17
add ITEM_TRUE and ITEM_FALSE query nodes
Diffstat (limited to 'searchcore/src/tests/proton/matching/query_test.cpp')
-rw-r--r-- | searchcore/src/tests/proton/matching/query_test.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/searchcore/src/tests/proton/matching/query_test.cpp b/searchcore/src/tests/proton/matching/query_test.cpp index 432a17392e5..a09437be46b 100644 --- a/searchcore/src/tests/proton/matching/query_test.cpp +++ b/searchcore/src/tests/proton/matching/query_test.cpp @@ -120,6 +120,7 @@ class Test : public vespalib::TestApp { void requireThatSameElementTermsAreProperlyPrefixed(); void requireThatSameElementDoesNotAllocateMatchData(); void requireThatSameElementIteratorsCanBeBuilt(); + void requireThatConstBoolBlueprintsAreCreatedCorrectly(); public: ~Test() override; @@ -1088,6 +1089,28 @@ Test::requireThatSameElementIteratorsCanBeBuilt() { EXPECT_TRUE(iterator->seek(8)); } +void Test::requireThatConstBoolBlueprintsAreCreatedCorrectly() { + using search::queryeval::AlwaysTrueBlueprint; + using search::queryeval::EmptyBlueprint; + + ProtonTrue true_node; + ProtonFalse false_node; + + FakeRequestContext requestContext; + FakeSearchContext context; + context.setLimit(1000); + context.addIdx(0).idx(0).getFake() + .addResult(field, "foo", FakeResult().doc(1).doc(3)); + + Blueprint::UP t_blueprint = BlueprintBuilder::build(requestContext, true_node, context); + auto *tbp = dynamic_cast<AlwaysTrueBlueprint*>(t_blueprint.get()); + EXPECT_TRUE(tbp != nullptr); + + Blueprint::UP f_blueprint = BlueprintBuilder::build(requestContext, false_node, context); + auto *fbp = dynamic_cast<EmptyBlueprint*>(f_blueprint.get()); + EXPECT_TRUE(fbp != nullptr); +} + Test::~Test() = default; int @@ -1126,6 +1149,7 @@ Test::Main() TEST_CALL(requireThatSameElementTermsAreProperlyPrefixed); TEST_CALL(requireThatSameElementDoesNotAllocateMatchData); TEST_CALL(requireThatSameElementIteratorsCanBeBuilt); + TEST_CALL(requireThatConstBoolBlueprintsAreCreatedCorrectly); TEST_DONE(); } |