summaryrefslogtreecommitdiffstats
path: root/searchlib/src/tests/features/tensor_from_weighted_set
diff options
context:
space:
mode:
authorTor Egge <Tor.Egge@yahoo-inc.com>2016-08-30 15:35:34 +0000
committerTor Egge <Tor.Egge@yahoo-inc.com>2016-08-30 15:35:34 +0000
commit9a8ec2228b0f4300fc2cefb7cbe05ddbc2636e2f (patch)
treeae7a19d9d4fc3a3446f7c43f83953c79e3fb9c30 /searchlib/src/tests/features/tensor_from_weighted_set
parentb019298bef4bf5cb6a8800a3e151f151f9d1b577 (diff)
Factor out AsTensor and AsEmptyTensor to test library.
Return error value when constant is not found. Use emplace when inserting into map. Correct comments.
Diffstat (limited to 'searchlib/src/tests/features/tensor_from_weighted_set')
-rw-r--r--searchlib/src/tests/features/tensor_from_weighted_set/tensor_from_weighted_set_test.cpp22
1 files changed, 1 insertions, 21 deletions
diff --git a/searchlib/src/tests/features/tensor_from_weighted_set/tensor_from_weighted_set_test.cpp b/searchlib/src/tests/features/tensor_from_weighted_set/tensor_from_weighted_set_test.cpp
index 163fd5b5389..a44a0d9fa8f 100644
--- a/searchlib/src/tests/features/tensor_from_weighted_set/tensor_from_weighted_set_test.cpp
+++ b/searchlib/src/tests/features/tensor_from_weighted_set/tensor_from_weighted_set_test.cpp
@@ -2,15 +2,14 @@
#include <vespa/fastos/fastos.h>
#include <vespa/vespalib/testkit/test_kit.h>
#include <vespa/vespalib/eval/function.h>
-#include <vespa/vespalib/eval/interpreted_function.h>
#include <vespa/vespalib/tensor/tensor.h>
-#include <vespa/vespalib/tensor/default_tensor_engine.h>
#include <vespa/searchlib/attribute/attributefactory.h>
#include <vespa/searchlib/attribute/attributevector.h>
#include <vespa/searchlib/attribute/integerbase.h>
#include <vespa/searchlib/attribute/stringbase.h>
#include <vespa/searchlib/features/setup.h>
+#include <vespa/searchlib/fef/test/as_tensor.h>
#include <vespa/searchlib/fef/test/indexenvironment.h>
#include <vespa/searchlib/fef/test/indexenvironmentbuilder.h>
#include <vespa/searchlib/fef/test/queryenvironment.h>
@@ -27,9 +26,7 @@ using search::IntegerAttribute;
using search::StringAttribute;
using vespalib::eval::Value;
using vespalib::eval::Function;
-using vespalib::eval::InterpretedFunction;
using vespalib::tensor::Tensor;
-using vespalib::tensor::DefaultTensorEngine;
typedef search::attribute::Config AVC;
typedef search::attribute::BasicType AVBT;
@@ -124,23 +121,6 @@ struct ExecFixture
}
};
-struct AsTensor {
- InterpretedFunction ifun;
- InterpretedFunction::Context ctx;
- const Value *result;
- explicit AsTensor(const vespalib::string &expr)
- : ifun(DefaultTensorEngine::ref(), Function::parse(expr)), ctx(), result(&ifun.eval(ctx))
- {
- ASSERT_TRUE(result->is_tensor());
- }
- bool operator==(const Tensor &rhs) const { return static_cast<const Tensor &>(*result->as_tensor()).equals(rhs); }
-};
-
-std::ostream &operator<<(std::ostream &os, const AsTensor &my_tensor) {
- os << my_tensor.result->as_tensor();
- return os;
-}
-
TEST_F("require that weighted set string attribute can be converted to tensor (default dimension)",
ExecFixture("tensorFromWeightedSet(attribute(wsstr))"))
{