summaryrefslogtreecommitdiffstats
path: root/searchlib/src/test
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@verizonmedia.com>2019-12-14 10:22:01 +0100
committerJon Bratseth <bratseth@verizonmedia.com>2019-12-14 10:22:01 +0100
commit6645edd5b11f011b85a798dcf65fbd771d9509f2 (patch)
treebe0e16c8ed1f8e04ea5c3ebce92e823d6634e292 /searchlib/src/test
parentdba82f117a82c404c63c14884517c838a6fa500d (diff)
Error checking
Diffstat (limited to 'searchlib/src/test')
-rw-r--r--searchlib/src/test/java/com/yahoo/searchlib/rankingexpression/evaluation/EvaluationTestCase.java16
1 files changed, 16 insertions, 0 deletions
diff --git a/searchlib/src/test/java/com/yahoo/searchlib/rankingexpression/evaluation/EvaluationTestCase.java b/searchlib/src/test/java/com/yahoo/searchlib/rankingexpression/evaluation/EvaluationTestCase.java
index fa65ce0408b..21127607107 100644
--- a/searchlib/src/test/java/com/yahoo/searchlib/rankingexpression/evaluation/EvaluationTestCase.java
+++ b/searchlib/src/test/java/com/yahoo/searchlib/rankingexpression/evaluation/EvaluationTestCase.java
@@ -14,6 +14,7 @@ import com.yahoo.tensor.TensorType;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
/**
* Tests expression evaluation
@@ -431,6 +432,21 @@ public class EvaluationTestCase {
" key2:[[1.0, 2.0, 3.00],[4.00, 5.0, 6.0]]}",
"tensor(key{},x[3],y[2]):{key1:[[one,a_quarter],[one_half,one_half],[a_quarter,one]]," +
" key2:[[1,4],[2,5],[3,6]]}");
+
+ try {
+ new RankingExpression("tensor(x{},y[2]):{a:[one, one_half], b:[a_quarter]}");
+ fail("Expected exception");
+ }
+ catch (Exception e) {
+ assertEquals("At 'b': Need 2 values to fill a dense subspace of tensor(x{},y[2]) but got 1", e.getMessage());
+ }
+ try {
+ new RankingExpression("tensor(x[2],y[3]):[[1,2,3,4],[4,5,6]]");
+ fail("Expected exception");
+ }
+ catch (Exception e) {
+ assertEquals("Need 6 values to fill tensor(x[2],y[3]) but got 7", e.getMessage());
+ }
}
@Test