From 552454a0ee24f5e7fa33ab4ced2f9b3cdb2eb94c Mon Sep 17 00:00:00 2001
From: "kyle.cao" <kyle.cao@vesoft.com>
Date: Fri, 16 Apr 2021 17:36:38 +0800
Subject: [PATCH] Add tck case (#960)

---
 .../tck/features/expression/ListComprehension.feature | 11 +++++++++++
 tests/tck/features/expression/Predicate.feature       |  8 ++++----
 tests/tck/features/expression/Reduce.feature          | 11 +++++++++++
 3 files changed, 26 insertions(+), 4 deletions(-)

diff --git a/tests/tck/features/expression/ListComprehension.feature b/tests/tck/features/expression/ListComprehension.feature
index 2a08998d..b12c3051 100644
--- a/tests/tck/features/expression/ListComprehension.feature
+++ b/tests/tck/features/expression/ListComprehension.feature
@@ -95,3 +95,14 @@ Feature: ListComprehension
     Then the result should be, in any order:
       | a    |
       | NULL |
+
+  Scenario: aggregate function in collection
+    Given a graph with space named "nba"
+    When executing query:
+      """
+      UNWIND [1, 2, 3, 4, 5] AS a RETURN a * 2 AS x
+      | RETURN [n in collect($-.x) WHERE n > 5 | n + 1] AS list
+      """
+    Then the result should be, in any order:
+      | list       |
+      | [7, 9, 11] |
diff --git a/tests/tck/features/expression/Predicate.feature b/tests/tck/features/expression/Predicate.feature
index 00da6406..360e8481 100644
--- a/tests/tck/features/expression/Predicate.feature
+++ b/tests/tck/features/expression/Predicate.feature
@@ -101,28 +101,28 @@ Feature: Predicate
     Given a graph with space named "nba"
     When executing query:
       """
-      unwind [1, 2, 3, 4, 5] as a return a * 2 as x | return any(n in collect($-.x) where n > 5) as myboo
+      UNWIND [1, 2, 3, 4, 5] AS a RETURN a * 2 AS x | RETURN any(n in collect($-.x) WHERE n > 5) AS myboo
       """
     Then the result should be, in any order:
       | myboo |
       | true  |
     When executing query:
       """
-      unwind [1, 2, 3, 4, 5] as a return a * 2 as x | return All(n in collect($-.x) where n > 5) as myboo
+      UNWIND [1, 2, 3, 4, 5] AS a RETURN a * 2 AS x | RETURN All(n in collect($-.x) WHERE n > 5) AS myboo
       """
     Then the result should be, in any order:
       | myboo |
       | false |
     When executing query:
       """
-      unwind [1, 2, 3, 4, 5] as a return a * 2 as x | return single(n in collect($-.x) where n > 5) as myboo
+      UNWIND [1, 2, 3, 4, 5] AS a RETURN a * 2 AS x | RETURN single(n in collect($-.x) WHERE n > 5) AS myboo
       """
     Then the result should be, in any order:
       | myboo |
       | false |
     When executing query:
       """
-      unwind [1, 2, 3, 4, 5] as a return a * 2 as x | return None(n in collect($-.x) where n > 5) as myboo
+      UNWIND [1, 2, 3, 4, 5] AS a RETURN a * 2 AS x | RETURN None(n in collect($-.x) WHERE n > 5) AS myboo
       """
     Then the result should be, in any order:
       | myboo |
diff --git a/tests/tck/features/expression/Reduce.feature b/tests/tck/features/expression/Reduce.feature
index 6110cc45..0357c3ed 100644
--- a/tests/tck/features/expression/Reduce.feature
+++ b/tests/tck/features/expression/Reduce.feature
@@ -94,3 +94,14 @@ Feature: Reduce
     Then the result should be, in any order:
       | r    |
       | NULL |
+
+  Scenario: aggregate function in collection
+    Given a graph with space named "nba"
+    When executing query:
+      """
+      UNWIND [1, 2, 3, 4, 5] AS a RETURN a * 2 AS x
+      | RETURN reduce(totalNum = 10, n in collect($-.x) | totalNum + n * 2) AS total
+      """
+    Then the result should be, in any order:
+      | total |
+      | 70    |
-- 
GitLab