aboutsummaryrefslogtreecommitdiffstats
path: root/vespajlib/src/test/java/com/yahoo/tensor/functions
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@verizonmedia.com>2019-11-27 17:55:01 +0200
committerJon Bratseth <bratseth@verizonmedia.com>2019-11-27 17:55:01 +0200
commitd3bb9e1b8f2b36688915fed559a1feac449216d7 (patch)
tree184df4eb34703bd0e2ff1ef7bdd8a593a555178e /vespajlib/src/test/java/com/yahoo/tensor/functions
parent9f1564bc8eb6568b54ed344a2c3201bfe634ac0e (diff)
Pull name up
Diffstat (limited to 'vespajlib/src/test/java/com/yahoo/tensor/functions')
-rw-r--r--vespajlib/src/test/java/com/yahoo/tensor/functions/DynamicTensorTestCase.java15
-rw-r--r--vespajlib/src/test/java/com/yahoo/tensor/functions/TensorFunctionTestCase.java4
2 files changed, 9 insertions, 10 deletions
diff --git a/vespajlib/src/test/java/com/yahoo/tensor/functions/DynamicTensorTestCase.java b/vespajlib/src/test/java/com/yahoo/tensor/functions/DynamicTensorTestCase.java
index 0f8fbade910..e16b7b90a1d 100644
--- a/vespajlib/src/test/java/com/yahoo/tensor/functions/DynamicTensorTestCase.java
+++ b/vespajlib/src/test/java/com/yahoo/tensor/functions/DynamicTensorTestCase.java
@@ -5,12 +5,11 @@ import com.yahoo.tensor.Tensor;
import com.yahoo.tensor.TensorAddress;
import com.yahoo.tensor.TensorType;
import com.yahoo.tensor.evaluation.EvaluationContext;
-import com.yahoo.tensor.evaluation.TypeContext;
+import com.yahoo.tensor.evaluation.Name;
import org.junit.Test;
import java.util.Collections;
import java.util.List;
-import java.util.function.Function;
import static org.junit.Assert.assertEquals;
@@ -22,27 +21,27 @@ public class DynamicTensorTestCase {
@Test
public void testDynamicTensorFunction() {
TensorType dense = TensorType.fromSpec("tensor(x[3])");
- DynamicTensor<TypeContext.Name> t1 = DynamicTensor.from(dense,
- List.of(new Constant(1), new Constant(2), new Constant(3)));
+ DynamicTensor<Name> t1 = DynamicTensor.from(dense,
+ List.of(new Constant(1), new Constant(2), new Constant(3)));
assertEquals(Tensor.from(dense, "[1, 2, 3]"), t1.evaluate());
assertEquals("tensor(x[3]):{{x:0}:1.0,{x:1}:2.0,{x:2}:3.0}", t1.toString());
TensorType sparse = TensorType.fromSpec("tensor(x{})");
- DynamicTensor<TypeContext.Name> t2 = DynamicTensor.from(sparse,
- Collections.singletonMap(new TensorAddress.Builder(sparse).add("x", "a").build(),
+ DynamicTensor<Name> t2 = DynamicTensor.from(sparse,
+ Collections.singletonMap(new TensorAddress.Builder(sparse).add("x", "a").build(),
new Constant(5)));
assertEquals(Tensor.from(sparse, "{{x:a}:5}"), t2.evaluate());
assertEquals("tensor(x{}):{{x:a}:5.0}", t2.toString());
}
- private static class Constant implements ScalarFunction<TypeContext.Name> {
+ private static class Constant implements ScalarFunction<Name> {
private final double value;
public Constant(double value) { this.value = value; }
@Override
- public Double apply(EvaluationContext<TypeContext.Name> evaluationContext) { return value; }
+ public Double apply(EvaluationContext<Name> evaluationContext) { return value; }
@Override
public String toString() { return String.valueOf(value); }
diff --git a/vespajlib/src/test/java/com/yahoo/tensor/functions/TensorFunctionTestCase.java b/vespajlib/src/test/java/com/yahoo/tensor/functions/TensorFunctionTestCase.java
index ff035f3aed2..e6560242d5c 100644
--- a/vespajlib/src/test/java/com/yahoo/tensor/functions/TensorFunctionTestCase.java
+++ b/vespajlib/src/test/java/com/yahoo/tensor/functions/TensorFunctionTestCase.java
@@ -2,7 +2,7 @@
package com.yahoo.tensor.functions;
import com.yahoo.tensor.TensorType;
-import com.yahoo.tensor.evaluation.TypeContext;
+import com.yahoo.tensor.evaluation.Name;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
@@ -23,7 +23,7 @@ public class TensorFunctionTestCase {
new Argmax<>(new ConstantTensor<>("{ {x:1}:1, {x:3}:5, {x:9}:3 }"), "x"));
}
- private void assertTranslated(String expectedTranslation, TensorFunction<TypeContext.Name> inputFunction) {
+ private void assertTranslated(String expectedTranslation, TensorFunction<Name> inputFunction) {
assertEquals(expectedTranslation, inputFunction.toPrimitive().toString());
}