From 3436d42fb55f70302f35293358f2f6e8a8dcd637 Mon Sep 17 00:00:00 2001 From: Magnus Eide-Fredriksen Date: Fri, 4 Oct 2024 15:16:35 +0200 Subject: [PATCH] feat: add a test for previously implemented logic --- .../ai/vespa/schemals/SchemaParserTest.java | 1 + .../src/test/sdfiles/single/tensorGenerate.sd | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 integration/schema-language-server/language-server/src/test/sdfiles/single/tensorGenerate.sd diff --git a/integration/schema-language-server/language-server/src/test/java/ai/vespa/schemals/SchemaParserTest.java b/integration/schema-language-server/language-server/src/test/java/ai/vespa/schemals/SchemaParserTest.java index cec99a4f07ea..c7907cd8ece5 100644 --- a/integration/schema-language-server/language-server/src/test/java/ai/vespa/schemals/SchemaParserTest.java +++ b/integration/schema-language-server/language-server/src/test/java/ai/vespa/schemals/SchemaParserTest.java @@ -338,6 +338,7 @@ Stream generateBadFileTests() { new BadFileTestCase("src/test/sdfiles/single/rankprofilefuncs.sd", 2), new BadFileTestCase("src/test/sdfiles/single/onnxmodel.sd", 1), + new BadFileTestCase("src/test/sdfiles/single/tensorGenerate.sd", 2) }; return Arrays.stream(tests) diff --git a/integration/schema-language-server/language-server/src/test/sdfiles/single/tensorGenerate.sd b/integration/schema-language-server/language-server/src/test/sdfiles/single/tensorGenerate.sd new file mode 100644 index 000000000000..d69cdccd87f8 --- /dev/null +++ b/integration/schema-language-server/language-server/src/test/sdfiles/single/tensorGenerate.sd @@ -0,0 +1,18 @@ +schema tensorGenerate { + document tensorGenerate { + } + + rank-profile myprofile { + first-phase { + expression: tensor(d0[100], d1{})(d0) + } + + function func() { + expression: tensor(d0[10], d1[20], d3[30])(d4) # error + } + + function complicated() { + expression: tensor(d0[1],d1[1],d2[2])(d2) + tensor(d1[1])(d2) # also error, d2 exists in other tensor. + } + } +}