summaryrefslogtreecommitdiffstats
path: root/vespajlib/src/test/java/com/yahoo/tensor/IndexedTensorTestCase.java
diff options
context:
space:
mode:
Diffstat (limited to 'vespajlib/src/test/java/com/yahoo/tensor/IndexedTensorTestCase.java')
-rw-r--r--vespajlib/src/test/java/com/yahoo/tensor/IndexedTensorTestCase.java10
1 files changed, 10 insertions, 0 deletions
diff --git a/vespajlib/src/test/java/com/yahoo/tensor/IndexedTensorTestCase.java b/vespajlib/src/test/java/com/yahoo/tensor/IndexedTensorTestCase.java
index c71240541cf..18ffe28271e 100644
--- a/vespajlib/src/test/java/com/yahoo/tensor/IndexedTensorTestCase.java
+++ b/vespajlib/src/test/java/com/yahoo/tensor/IndexedTensorTestCase.java
@@ -43,6 +43,16 @@ public class IndexedTensorTestCase {
assertEquals(singleValue, singleValueFromString);
}
+ @Test
+ public void testNegativeLabels() {
+ TensorAddress numeric = TensorAddress.of(-1, 0, 1, 1234567, -1234567);
+ assertEquals("-1", numeric.label(0));
+ assertEquals("0", numeric.label(1));
+ assertEquals("1", numeric.label(2));
+ assertEquals("1234567", numeric.label(3));
+ assertEquals("-1234567", numeric.label(4));
+ }
+
private void verifyFloat(String spec) {
float [] floats = {1.0f, 2.0f, 3.0f};
Tensor tensor = IndexedTensor.Builder.of(TensorType.fromSpec(spec), floats).build();