You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by sp...@apache.org on 2017/11/11 00:56:47 UTC

[43/50] tinkerpop git commit: TINKERPOP-1784 Added feature tests for order()

TINKERPOP-1784 Added feature tests for order()


Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/25771f7c
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/25771f7c
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/25771f7c

Branch: refs/heads/TINKERPOP-1784
Commit: 25771f7c3fbe8d714b2c76a096586800b981dd8c
Parents: d554861
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Fri Nov 10 14:15:28 2017 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Nov 10 19:55:21 2017 -0500

----------------------------------------------------------------------
 gremlin-test/features/map/Order.feature | 132 +++++++++++++++++++++++++++
 1 file changed, 132 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/25771f7c/gremlin-test/features/map/Order.feature
----------------------------------------------------------------------
diff --git a/gremlin-test/features/map/Order.feature b/gremlin-test/features/map/Order.feature
new file mode 100644
index 0000000..9005465
--- /dev/null
+++ b/gremlin-test/features/map/Order.feature
@@ -0,0 +1,132 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+Feature: Step - order()
+
+  Scenario: g_V_name_order
+    Given the modern graph
+    And the traversal of
+      """
+      g.V().values("name").order()
+      """
+    When iterated to list
+    Then the result should be ordered
+      | result |
+      | josh |
+      | lop  |
+      | marko |
+      | peter |
+      | ripple |
+      | vadas  |
+
+  Scenario: g_V_name_order_byXa1_b1X_byXb2_a2X
+    Given the modern graph
+    And using the parameter l1 defined as "c[a, b -> a.substring(1, 2).compareTo(b.substring(1, 2))]"
+    And using the parameter l2 defined as "c[a, b -> b.substring(2, 3).compareTo(a.substring(2, 3))]"
+    And the traversal of
+      """
+      g.V().values("name").order().by(l1).by(l2)
+      """
+    When iterated to list
+    Then the result should be ordered
+      | result |
+      | marko  |
+      | vadas  |
+      | peter  |
+      | ripple |
+      | josh   |
+      | lop    |
+
+  Scenario: g_V_order_byXname_incrX_name
+    Given the modern graph
+    And the traversal of
+      """
+      g.V().order().by("name", Order.incr).values("name")
+      """
+    When iterated to list
+    Then the result should be ordered
+      | result |
+      | josh |
+      | lop  |
+      | marko |
+      | peter |
+      | ripple |
+      | vadas  |
+
+  Scenario: g_V_order_byXnameX_name
+    Given the modern graph
+    And the traversal of
+      """
+      g.V().order().by("name").values("name")
+      """
+    When iterated to list
+    Then the result should be ordered
+      | result |
+      | josh |
+      | lop  |
+      | marko |
+      | peter |
+      | ripple |
+      | vadas  |
+
+  Scenario: g_V_outE_order_byXweight_decrX_weight
+    Given the modern graph
+    And the traversal of
+      """
+      g.V().outE().order().by("weight", Order.decr).values("weight")
+      """
+    When iterated to list
+    Then the result should be ordered
+      | result |
+      | d[1.0] |
+      | d[1.0] |
+      | d[0.5] |
+      | d[0.4] |
+      | d[0.4] |
+      | d[0.2] |
+
+  Scenario: g_V_order_byXname_a1_b1X_byXname_b2_a2X_name
+    Given the modern graph
+    And using the parameter l1 defined as "c[a, b -> a.substring(1, 2).compareTo(b.substring(1, 2))]"
+    And using the parameter l2 defined as "c[a, b -> b.substring(2, 3).compareTo(a.substring(2, 3))]"
+    And the traversal of
+      """
+      g.V().order().by("name", l1).by("name", l2).values("name")
+      """
+    When iterated to list
+    Then the result should be ordered
+      | result |
+      | marko  |
+      | vadas  |
+      | peter  |
+      | ripple |
+      | josh   |
+      | lop    |
+
+  Scenario: g_V_asXaX_outXcreatedX_asXbX_order_byXshuffleX_selectXa_bX
+    Given the modern graph
+    And the traversal of
+      """
+      g.V().as("a").out("created").as("b").order().by(Order.shuffle).select("a", "b")
+      """
+    When iterated to list
+    Then the result should be unordered
+      | result |
+      | m[{"a":"v[marko]","b":"v[lop]"}] |
+      | m[{"a":"v[peter]","b":"v[lop]"}] |
+      | m[{"a":"v[josh]","b":"v[ripple]"}] |
+      | m[{"a":"v[josh]","b":"v[lop]"}] |