diff options
author | Arne Juul <arnej@verizonmedia.com> | 2020-10-15 10:37:22 +0000 |
---|---|---|
committer | Arne Juul <arnej@verizonmedia.com> | 2020-10-15 11:22:15 +0000 |
commit | d78c40cb1330fea628684b9aaa8aa993fd70eecc (patch) | |
tree | 363455ec2a4feea9caca72c70a8880caa5825062 | |
parent | 08393e9e14635f1c6a6c84650c25023a0db7ed0b (diff) |
simplify
14 files changed, 14 insertions, 36 deletions
diff --git a/document/src/tests/documentupdatetestcase.cpp b/document/src/tests/documentupdatetestcase.cpp index ca519a2f7d0..1863194ab73 100644 --- a/document/src/tests/documentupdatetestcase.cpp +++ b/document/src/tests/documentupdatetestcase.cpp @@ -775,9 +775,7 @@ TEST(DocumentUpdateTest, testMapValueUpdate) std::unique_ptr<vespalib::eval::Value> makeTensor(const TensorSpec &spec) { - auto result = EngineOrFactory::get().from_spec(spec); - EXPECT_TRUE(result->is_tensor()); - return result; + return EngineOrFactory::get().from_spec(spec); } std::unique_ptr<TensorFieldValue> diff --git a/document/src/tests/serialization/vespadocumentserializer_test.cpp b/document/src/tests/serialization/vespadocumentserializer_test.cpp index 13d5e7d8405..05f1e9251db 100644 --- a/document/src/tests/serialization/vespadocumentserializer_test.cpp +++ b/document/src/tests/serialization/vespadocumentserializer_test.cpp @@ -772,9 +772,7 @@ namespace { vespalib::eval::Value::UP createTensor(const TensorSpec &spec) { - auto value = EngineOrFactory::get().from_spec(spec); - ASSERT_TRUE(value->is_tensor()); - return value; + return EngineOrFactory::get().from_spec(spec); } } diff --git a/document/src/tests/tensor_fieldvalue/tensor_fieldvalue_test.cpp b/document/src/tests/tensor_fieldvalue/tensor_fieldvalue_test.cpp index 18afdb15bb8..231fba93d10 100644 --- a/document/src/tests/tensor_fieldvalue/tensor_fieldvalue_test.cpp +++ b/document/src/tests/tensor_fieldvalue/tensor_fieldvalue_test.cpp @@ -27,9 +27,7 @@ TensorDataType xSparseTensorDataType(ValueType::from_spec("tensor(x{})")); TensorDataType xySparseTensorDataType(ValueType::from_spec("tensor(x{},y{})")); vespalib::eval::Value::UP createTensor(const TensorSpec &spec) { - auto value = EngineOrFactory::get().from_spec(spec); - ASSERT_TRUE(value->is_tensor()); - return value; + return EngineOrFactory::get().from_spec(spec); } std::unique_ptr<vespalib::eval::Value> diff --git a/searchcore/src/tests/proton/attribute/attribute_test.cpp b/searchcore/src/tests/proton/attribute/attribute_test.cpp index 00153402fc9..b30420ead24 100644 --- a/searchcore/src/tests/proton/attribute/attribute_test.cpp +++ b/searchcore/src/tests/proton/attribute/attribute_test.cpp @@ -641,8 +641,7 @@ TEST_F(FilterAttributeManagerTest, readable_attribute_vector_filters_attributes) namespace { Value::UP make_tensor(const TensorSpec &spec) { - auto tensor = EngineOrFactory::get().from_spec(spec); - return tensor; + return EngineOrFactory::get().from_spec(spec); } const vespalib::string sparse_tensor = "tensor(x{},y{})"; diff --git a/searchcore/src/tests/proton/common/attribute_updater/attribute_updater_test.cpp b/searchcore/src/tests/proton/common/attribute_updater/attribute_updater_test.cpp index 61b5f9cb847..a41672569ce 100644 --- a/searchcore/src/tests/proton/common/attribute_updater/attribute_updater_test.cpp +++ b/searchcore/src/tests/proton/common/attribute_updater/attribute_updater_test.cpp @@ -442,8 +442,7 @@ struct TensorFixture : public Fixture { } void assertTensor(const TensorSpec &expSpec) { - auto engine = EngineOrFactory::get(); - auto actual = engine.to_spec(*attribute->getTensor(1)); + auto actual = EngineOrFactory::get().to_spec(*attribute->getTensor(1)); EXPECT_EQUAL(expSpec, actual); } }; diff --git a/searchcore/src/tests/proton/docsummary/docsummary.cpp b/searchcore/src/tests/proton/docsummary/docsummary.cpp index 7e220cd0165..a4d0f007031 100644 --- a/searchcore/src/tests/proton/docsummary/docsummary.cpp +++ b/searchcore/src/tests/proton/docsummary/docsummary.cpp @@ -139,8 +139,7 @@ getDocTypeName() } vespalib::eval::Value::UP make_tensor(const TensorSpec &spec) { - auto tensor = EngineOrFactory::get().from_spec(spec); - return tensor; + return EngineOrFactory::get().from_spec(spec); } vespalib::string asVstring(vespalib::Memory str) { diff --git a/searchcore/src/tests/proton/docsummary/summaryfieldconverter_test.cpp b/searchcore/src/tests/proton/docsummary/summaryfieldconverter_test.cpp index 6309f96b747..58b7838bf35 100644 --- a/searchcore/src/tests/proton/docsummary/summaryfieldconverter_test.cpp +++ b/searchcore/src/tests/proton/docsummary/summaryfieldconverter_test.cpp @@ -677,8 +677,7 @@ Test::requireThatPredicateIsPrinted() } Value::UP make_tensor(const TensorSpec &spec) { - auto tensor = EngineOrFactory::get().from_spec(spec); - return tensor; + return EngineOrFactory::get().from_spec(spec); } void diff --git a/searchlib/src/tests/attribute/imported_attribute_vector/imported_attribute_vector_test.cpp b/searchlib/src/tests/attribute/imported_attribute_vector/imported_attribute_vector_test.cpp index 387378659e9..1d6f68c5802 100644 --- a/searchlib/src/tests/attribute/imported_attribute_vector/imported_attribute_vector_test.cpp +++ b/searchlib/src/tests/attribute/imported_attribute_vector/imported_attribute_vector_test.cpp @@ -19,9 +19,7 @@ using vespalib::eval::TensorSpec; using vespalib::eval::EngineOrFactory; Value::UP createTensor(const TensorSpec &spec) { - auto value = EngineOrFactory::get().from_spec(spec); - ASSERT_TRUE(value->is_tensor()); - return value; + return EngineOrFactory::get().from_spec(spec); } namespace search::attribute { diff --git a/searchlib/src/tests/attribute/tensorattribute/tensorattribute_test.cpp b/searchlib/src/tests/attribute/tensorattribute/tensorattribute_test.cpp index 2de95e89da5..da77e29dbb0 100644 --- a/searchlib/src/tests/attribute/tensorattribute/tensorattribute_test.cpp +++ b/searchlib/src/tests/attribute/tensorattribute/tensorattribute_test.cpp @@ -61,8 +61,7 @@ vespalib::string denseSpec("tensor(x[2],y[3])"); vespalib::string vec_2d_spec("tensor(x[2])"); Value::UP createTensor(const TensorSpec &spec) { - auto value = EngineOrFactory::get().from_spec(spec); - return value; + return EngineOrFactory::get().from_spec(spec); } TensorSpec @@ -904,8 +903,7 @@ public: } std::unique_ptr<Value> createDenseTensor(const TensorSpec &spec) { - auto value = EngineOrFactory::get().from_spec(spec); - return value; + return EngineOrFactory::get().from_spec(spec); } std::unique_ptr<NearestNeighborBlueprint> make_blueprint(double brute_force_limit = 0.05) { diff --git a/searchlib/src/tests/features/tensor_from_labels/tensor_from_labels_test.cpp b/searchlib/src/tests/features/tensor_from_labels/tensor_from_labels_test.cpp index 6b43f97354f..80c98284b82 100644 --- a/searchlib/src/tests/features/tensor_from_labels/tensor_from_labels_test.cpp +++ b/searchlib/src/tests/features/tensor_from_labels/tensor_from_labels_test.cpp @@ -36,8 +36,7 @@ typedef search::AttributeVector::SP AttributePtr; typedef FtTestApp FTA; Value::UP make_tensor(const TensorSpec &spec) { - auto tensor = EngineOrFactory::get().from_spec(spec); - return tensor; + return EngineOrFactory::get().from_spec(spec); } Value::UP make_empty(const vespalib::string &type) { @@ -123,7 +122,6 @@ struct ExecFixture } const Value &extractTensor(uint32_t docid) { Value::CREF value = test.resolveObjectFeature(docid); - ASSERT_TRUE(value.get().is_tensor()); return value.get(); } const Value &execute() { 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 40a5b8a8cc7..d3909223907 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 @@ -37,8 +37,7 @@ typedef search::AttributeVector::SP AttributePtr; typedef FtTestApp FTA; Value::UP make_tensor(const TensorSpec &spec) { - auto tensor = EngineOrFactory::get().from_spec(spec); - return tensor; + return EngineOrFactory::get().from_spec(spec); } Value::UP make_empty(const vespalib::string &type) { @@ -122,7 +121,6 @@ struct ExecFixture } const Value &extractTensor(uint32_t docid) { Value::CREF value = test.resolveObjectFeature(docid); - ASSERT_TRUE(value.get().is_tensor()); return value.get(); } const Value &execute() { diff --git a/searchlib/src/tests/queryeval/nearest_neighbor/nearest_neighbor_test.cpp b/searchlib/src/tests/queryeval/nearest_neighbor/nearest_neighbor_test.cpp index 0a28f0a4c17..153e3cf45cc 100644 --- a/searchlib/src/tests/queryeval/nearest_neighbor/nearest_neighbor_test.cpp +++ b/searchlib/src/tests/queryeval/nearest_neighbor/nearest_neighbor_test.cpp @@ -42,7 +42,6 @@ DistanceFunction::UP euclid_f = search::tensor::make_distance_function(DistanceM std::unique_ptr<Value> createTensor(const TensorSpec &spec) { auto value = EngineOrFactory::get().from_spec(spec); - ASSERT_TRUE(value->is_tensor()); return value; } diff --git a/searchlib/src/tests/tensor/dense_tensor_store/dense_tensor_store_test.cpp b/searchlib/src/tests/tensor/dense_tensor_store/dense_tensor_store_test.cpp index f2470fd0319..4ed366a6cc2 100644 --- a/searchlib/src/tests/tensor/dense_tensor_store/dense_tensor_store_test.cpp +++ b/searchlib/src/tests/tensor/dense_tensor_store/dense_tensor_store_test.cpp @@ -23,8 +23,7 @@ using EntryRef = DenseTensorStore::EntryRef; Value::UP makeTensor(const TensorSpec &spec) { - auto tensor = EngineOrFactory::get().from_spec(spec); - return tensor; + return EngineOrFactory::get().from_spec(spec); } struct Fixture diff --git a/searchlib/src/tests/tensor/direct_tensor_store/direct_tensor_store_test.cpp b/searchlib/src/tests/tensor/direct_tensor_store/direct_tensor_store_test.cpp index 4eb2c935234..7e525097390 100644 --- a/searchlib/src/tests/tensor/direct_tensor_store/direct_tensor_store_test.cpp +++ b/searchlib/src/tests/tensor/direct_tensor_store/direct_tensor_store_test.cpp @@ -18,9 +18,7 @@ vespalib::string tensor_spec("tensor(x{})"); Value::UP make_tensor(const TensorSpec& spec) { - auto value = EngineOrFactory::get().from_spec(spec); - assert(value->is_tensor()); - return value; + return EngineOrFactory::get().from_spec(spec); } Value::UP |