summaryrefslogtreecommitdiffstats
path: root/searchlib/src/tests/fef/properties/properties_test.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'searchlib/src/tests/fef/properties/properties_test.cpp')
-rw-r--r--searchlib/src/tests/fef/properties/properties_test.cpp41
1 files changed, 38 insertions, 3 deletions
diff --git a/searchlib/src/tests/fef/properties/properties_test.cpp b/searchlib/src/tests/fef/properties/properties_test.cpp
index 5e18c41b40a..c8073739b3e 100644
--- a/searchlib/src/tests/fef/properties/properties_test.cpp
+++ b/searchlib/src/tests/fef/properties/properties_test.cpp
@@ -10,9 +10,8 @@ using namespace search::fef::indexproperties;
struct CopyVisitor : public IPropertiesVisitor
{
Properties &dst;
- CopyVisitor(Properties &p) : dst(p) {}
- virtual void visitProperty(const Property::Value &key,
- const Property &values) override
+ explicit CopyVisitor(Properties &p) noexcept : dst(p) {}
+ void visitProperty(const Property::Value &key, const Property &values) override
{
for (uint32_t i = 0; i < values.size(); ++i) {
dst.add(key, values.getAt(i));
@@ -590,5 +589,41 @@ TEST("test query feature type properties")
EXPECT_EQUAL("", type::QueryFeature::lookup(p, "bar"));
}
+TEST("test integer lookup")
+{
+ EXPECT_EQUAL(matching::NumThreadsPerSearch::NAME, vespalib::string("vespa.matching.numthreadspersearch"));
+ EXPECT_EQUAL(matching::NumThreadsPerSearch::DEFAULT_VALUE, std::numeric_limits<uint32_t>::max());
+ {
+ Properties p;
+ p.add("vespa.matching.numthreadspersearch", "50");
+ EXPECT_EQUAL(matching::NumThreadsPerSearch::lookup(p), 50u);
+ }
+ {
+ Properties p;
+ p.add("vespa.matching.numthreadspersearch", "50 ");
+ EXPECT_EQUAL(matching::NumThreadsPerSearch::lookup(p), 50u);
+ }
+ {
+ Properties p;
+ p.add("vespa.matching.numthreadspersearch", " 50");
+ EXPECT_EQUAL(matching::NumThreadsPerSearch::lookup(p), 50u);
+ }
+ {
+ Properties p;
+ p.add("vespa.matching.numthreadspersearch", " ");
+ EXPECT_EQUAL(matching::NumThreadsPerSearch::lookup(p), matching::NumThreadsPerSearch::DEFAULT_VALUE);
+ }
+ {
+ Properties p;
+ p.add("vespa.matching.numthreadspersearch", "50x");
+ EXPECT_EQUAL(matching::NumThreadsPerSearch::lookup(p), 50u);
+ }
+ {
+ Properties p;
+ p.add("vespa.matching.numthreadspersearch", "x");
+ EXPECT_EQUAL(matching::NumThreadsPerSearch::lookup(p), matching::NumThreadsPerSearch::DEFAULT_VALUE);
+ }
+}
+
TEST_MAIN() { TEST_RUN_ALL(); }