diff options
author | Arne Juul <arnej@verizonmedia.com> | 2020-03-23 14:17:30 +0000 |
---|---|---|
committer | Arne Juul <arnej@verizonmedia.com> | 2020-03-23 14:30:36 +0000 |
commit | 6e17e57db3435ccd8d5705b3bdd062ce337ff137 (patch) | |
tree | 7c1881c73a93b0c354b795d05f0d518b66c738ab /searchlib | |
parent | 1d3fdf021dab6ab47736feea0cd439e79360acbf (diff) |
check that query tensor is converted correctly
Diffstat (limited to 'searchlib')
-rw-r--r-- | searchlib/src/tests/attribute/searchable/attributeblueprint_test.cpp | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/searchlib/src/tests/attribute/searchable/attributeblueprint_test.cpp b/searchlib/src/tests/attribute/searchable/attributeblueprint_test.cpp index 47728c9785c..665803b3057 100644 --- a/searchlib/src/tests/attribute/searchable/attributeblueprint_test.cpp +++ b/searchlib/src/tests/attribute/searchable/attributeblueprint_test.cpp @@ -301,7 +301,9 @@ public: }; void -expect_nearest_neighbor_blueprint(const vespalib::string& attribute_tensor_type_spec, const TensorSpec& query_tensor) +expect_nearest_neighbor_blueprint(const vespalib::string& attribute_tensor_type_spec, + const TensorSpec& query_tensor, + const TensorSpec& converted_query_tensor) { NearestNeighborFixture f(make_tensor_attribute(field, attribute_tensor_type_spec)); f.set_query_tensor(query_tensor); @@ -309,7 +311,7 @@ expect_nearest_neighbor_blueprint(const vespalib::string& attribute_tensor_type_ auto result = f.create_blueprint(); const auto& nearest = as_type<NearestNeighborBlueprint>(*result); EXPECT_EQ(attribute_tensor_type_spec, nearest.get_attribute_tensor().getTensorType().to_spec()); - EXPECT_EQ(query_tensor, DefaultTensorEngine::ref().to_spec(nearest.get_query_tensor())); + EXPECT_EQ(converted_query_tensor, DefaultTensorEngine::ref().to_spec(nearest.get_query_tensor())); EXPECT_EQ(7u, nearest.get_target_num_hits()); } @@ -318,10 +320,12 @@ TEST(AttributeBlueprintTest, nearest_neighbor_blueprint_is_created_by_attribute_ TensorSpec x_2_double = TensorSpec("tensor(x[2])").add({{"x", 0}}, 3).add({{"x", 1}}, 5); TensorSpec x_2_float = TensorSpec("tensor<float>(x[2])").add({{"x", 0}}, 3).add({{"x", 1}}, 5); - expect_nearest_neighbor_blueprint("tensor(x[2])", x_2_double); - expect_nearest_neighbor_blueprint("tensor<float>(x[2])", x_2_float); - expect_nearest_neighbor_blueprint("tensor(x[2])", x_2_float); - expect_nearest_neighbor_blueprint("tensor<float>(x[2])", x_2_double); + // same cell type: + expect_nearest_neighbor_blueprint("tensor(x[2])", x_2_double, x_2_double); + expect_nearest_neighbor_blueprint("tensor<float>(x[2])", x_2_float, x_2_float); + // convert cell type: + expect_nearest_neighbor_blueprint("tensor(x[2])", x_2_float, x_2_double); + expect_nearest_neighbor_blueprint("tensor<float>(x[2])", x_2_double, x_2_float); } void |