diff options
author | Arne Juul <arnej@verizonmedia.com> | 2020-11-12 08:55:54 +0000 |
---|---|---|
committer | Arne Juul <arnej@verizonmedia.com> | 2020-11-12 08:57:49 +0000 |
commit | 473cd0a65a9f0e845af7dfa800879b445bdfb4ec (patch) | |
tree | e74ae61939343185f7d7ae65ab951ef409868163 /eval/src/tests/instruction/dense_tensor_peek_function | |
parent | 43dacb6e1baa4a6805d92b1f537c541586702c17 (diff) |
test with FastValueBuilderFactory also
Diffstat (limited to 'eval/src/tests/instruction/dense_tensor_peek_function')
-rw-r--r-- | eval/src/tests/instruction/dense_tensor_peek_function/dense_tensor_peek_function_test.cpp | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/eval/src/tests/instruction/dense_tensor_peek_function/dense_tensor_peek_function_test.cpp b/eval/src/tests/instruction/dense_tensor_peek_function/dense_tensor_peek_function_test.cpp index b82c88d046f..df9271784b9 100644 --- a/eval/src/tests/instruction/dense_tensor_peek_function/dense_tensor_peek_function_test.cpp +++ b/eval/src/tests/instruction/dense_tensor_peek_function/dense_tensor_peek_function_test.cpp @@ -1,5 +1,6 @@ // Copyright 2019 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +#include <vespa/eval/eval/fast_value.h> #include <vespa/eval/eval/tensor_function.h> #include <vespa/eval/eval/test/eval_fixture.h> #include <vespa/eval/eval/test/tensor_model.hpp> @@ -14,7 +15,8 @@ using namespace vespalib::eval; using namespace vespalib::eval::test; using namespace vespalib::eval::tensor_function; -const TensorEngine &prod_engine = tensor::DefaultTensorEngine::ref(); +const TensorEngine &old_engine = tensor::DefaultTensorEngine::ref(); +const ValueBuilderFactory &prod_factory = FastValueBuilderFactory::get(); EvalFixture::ParamRepo make_params() { return EvalFixture::ParamRepo() @@ -31,7 +33,7 @@ EvalFixture::ParamRepo make_params() { EvalFixture::ParamRepo param_repo = make_params(); void verify(const vespalib::string &expr, double expect, size_t expect_optimized_cnt, size_t expect_not_optimized_cnt) { - EvalFixture fixture(prod_engine, expr, param_repo, true); + EvalFixture fixture(prod_factory, expr, param_repo, true); auto expect_spec = TensorSpec("double").add({}, expect); EXPECT_EQUAL(EvalFixture::ref(expr, param_repo), expect_spec); EXPECT_EQUAL(fixture.result(), expect_spec); @@ -41,6 +43,15 @@ void verify(const vespalib::string &expr, double expect, size_t expect_optimized EXPECT_TRUE(info[i]->result_is_mutable()); } EXPECT_EQUAL(fixture.find_all<Peek>().size(), expect_not_optimized_cnt); + + EvalFixture old_fixture(old_engine, expr, param_repo, true); + EXPECT_EQUAL(old_fixture.result(), expect_spec); + info = old_fixture.find_all<DenseTensorPeekFunction>(); + EXPECT_EQUAL(info.size(), expect_optimized_cnt); + for (size_t i = 0; i < info.size(); ++i) { + EXPECT_TRUE(info[i]->result_is_mutable()); + } + EXPECT_EQUAL(old_fixture.find_all<Peek>().size(), expect_not_optimized_cnt); } //----------------------------------------------------------------------------- |