diff options
author | Arne Juul <arnej@verizonmedia.com> | 2020-11-27 12:11:14 +0000 |
---|---|---|
committer | Arne Juul <arnej@verizonmedia.com> | 2020-11-27 12:31:30 +0000 |
commit | c5b4717e49e72bc9433645c66266d1118d992023 (patch) | |
tree | a042d543070cbe58e5179d4f1b9d218592f543e5 | |
parent | f776f5e8c4f4dc63769ff11ab6e79a398f1e7fb3 (diff) |
check with SimpleValueBuilderFactory and always do type resolving
-rw-r--r-- | eval/src/tests/eval/interpreted_function/interpreted_function_test.cpp | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/eval/src/tests/eval/interpreted_function/interpreted_function_test.cpp b/eval/src/tests/eval/interpreted_function/interpreted_function_test.cpp index 1f74df6cb63..3a3433704f6 100644 --- a/eval/src/tests/eval/interpreted_function/interpreted_function_test.cpp +++ b/eval/src/tests/eval/interpreted_function/interpreted_function_test.cpp @@ -7,7 +7,7 @@ #include <vespa/eval/eval/interpreted_function.h> #include <vespa/eval/eval/test/eval_spec.h> #include <vespa/eval/eval/basic_nodes.h> -#include <vespa/eval/eval/simple_tensor_engine.h> +#include <vespa/eval/eval/simple_value.h> #include <vespa/vespalib/util/stringfmt.h> #include <vespa/vespalib/util/stash.h> #include <vespa/vespalib/test/insertion_operators.h> @@ -52,8 +52,8 @@ struct MyEvalTest : test::EvalSpec::EvalTest { if (is_supported && !has_issues) { vespalib::string desc = as_string(param_names, param_values, expression); SimpleParams params(param_values); - verify_result(SimpleTensorEngine::ref(), *function, false, "[untyped simple] "+desc, params, expected_result); - verify_result(FastValueBuilderFactory::get(), *function, true, "[typed prod] "+desc, params, expected_result); + verify_result(SimpleValueBuilderFactory::get(), *function, "[simple] "+desc, params, expected_result); + verify_result(FastValueBuilderFactory::get(), *function, "[prod] "+desc, params, expected_result); } } @@ -72,14 +72,11 @@ struct MyEvalTest : test::EvalSpec::EvalTest { void verify_result(EngineOrFactory engine, const Function &function, - bool typed, const vespalib::string &description, const SimpleParams ¶ms, double expected_result) { - NodeTypes node_types = typed - ? NodeTypes(function, std::vector<ValueType>(params.params.size(), ValueType::double_type())) - : NodeTypes(); + auto node_types = NodeTypes(function, std::vector<ValueType>(params.params.size(), ValueType::double_type())); InterpretedFunction ifun(engine, function, node_types); InterpretedFunction::Context ictx(ifun); const Value &result_value = ifun.eval(ictx, params); @@ -107,7 +104,8 @@ TEST("require that invalid function is tagged with error") { size_t count_ifs(const vespalib::string &expr, std::initializer_list<double> params_in) { auto fun = Function::parse(expr); - InterpretedFunction ifun(SimpleTensorEngine::ref(), *fun, NodeTypes()); + auto node_types = NodeTypes(*fun, std::vector<ValueType>(params_in.size(), ValueType::double_type())); + InterpretedFunction ifun(SimpleValueBuilderFactory::get(), *fun, node_types); InterpretedFunction::Context ctx(ifun); SimpleParams params(params_in); ifun.eval(ctx, params); @@ -135,7 +133,8 @@ TEST("require that function pointers can be passed as instruction parameters") { TEST("require that basic addition works") { auto function = Function::parse("a+10"); - InterpretedFunction interpreted(SimpleTensorEngine::ref(), *function, NodeTypes()); + auto node_types = NodeTypes(*function, {ValueType::double_type()}); + InterpretedFunction interpreted(SimpleValueBuilderFactory::get(), *function, node_types); InterpretedFunction::Context ctx(interpreted); SimpleParams params_20({20}); SimpleParams params_40({40}); |