diff options
author | Geir Storli <geirst@yahooinc.com> | 2023-08-28 13:05:54 +0000 |
---|---|---|
committer | Geir Storli <geirst@yahooinc.com> | 2023-08-28 13:13:08 +0000 |
commit | 82f69abca5404f13e5e4a49c716ac089f8d03602 (patch) | |
tree | 17249bf1fb48c32f623f054f78dcfbabd6344019 /searchcore/src/tests/proton/common/attribute_updater/attribute_updater_test.cpp | |
parent | b85c362192bdfdafe44c7fe1257c463d5ad4340f (diff) |
Handle tensor modify update with "create: true" for non-existing tensor.
Diffstat (limited to 'searchcore/src/tests/proton/common/attribute_updater/attribute_updater_test.cpp')
-rw-r--r-- | searchcore/src/tests/proton/common/attribute_updater/attribute_updater_test.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
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 892be2c874f..8c3ce4c5031 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 @@ -436,6 +436,15 @@ TEST_F("require that tensor modify update is applied", f.assertTensor(TensorSpec(f.type).add({{"x", 0}}, 7).add({{"x", 1}}, 5)); } +TEST_F("require that tensor modify update with 'create: true' is applied to non-existing tensor", + TensorFixture<DenseTensorAttribute>("tensor(x[2])", "dense_tensor")) +{ + f.applyValueUpdate(*f.attribute, 1, + std::make_unique<TensorModifyUpdate>(TensorModifyUpdate::Operation::ADD, + makeTensorFieldValue(TensorSpec("tensor(x{})").add({{"x", "1"}}, 3)), 0.0)); + f.assertTensor(TensorSpec(f.type).add({{"x", 0}}, 0).add({{"x", 1}}, 3)); +} + TEST_F("require that tensor add update is applied", TensorFixture<SerializedFastValueAttribute>("tensor(x{})", "sparse_tensor")) { |