From 475d285224fed1bf182ae9ca099eb672648613df Mon Sep 17 00:00:00 2001
From: Marko Budiselic <marko.budiselic@memgraph.io>
Date: Sun, 15 Jul 2018 17:11:06 +0100
Subject: [PATCH] Add end to end test for the Id function

Reviewers: mferencevic

Reviewed By: mferencevic

Subscribers: pullbot

Differential Revision: https://phabricator.memgraph.io/D1471
---
 .../memgraph_V1/features/functions.feature    | 39 +++++++++++++++++++
 1 file changed, 39 insertions(+)

diff --git a/tests/qa/tck_engine/tests/memgraph_V1/features/functions.feature b/tests/qa/tck_engine/tests/memgraph_V1/features/functions.feature
index 1004c0f88..f4afd9429 100644
--- a/tests/qa/tck_engine/tests/memgraph_V1/features/functions.feature
+++ b/tests/qa/tck_engine/tests/memgraph_V1/features/functions.feature
@@ -796,3 +796,42 @@ Feature: Functions
         Then the result should be:
             | n  | zero | one | n2 |
             | 42 | 0    | 1   | 0  |
+
+    Scenario: Vertex Id test:
+        # 1024 should be a runtime parameter.
+        Given an empty graph
+        And having executed:
+            """
+            CREATE (), (), ()
+            """
+        When executing query:
+            """
+            MATCH (n) WITH n ORDER BY id(n)
+            WITH COLLECT(id(n)) AS node_ids
+            UNWIND node_ids AS node_id
+            RETURN (node_id - node_ids[0]) / 1024 AS id;
+            """
+        Then the result should be:
+            | id |
+            | 0  |
+            | 1  |
+            | 2  |
+
+    Scenario: Edge Id test:
+        Given an empty graph
+        And having executed:
+            """
+            CREATE (v1)-[e1:A]->(v2)-[e2:A]->(v3)-[e3:A]->(v4)
+            """
+        When executing query:
+            """
+            MATCH ()-[e]->() WITH e ORDER BY id(e)
+            WITH COLLECT(id(e)) AS edge_ids
+            UNWIND edge_ids AS edge_id
+            RETURN (edge_id - edge_ids[0]) / 1024 AS id;
+            """
+        Then the result should be:
+            | id |
+            | 0  |
+            | 1  |
+            | 2  |