This is an automated email from the ASF dual-hosted git repository.
sergeykamov pushed a commit to branch NLPCRAFT-283
in repository https://gitbox.apache.org/repos/asf/incubator-nlpcraft.git
The following commit(s) were added to refs/heads/NLPCRAFT-283 by this push:
new 5d3cd3f WIP.
5d3cd3f is described below
commit 5d3cd3feb16747531e2637cbeda3e628565f2838
Author: Sergey Kamov <[email protected]>
AuthorDate: Thu Mar 25 17:21:33 2021 +0300
WIP.
---
.../compiler/functions/NCIdlFunctionsCompany.scala | 1 -
.../compiler/functions/NCIdlFunctionsCustom.scala | 23 ++++++++++++----------
2 files changed, 13 insertions(+), 11 deletions(-)
diff --git
a/nlpcraft/src/test/scala/org/apache/nlpcraft/model/intent/idl/compiler/functions/NCIdlFunctionsCompany.scala
b/nlpcraft/src/test/scala/org/apache/nlpcraft/model/intent/idl/compiler/functions/NCIdlFunctionsCompany.scala
index 9a95032..b03a78c 100644
---
a/nlpcraft/src/test/scala/org/apache/nlpcraft/model/intent/idl/compiler/functions/NCIdlFunctionsCompany.scala
+++
b/nlpcraft/src/test/scala/org/apache/nlpcraft/model/intent/idl/compiler/functions/NCIdlFunctionsCompany.scala
@@ -55,7 +55,6 @@ class NCIdlFunctionsCompany extends NCIdlFunctions {
override def getMetadata: util.Map[String, AnyRef] =
Map("k1" → "v1").map(p ⇒ p._1 →
p._2.asInstanceOf[AnyRef]).asJava
})
-
}
private def test(comp: NCCompany): Unit = {
diff --git
a/nlpcraft/src/test/scala/org/apache/nlpcraft/model/intent/idl/compiler/functions/NCIdlFunctionsCustom.scala
b/nlpcraft/src/test/scala/org/apache/nlpcraft/model/intent/idl/compiler/functions/NCIdlFunctionsCustom.scala
index 2dae012..84abcbc 100644
---
a/nlpcraft/src/test/scala/org/apache/nlpcraft/model/intent/idl/compiler/functions/NCIdlFunctionsCustom.scala
+++
b/nlpcraft/src/test/scala/org/apache/nlpcraft/model/intent/idl/compiler/functions/NCIdlFunctionsCustom.scala
@@ -17,6 +17,7 @@
package org.apache.nlpcraft.model.intent.idl.compiler.functions
+import org.apache.nlpcraft.common.U
import org.apache.nlpcraft.model.{NCTokenPredicateContext,
NCTokenPredicateResult}
import org.junit.jupiter.api.Test
@@ -38,32 +39,34 @@ class NCIdlTokensTestWrapper {
* Tests for 'custom' functions.
*/
class NCIdlFunctionsCustom extends NCIdlFunctions {
+ private final val C = U.cleanClassName(classOf[NCIdlTokensTestWrapper])
+
@Test
def testErrors(): Unit = {
def test(truth: String): Unit = expectError(TestDesc(truth = truth,
isCustom = true))
test("invalid")
-
test("org.apache.nlpcraft.model.intent.idl.compiler.functions.NCIdlTokensTestWrapper#missed")
-
test("org.apache.nlpcraft.model.intent.idl.compiler.functions.NCIdlTokensTestWrapper#wrongParams1")
-
test("org.apache.nlpcraft.model.intent.idl.compiler.functions.NCIdlTokensTestWrapper#wrongParams2")
-
test("org.apache.nlpcraft.model.intent.idl.compiler.functions.NCIdlTokensTestWrapper#wrongParams3")
-
test("org.apache.nlpcraft.model.intent.idl.compiler.functions.NCIdlTokensTestWrapper#wrongRet1")
-
test("org.apache.nlpcraft.model.intent.idl.compiler.functions.NCIdlTokensTestWrapper#wrongRet2")
-
test("org.apache.nlpcraft.model.intent.idl.compiler.functions.NCIdlTokensTestWrapper#wrongExec1")
-
test("org.apache.nlpcraft.model.intent.idl.compiler.functions.NCIdlTokensTestWrapper#wrongExec2")
+ test(s"$C#missed")
+ test(s"$C#wrongParams1")
+ test(s"$C#wrongParams2")
+ test(s"$C#wrongParams3")
+ test(s"$C#wrongRet1")
+ test(s"$C#wrongRet2")
+ test(s"$C#wrongExec1")
+ test(s"$C#wrongExec2")
}
@Test
def test(): Unit =
test(
TestDesc(
- truth =
"org.apache.nlpcraft.model.intent.idl.compiler.functions.NCIdlTokensTestWrapper#trueOn123",
+ truth = s"$C#trueOn123",
isCustom = true,
token = Some(tkn(txt = "123")),
tokensUsed = Some(1)
),
TestDesc(
- truth =
"org.apache.nlpcraft.model.intent.idl.compiler.functions.NCIdlTokensTestWrapper#trueOn123",
+ truth = s"$C#trueOn123",
isCustom = true,
token = Some(tkn(txt = "456")),
expectedRes = false,