diff options
Diffstat (limited to 'searchlib/src/test/java')
2 files changed, 7 insertions, 55 deletions
diff --git a/searchlib/src/test/java/com/yahoo/searchlib/rankingexpression/evaluation/FeatureNamesTestCase.java b/searchlib/src/test/java/com/yahoo/searchlib/rankingexpression/evaluation/FeatureNamesTestCase.java deleted file mode 100644 index cf390171fa8..00000000000 --- a/searchlib/src/test/java/com/yahoo/searchlib/rankingexpression/evaluation/FeatureNamesTestCase.java +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -package com.yahoo.searchlib.rankingexpression.evaluation; - -import org.junit.Test; - -import static org.junit.Assert.assertEquals; - -/** - * Tests rank feature names. - * - * @author bratseth - */ -public class FeatureNamesTestCase { - - @Test - public void testCanonicalization() { - assertEquals("foo", FeatureNames.canonicalize("foo")); - assertEquals("foo.out", FeatureNames.canonicalize("foo.out")); - assertEquals("foo(bar)", FeatureNames.canonicalize("foo(bar)")); - assertEquals("foo(bar)", FeatureNames.canonicalize("foo('bar')")); - assertEquals("foo(bar)", FeatureNames.canonicalize("foo(\"bar\")")); - assertEquals("foo(bar).out", FeatureNames.canonicalize("foo(bar).out")); - assertEquals("foo(bar).out", FeatureNames.canonicalize("foo('bar').out")); - assertEquals("foo(bar).out", FeatureNames.canonicalize("foo(\"bar\").out")); - assertEquals("foo(\"ba.r\")", FeatureNames.canonicalize("foo(ba.r)")); - assertEquals("foo(\"ba.r\")", FeatureNames.canonicalize("foo('ba.r')")); - assertEquals("foo(\"ba.r\")", FeatureNames.canonicalize("foo(\"ba.r\")")); - assertEquals("foo(bar1,\"b.ar2\",\"ba/r3\").out", - FeatureNames.canonicalize("foo(bar1,b.ar2,ba/r3).out")); - assertEquals("foo(bar1,\"b.ar2\",\"ba/r3\").out", - FeatureNames.canonicalize("foo(bar1,'b.ar2',\"ba/r3\").out")); - } - - @Test - public void testConstantFeature() { - assertEquals("constant(\"foo/bar\")", FeatureNames.asConstantFeature("foo/bar")); - } - - @Test - public void testAttributeFeature() { - assertEquals("attribute(foo)", FeatureNames.asAttributeFeature("foo")); - } - - @Test - public void testQueryFeature() { - assertEquals("query(\"foo.bar\")", FeatureNames.asQueryFeature("foo.bar")); - } - -} diff --git a/searchlib/src/test/java/com/yahoo/searchlib/rankingexpression/evaluation/TypeResolutionTestCase.java b/searchlib/src/test/java/com/yahoo/searchlib/rankingexpression/evaluation/TypeResolutionTestCase.java index 5cac2215a00..c882c887c8d 100644 --- a/searchlib/src/test/java/com/yahoo/searchlib/rankingexpression/evaluation/TypeResolutionTestCase.java +++ b/searchlib/src/test/java/com/yahoo/searchlib/rankingexpression/evaluation/TypeResolutionTestCase.java @@ -19,11 +19,11 @@ public class TypeResolutionTestCase { @Test public void testTypeResolution() { TypeMapContext context = new TypeMapContext(); - context.setType("query('x1')", TensorType.fromSpec("tensor(x[])")); - context.setType("query('x2')", TensorType.fromSpec("tensor(x[10])")); - context.setType("query('y1')", TensorType.fromSpec("tensor(y[])")); - context.setType("query('xy1')", TensorType.fromSpec("tensor(x[10],y[])")); - context.setType("query('xy2')", TensorType.fromSpec("tensor(x[],y[10])")); + context.setType("query(x1)", TensorType.fromSpec("tensor(x[])")); + context.setType("query(x2)", TensorType.fromSpec("tensor(x[10])")); + context.setType("query(y1)", TensorType.fromSpec("tensor(y[])")); + context.setType("query(xy1)", TensorType.fromSpec("tensor(x[10],y[])")); + context.setType("query(xy2)", TensorType.fromSpec("tensor(x[],y[10])")); assertType("tensor(x[])", "query(x1)", context); assertType("tensor(x[])", "if (1>0, query(x1), query(x2))", context); @@ -46,7 +46,8 @@ public class TypeResolutionTestCase { fail("Expected type incompatibility exception"); } catch (IllegalArgumentException expected) { - assertEquals("An if expression must produce compatible types in both alternatives, but the 'true' type is tensor(x[]) while the 'false' type is tensor(y[])", + assertEquals("An if expression must produce compatible types in both alternatives, " + + "but the 'true' type is tensor(x[]) while the 'false' type is tensor(y[])", expected.getMessage()); } catch (ParseException e) { |