summaryrefslogtreecommitdiffstats
path: root/model-integration/src/test
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@gmail.com>2022-05-18 14:37:17 +0200
committerJon Bratseth <bratseth@gmail.com>2022-05-18 14:37:17 +0200
commit4f8fa003117d3ad1f30b6dc0adcabf4e923b0f90 (patch)
treece780f3bac6be9f7a70b63f1853a96b2b9c322b8 /model-integration/src/test
parent2c9cb8159adaced573fd1e34689e533946feea85 (diff)
Revert "Merge pull request #22642 from vespa-engine/revert-22637-bratseth/model-syntax"
This reverts commit 2c9cb8159adaced573fd1e34689e533946feea85, reversing changes made to a4dbfc43c7df534ee5b032204ef19a7b038d7e3e.
Diffstat (limited to 'model-integration/src/test')
-rw-r--r--model-integration/src/test/java/ai/vespa/rankingexpression/importer/vespa/VespaImportTestCase.java9
-rw-r--r--model-integration/src/test/models/vespa/example.model12
-rw-r--r--model-integration/src/test/models/vespa/legacy_syntax.model26
3 files changed, 40 insertions, 7 deletions
diff --git a/model-integration/src/test/java/ai/vespa/rankingexpression/importer/vespa/VespaImportTestCase.java b/model-integration/src/test/java/ai/vespa/rankingexpression/importer/vespa/VespaImportTestCase.java
index fc92883a90f..25c51a75b0b 100644
--- a/model-integration/src/test/java/ai/vespa/rankingexpression/importer/vespa/VespaImportTestCase.java
+++ b/model-integration/src/test/java/ai/vespa/rankingexpression/importer/vespa/VespaImportTestCase.java
@@ -25,7 +25,16 @@ public class VespaImportTestCase {
@Test
public void testExample() {
ImportedModel model = importModel("example");
+ assertModel(model);
+ }
+
+ @Test
+ public void testLegacySyntax() {
+ ImportedModel model = importModel("legacy_syntax");
+ assertModel(model);
+ }
+ private void assertModel(ImportedModel model) {
assertEquals(2, model.inputs().size());
assertEquals("tensor(name{},x[3])", model.inputs().get("input1").toString());
assertEquals("tensor(x[3])", model.inputs().get("input2").toString());
diff --git a/model-integration/src/test/models/vespa/example.model b/model-integration/src/test/models/vespa/example.model
index 269ed83b695..25d27033cfd 100644
--- a/model-integration/src/test/models/vespa/example.model
+++ b/model-integration/src/test/models/vespa/example.model
@@ -1,17 +1,15 @@
model example {
# All inputs that are not scalar (aka 0-dimensional tensor) must be declared
- input1: tensor(name{}, x[3])
- input2: tensor(x[3])
+ inputs {
+ input1: tensor(name{}, x[3])
+ input2: tensor(x[3])
+ }
constants {
constant1: tensor(x[3]):{{x:0}:0.5, {x:1}:1.5, {x:2}:2.5}
constant2: 3.0
- }
-
- constant constant1asLarge {
- type: tensor(x[3])
- file: constant1asLarge.json
+ constant1asLarge tensor(x[3]): file:constant1asLarge.json
}
function foo1() {
diff --git a/model-integration/src/test/models/vespa/legacy_syntax.model b/model-integration/src/test/models/vespa/legacy_syntax.model
new file mode 100644
index 00000000000..2a5031a5ff9
--- /dev/null
+++ b/model-integration/src/test/models/vespa/legacy_syntax.model
@@ -0,0 +1,26 @@
+model legacy_syntax {
+
+ # Syntax not supported in rank profiles which probably should be removed on Vespa 9
+ input1: tensor(name{}, x[3])
+ input2: tensor(x[3])
+
+ constants {
+ constant1: tensor(x[3]):{{x:0}:0.5, {x:1}:1.5, {x:2}:2.5}
+ constant2: 3.0
+ }
+
+ # Syntax to be removed on Vespa 9
+ constant constant1asLarge {
+ type: tensor(x[3])
+ file: constant1asLarge.json
+ }
+
+ function foo1() {
+ expression: file:test.expression
+ }
+
+ function foo2() {
+ expression: reduce(sum(input1 * input2, name) * constant(constant1asLarge), max, x) * constant2
+ }
+
+} \ No newline at end of file