TINKERPOP-1857 Added full coverage of order() GLV tests

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

Branch: refs/heads/TINKERPOP-1857
Commit: 4dcd01770198e3be0139a1ad449c516ef2bb7f56
Parents: 720b2de
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Tue Feb 6 08:04:10 2018 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Feb 9 14:30:59 2018 -0500

----------------------------------------------------------------------
 gremlin-test/features/map/Order.feature         | 193 +++++++++++++++++++
 .../gremlin/process/FeatureCoverageTest.java    |   4 +-
 2 files changed, 196 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/4dcd0177/gremlin-test/features/map/Order.feature
----------------------------------------------------------------------
diff --git a/gremlin-test/features/map/Order.feature 
b/gremlin-test/features/map/Order.feature
index 976906f..e7ff00c 100644
--- a/gremlin-test/features/map/Order.feature
+++ b/gremlin-test/features/map/Order.feature
@@ -130,3 +130,196 @@ Feature: Step - order()
       | m[{"a":"v[peter]","b":"v[lop]"}] |
       | m[{"a":"v[josh]","b":"v[ripple]"}] |
       | m[{"a":"v[josh]","b":"v[lop]"}] |
+
+  Scenario: g_V_both_hasLabelXpersonX_order_byXage_decrX_limitX5X_name
+    Given the modern graph
+    And the traversal of
+      """
+      g.V().both().hasLabel("person").order().by("age", 
Order.decr).limit(5).values("name")
+      """
+    When iterated to list
+    Then the result should be ordered
+      | result |
+      | peter  |
+      | josh  |
+      | josh  |
+      | josh |
+      | marko  |
+
+  Scenario: g_V_properties_order_byXkey_decrX_key
+    Given the modern graph
+    And the traversal of
+      """
+      g.V().properties().order().by(T.key, Order.decr).key()
+      """
+    When iterated to list
+    Then the result should be ordered
+      | result |
+      | name   |
+      | name   |
+      | name   |
+      | name   |
+      | name   |
+      | name   |
+      | lang   |
+      | lang   |
+      | age    |
+      | age    |
+      | age    |
+      | age    |
+
+  Scenario: g_V_hasLabelXpersonX_order_byXvalueXageX__decrX_name
+    Given the modern graph
+    And using the parameter l1 defined as "c[it.value('age')]"
+    And the traversal of
+      """
+      g.V().hasLabel("person").order().by(l1, Order.decr).values("name")
+      """
+    When iterated to list
+    Then the result should be ordered
+      | result |
+      | peter  |
+      | josh   |
+      | marko  |
+      | vadas  |
+
+  Scenario: 
g_V_hasLabelXpersonX_group_byXnameX_byXoutE_weight_sumX_orderXlocalX_byXvaluesX
+    Given the modern graph
+    And the traversal of
+      """
+      
g.V().hasLabel("person").group().by("name").by(__.outE().values("weight").sum()).order(Scope.local).by(Column.values)
+      """
+    When iterated to list
+    Then the result should be ordered
+      | result |
+      | 
m[{"vadas":"d[0].d","peter":"d[0.2].d","josh":"d[1.4].d","marko":"d[1.9].d"}] |
+
+  Scenario: g_V_localXbothE_weight_foldX_order_byXsumXlocalX_decrX
+    Given the modern graph
+    And the traversal of
+      """
+      
g.V().local(__.bothE().values("weight").fold()).order().by(__.sum(Scope.local), 
Order.decr)
+      """
+    When iterated to list
+    Then the result should be ordered
+      | result |
+      | l[d[1.0].f,d[0.4].f,d[1.0].f] |
+      | l[d[0.4].f,d[0.5].f,d[1.0].f] |
+      | l[d[0.4].f,d[0.4].f,d[0.2].f] |
+      | l[d[1.0].f]                   |
+      | l[d[0.5].f]                   |
+      | l[d[0.2].f]                   |
+
+  Scenario: g_V_group_byXlabelX_byXname_order_byXdecrX_foldX
+    Given the modern graph
+    And the traversal of
+      """
+      
g.V().group().by(T.label).by(__.values("name").order().by(Order.decr).fold())
+      """
+    When iterated to list
+    Then the result should be ordered
+      | result |
+      | m[{"software":"l[ripple,lop]","person":"l[vadas,peter,marko,josh]"}]  |
+
+  Scenario: 
g_V_hasLabelXpersonX_group_byXnameX_byXoutE_weight_sumX_unfold_order_byXvalues_decrX
+    Given the modern graph
+    And the traversal of
+      """
+      
g.V().hasLabel("person").group().by("name").by(__.outE().values("weight").sum()).unfold().order().by(Column.values,
 Order.decr)
+      """
+    When iterated to list
+    Then the result should be ordered
+      | result |
+      | m[{"marko":"d[1.9].d"}]  |
+      | m[{"josh":"d[1.4].d"}]  |
+      | m[{"peter":"d[0.2].d"}]  |
+      | m[{"vadas":"d[0].d"}]  |
+
+  Scenario: 
g_V_asXvX_mapXbothE_weight_foldX_sumXlocalX_asXsX_selectXv_sX_order_byXselectXsX_decrX
+    Given the modern graph
+    And the traversal of
+      """
+      
g.V().as("v").map(__.bothE().values("weight").fold()).sum(Scope.local).as("s").select("v",
 "s").order().by(__.select("s"), Order.decr)
+      """
+    When iterated to list
+    Then the result should be ordered
+      | result |
+      | m[{"v":"v[josh]","s":"d[2.4].d"}]  |
+      | m[{"v":"v[marko]","s":"d[1.9].d"}]  |
+      | m[{"v":"v[lop]","s":"d[1.0].d"}]  |
+      | m[{"v":"v[ripple]","s":"d[1.0].d"}]  |
+      | m[{"v":"v[vadas]","s":"d[0.5].d"}]  |
+      | m[{"v":"v[peter]","s":"d[0.2].d"}]  |
+
+  Scenario: g_V_hasLabelXpersonX_fold_orderXlocalX_byXageX
+    Given the modern graph
+    And the traversal of
+      """
+      g.V().hasLabel("person").fold().order(Scope.local).by("age")
+      """
+    When iterated to list
+    Then the result should be ordered
+      | result |
+      | l[v[vadas],v[marko],v[josh],v[peter]] |
+
+  Scenario: g_V_both_hasLabelXpersonX_order_byXage_decrX_name
+    Given the modern graph
+    And the traversal of
+      """
+      g.V().both().hasLabel("person").order().by("age", 
Order.decr).values("name")
+      """
+    When iterated to list
+    Then the result should be ordered
+      | result |
+      | peter  |
+      | josh   |
+      | josh   |
+      | josh   |
+      | marko  |
+      | marko  |
+      | marko  |
+      | vadas  |
+
+  Scenario: g_V_order_byXoutE_count__decrX
+    Given the modern graph
+    And the traversal of
+      """
+      g.V().order().by(__.outE().count(), Order.decr)
+      """
+    When iterated to list
+    Then the result should be ordered
+      | result |
+      | v[marko] |
+      | v[josh]   |
+      | v[peter] |
+      | v[vadas] |
+      | v[lop] |
+      | v[ripple] |
+
+  Scenario: g_V_hasLabelXpersonX_order_byXageX
+    Given the modern graph
+    And the traversal of
+      """
+      g.V().hasLabel("person").order().by("age")
+      """
+    When iterated to list
+    Then the result should be ordered
+      | result |
+      | v[vadas] |
+      | v[marko] |
+      | v[josh]   |
+      | v[peter] |
+
+  Scenario: 
g_VX1X_hasXlabel_personX_mapXmapXint_ageXX_orderXlocalX_byXvalues_decrX_byXkeys_incrX
+    Given the modern graph
+    And using the parameter v1 defined as "v[marko]"
+    And using the parameter l1 defined as 
"c[[1:it.get().value('age'),2:it.get().value('age')*2,3:it.get().value('age')*3,4:it.get().value('age')]]"
+    And the traversal of
+      """
+      g.V(v1).hasLabel("person").map(l1).order(Scope.local).by(Column.values, 
Order.decr).by(Column.keys, Order.incr)
+      """
+    When iterated to list
+    Then the result should be ordered
+      | result |
+      | m[{"3":"d[87].i","2":"d[58].i","1":"d[29].i","4":"d[29].i"}] |
+

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/4dcd0177/gremlin-test/src/test/java/org/apache/tinkerpop/gremlin/process/FeatureCoverageTest.java
----------------------------------------------------------------------
diff --git 
a/gremlin-test/src/test/java/org/apache/tinkerpop/gremlin/process/FeatureCoverageTest.java
 
b/gremlin-test/src/test/java/org/apache/tinkerpop/gremlin/process/FeatureCoverageTest.java
index 48c64b9..b2a83d7 100644
--- 
a/gremlin-test/src/test/java/org/apache/tinkerpop/gremlin/process/FeatureCoverageTest.java
+++ 
b/gremlin-test/src/test/java/org/apache/tinkerpop/gremlin/process/FeatureCoverageTest.java
@@ -113,7 +113,9 @@ public class FeatureCoverageTest {
             
"g_V_matchXa_hasXname_GarciaX__a_0writtenBy_b__b_followedBy_c__c_writtenBy_d__whereXd_neqXaXXX",
             
"g_V_matchXa_0sungBy_b__a_0writtenBy_c__b_writtenBy_dX_whereXc_sungBy_dX_whereXd_hasXname_GarciaXX",
             
"get_g_V_matchXa_followedBy_count_isXgtX10XX_b__a_0followedBy_count_isXgtX10XX_bX_count",
-            
"g_V_matchXa_followedBy_count_isXgtX10XX_b__a_0followedBy_count_isXgtX10XX_bX_count");
+            
"g_V_matchXa_followedBy_count_isXgtX10XX_b__a_0followedBy_count_isXgtX10XX_bX_count",
+            
"g_V_hasXsong_name_OHBOYX_outXfollowedByX_outXfollowedByX_order_byXperformancesX_byXsongType_incrX",
+            
"g_V_hasLabelXsongX_order_byXperfomances_decrX_byXnameX_rangeX110_120X_name");
 
     @Test
     // @Ignore("As it stands we won't have all of these tests migrated 
initially so there is no point to running this in full - it can be flipped on 
later")

Reply via email to