summaryrefslogtreecommitdiffstats
path: root/eval/src
diff options
context:
space:
mode:
authorTor Egge <Tor.Egge@broadpark.no>2019-02-01 13:47:13 +0100
committerTor Egge <Tor.Egge@broadpark.no>2019-02-01 13:49:27 +0100
commit572e7b62f40a98b7592ad3cc9142257ac4db374d (patch)
tree26e935cdd96d2f24ff807c4d813e4b17d8348b55 /eval/src
parente8ab2288adce24fd6d05c669d380cd50276524f7 (diff)
Test that updates to missing cells are ignored.
Test that updates to out of range cells are ignored.
Diffstat (limited to 'eval/src')
-rw-r--r--eval/src/tests/tensor/tensor_modify/tensor_modify_test.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/eval/src/tests/tensor/tensor_modify/tensor_modify_test.cpp b/eval/src/tests/tensor/tensor_modify/tensor_modify_test.cpp
index 67dc033fb80..c3c817d28c4 100644
--- a/eval/src/tests/tensor/tensor_modify/tensor_modify_test.cpp
+++ b/eval/src/tests/tensor/tensor_modify/tensor_modify_test.cpp
@@ -65,4 +65,28 @@ TEST("require that dense tensors can be modified") {
.add({{"x",9},{"y",9}}, 11));
}
+TEST("require that sparse tensors ignore updates to missing cells") {
+ checkUpdate(TensorSpec("tensor(x{},y{})")
+ .add({{"x","8"},{"y","9"}}, 11)
+ .add({{"x","9"},{"y","9"}}, 11),
+ TensorSpec("tensor(x{},y{})")
+ .add({{"x","7"},{"y","9"}}, 2)
+ .add({{"x","8"},{"y","9"}}, 2),
+ TensorSpec("tensor(x{},y{})")
+ .add({{"x","8"},{"y","9"}}, 2)
+ .add({{"x","9"},{"y","9"}}, 11));
+}
+
+TEST("require that dense tensors ignore updates to out of range cells") {
+ checkUpdate(TensorSpec("tensor(x[10],y[10])")
+ .add({{"x",8},{"y",9}}, 11)
+ .add({{"x",9},{"y",9}}, 11),
+ TensorSpec("tensor(x{},y{})")
+ .add({{"x","8"},{"y","9"}}, 2)
+ .add({{"x","10"},{"y","9"}}, 2),
+ TensorSpec("tensor(x[10],y[10])")
+ .add({{"x",8},{"y",9}}, 2)
+ .add({{"x",9},{"y",9}}, 11));
+}
+
TEST_MAIN() { TEST_RUN_ALL(); }