This is an automated email from the ASF dual-hosted git repository.
sergeykamov pushed a commit to branch NLPCRAFT-278
in repository https://gitbox.apache.org/repos/asf/incubator-nlpcraft.git
The following commit(s) were added to refs/heads/NLPCRAFT-278 by this push:
new 3f617d4 WIP.
3f617d4 is described below
commit 3f617d472f1adbeca94575e96ff31e94a3da9736
Author: Sergey Kamov <[email protected]>
AuthorDate: Thu Mar 25 10:20:50 2021 +0300
WIP.
---
.../idl/compiler/functions/NCIdlFunctionsCollections.scala | 5 +++--
.../intent/idl/compiler/functions/NCIdlFunctionsStrings.scala | 10 ++++++++++
2 files changed, 13 insertions(+), 2 deletions(-)
diff --git
a/nlpcraft/src/test/scala/org/apache/nlpcraft/model/intent/idl/compiler/functions/NCIdlFunctionsCollections.scala
b/nlpcraft/src/test/scala/org/apache/nlpcraft/model/intent/idl/compiler/functions/NCIdlFunctionsCollections.scala
index 8ef84e0..4767d77 100644
---
a/nlpcraft/src/test/scala/org/apache/nlpcraft/model/intent/idl/compiler/functions/NCIdlFunctionsCollections.scala
+++
b/nlpcraft/src/test/scala/org/apache/nlpcraft/model/intent/idl/compiler/functions/NCIdlFunctionsCollections.scala
@@ -57,8 +57,9 @@ class NCIdlFunctionsCollections extends NCIdlFunctions {
"size(list(2.0, 1, 3)) == 3",
"length(list(2.0, 1, 3)) == 3",
"count(list(2.0, 1, 3)) == 3",
- "is_empty(list()) == true",
- "non_empty(list(1)) == true",
+ "size(list()) == 0",
+ "length(list()) == 0",
+ "count(list()) == 0",
s"keys(json('$js')) == list('k1')",
s"values(json('$js')) == list('v1')",
s"distinct(list(1, 2, 3, 3, 2)) == list(1, 2, 3)",
diff --git
a/nlpcraft/src/test/scala/org/apache/nlpcraft/model/intent/idl/compiler/functions/NCIdlFunctionsStrings.scala
b/nlpcraft/src/test/scala/org/apache/nlpcraft/model/intent/idl/compiler/functions/NCIdlFunctionsStrings.scala
index e0c8be1..9a33eaf 100644
---
a/nlpcraft/src/test/scala/org/apache/nlpcraft/model/intent/idl/compiler/functions/NCIdlFunctionsStrings.scala
+++
b/nlpcraft/src/test/scala/org/apache/nlpcraft/model/intent/idl/compiler/functions/NCIdlFunctionsStrings.scala
@@ -56,7 +56,15 @@ class NCIdlFunctionsStrings extends NCIdlFunctions {
"split_trim('1 A ', ' ') == list('1', 'A')",
"is_empty('a') == false",
"non_empty('a') == true",
+ "non_empty('a ') == true",
"is_empty('') == true",
+ "length(' ') == 1",
+ "length('') == 0",
+ "to_double('1.1') == 1.1",
+ "to_double('1') == 1",
+ "to_double('1') == 1.0",
+ "to_int('1') == 1",
+ "to_int('1') == 1.0",
// Whitespaces.
"replace('abc', 'ab', '') == 'c'",
@@ -73,5 +81,7 @@ class NCIdlFunctionsStrings extends NCIdlFunctions {
expectError("substr('abc', 10, 30) == 'bc'")
expectError("split('1 A') == true")
expectError("split_trim('1 A') == true")
+ expectError("to_double('1, 1') == true")
+ expectError("to_double('A') == true")
}
}