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 3a868f9  WIP.
3a868f9 is described below

commit 3a868f91013386db210a1755f649fc59468c33bf
Author: Sergey Kamov <[email protected]>
AuthorDate: Wed Mar 24 10:55:22 2021 +0300

    WIP.
---
 .../functions/NCIdlFunctionsCollections.scala      | 33 ++++++++++++++++++++--
 1 file changed, 30 insertions(+), 3 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 d39bc56..010a4c3 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
@@ -23,15 +23,42 @@ import org.junit.jupiter.api.Test
   * Tests for 'collections' functions.
   */
 class NCIdlFunctionsCollections extends NCIdlFunctions {
+    private final val js = "{\"k1\": \"v1\"}"
+
     @Test
     def test(): Unit =
         test(
+            "list(1, 2, 3) == list(1, 2, 3)",
+            "list(1.0, 2, 3) == list(1.0, 2, 3)",
+            "list(1, 2, 3) != list(1.0, 2, 3)",
+            "get(list(1, 2, 3), 1) == 2",
+            "has(list(1, 2, 3), 1) == true",
+            "has(list(1.1, 2.1, 3.1), 1.1) == true",
+            "has(list(1.0, 2.0, 3.0), 1.0) == true",
+            // TODO: false?
+            //"has(list(1.0, 2.0, 3.0), 1) == true",
+            "has(list('1', '2', '3'), '1') == true",
+            "has(list(1, 2, 3), 5) == false",
+            "has(list(1.1, 2.1, 3.1), 5.1) == false",
+            "has(list('1', '2', '3'), '5') == false",
+            "has_any(list('1', '2', '3'), list('1', '20', '30')) == true",
+            "has_any(list('1', '2', '3'), list('10', '20', '30')) == false",
+            "has_all(list('1', '2', '3'), list('1', '20', '30')) == false",
+            "has_all(list('1', '2', '3'), list('1', '2', '3')) == true",
+            "first(list(1, 2, 3)) == 1",
+            "@lst = list(1, 2, 3) first(reverse(@lst)) == last(@lst)",
+            "last(list(1, 2, 3)) == 3",
             "is_empty(list()) == true",
             "is_empty(list(1)) == false",
             "non_empty(list()) == false",
             "non_empty(list(1)) == true",
-            "first(list(1, 2, 3)) == 1",
-            "@lst = list(1, 2, 3) first(reverse(@lst)) == last(@lst)",
-            "last(list(1, 2, 3)) == 3"
+            "reverse(list(1.0, 2, 3)) == list(3, 2, 1.0)",
+            "sort(list(2, 1, 3)) == list(1, 2, 3)",
+            "sort(list(2.0, 1, 3)) == list(1, 2.0, 3)",
+            "size(list(2.0, 1, 3)) == 3",
+            "length(list(2.0, 1, 3)) == 3",
+            "count(list(2.0, 1, 3)) == 3",
+            s"keys(json('$js')) == list('k1')",
+            s"values(json('$js')) == list('v1')"
         )
 }

Reply via email to