aboutsummaryrefslogtreecommitdiffstats
path: root/searchcore/src/tests/proton/matching
diff options
context:
space:
mode:
authorTor Egge <Tor.Egge@online.no>2023-02-03 12:51:48 +0100
committerTor Egge <Tor.Egge@online.no>2023-02-03 12:51:48 +0100
commita2d46da96686f5fc99b881ef1d06ccd54ab9867c (patch)
tree38d78a683eaf6b385e5bba6dec9e29f201f217ed /searchcore/src/tests/proton/matching
parent97a9d25154b863baac946e11d95a8fa63d97a738 (diff)
Drop ranking assets repo from SearchableDocSubDB.
Diffstat (limited to 'searchcore/src/tests/proton/matching')
-rw-r--r--searchcore/src/tests/proton/matching/constant_value_repo/constant_value_repo_test.cpp29
1 files changed, 12 insertions, 17 deletions
diff --git a/searchcore/src/tests/proton/matching/constant_value_repo/constant_value_repo_test.cpp b/searchcore/src/tests/proton/matching/constant_value_repo/constant_value_repo_test.cpp
index 3c157221e60..39b06906a91 100644
--- a/searchcore/src/tests/proton/matching/constant_value_repo/constant_value_repo_test.cpp
+++ b/searchcore/src/tests/proton/matching/constant_value_repo/constant_value_repo_test.cpp
@@ -39,18 +39,25 @@ public:
}
};
+namespace {
+
+std::shared_ptr<RankingConstants> make_ranking_constants() {
+ RankingConstants::Vector constants;
+ constants.emplace_back("foo", "double", "path_1");
+ constants.emplace_back("bar", "double", "path_3");
+ return std::make_shared<RankingConstants>(constants);
+}
+
+}
+
struct Fixture {
MyConstantValueFactory factory;
RankingAssetsRepo repo;
Fixture()
- : factory(), repo(factory)
+ : factory(), repo(factory, make_ranking_constants(), {}, {})
{
factory.add("path_1", "double", 3);
factory.add("path_2", "double", 5);
- RankingConstants::Vector constants;
- constants.emplace_back("foo", "double", "path_1");
- constants.emplace_back("bar", "double", "path_3");
- repo.reconfigure(std::make_shared<RankingConstants>(constants),{}, {});
}
};
@@ -69,16 +76,4 @@ TEST_F("require that non-existing constant value in factory returns bad constant
EXPECT_TRUE(f.repo.getConstant("bar")->type().is_error());
}
-TEST_F("require that reconfigure replaces existing constant values in repo", Fixture)
-{
- RankingConstants::Vector constants;
- constants.emplace_back("bar", "double", "path_3");
- constants.emplace_back("baz", "double", "path_2");
- f.repo.reconfigure(std::make_shared<RankingConstants>(constants), {}, {});
- f.factory.add("path_3", "double", 7);
- EXPECT_TRUE(f.repo.getConstant("foo").get() == nullptr);
- EXPECT_EQUAL(7, f.repo.getConstant("bar")->value().as_double());
- EXPECT_EQUAL(5, f.repo.getConstant("baz")->value().as_double());
-}
-
TEST_MAIN() { TEST_RUN_ALL(); }