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/22 18:48:25 UTC

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

TINKERPOP-1784 Added feature tests for filter()


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

Branch: refs/heads/master
Commit: 77d59ddf9c323842872c875445e35952210784ca
Parents: bd3868b
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Fri Oct 20 15:13:06 2017 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Tue Nov 21 15:52:52 2017 -0500

----------------------------------------------------------------------
 gremlin-test/features/filter/Filter.feature     | 106 +++++++++++++++++++
 .../gremlin/process/FeatureCoverageTest.java    |   2 +
 2 files changed, 108 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/77d59ddf/gremlin-test/features/filter/Filter.feature
----------------------------------------------------------------------
diff --git a/gremlin-test/features/filter/Filter.feature b/gremlin-test/features/filter/Filter.feature
new file mode 100644
index 0000000..05e7cea
--- /dev/null
+++ b/gremlin-test/features/filter/Filter.feature
@@ -0,0 +1,106 @@
+# 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 - filter()
+
+  Scenario: g_V_filterXfalseX
+    Given the modern graph
+    And using the parameter l1 defined as "c[false]"
+    And the traversal of
+      """
+      g.V().filter(l1)
+      """
+    When iterated to list
+    Then the result should be empty
+
+  Scenario: g_V_filterXtrueX
+    Given the modern graph
+    And using the parameter l1 defined as "c[true]"
+    And the traversal of
+      """
+      g.V().filter(l1)
+      """
+    When iterated to list
+    Then the result should be unordered
+      | v[marko] |
+      | v[vadas] |
+      | v[lop] |
+      | v[josh] |
+      | v[ripple] |
+      | v[peter]  |
+
+  Scenario: g_V_filterXlang_eq_javaX
+    Given the modern graph
+    And using the parameter l1 defined as "c[it.get().property('lang').orElse('none').equals('java')]"
+    And the traversal of
+      """
+      g.V().filter(l1)
+      """
+    When iterated to list
+    Then the result should be unordered
+      | v[ripple] |
+      | v[lop]  |
+
+  Scenario: g_VX1X_out_filterXage_gt_30X
+    Given the modern graph
+    And using the parameter v1Id defined as "v[marko].id"
+    And using the parameter l1 defined as "c[it.get().property('age').orElse(0) > 30]"
+    And the traversal of
+      """
+      g.V(v1Id).out().filter(l1)
+      """
+    When iterated to list
+    Then the result should be unordered
+      | v[josh] |
+
+  Scenario: g_V_filterXname_startsWith_m_OR_name_startsWith_pX
+    Given the modern graph
+    And using the parameter l1 defined as "c[{name = it.get().value('name'); name.startsWith('m') || name.startsWith('p')}]"
+    And the traversal of
+      """
+      g.V().filter(l1)
+      """
+    When iterated to list
+    Then the result should be unordered
+      | v[marko] |
+      | v[peter]  |
+
+  Scenario: g_E_filterXfalseX
+    Given the modern graph
+    And using the parameter l1 defined as "c[false]"
+    And the traversal of
+      """
+      g.E().filter(l1)
+      """
+    When iterated to list
+    Then the result should be empty
+
+  Scenario: g_E_filterXtrueX
+    Given the modern graph
+    And using the parameter l1 defined as "c[true]"
+    And the traversal of
+      """
+      g.E().filter(l1)
+      """
+    When iterated to list
+    Then the result should be unordered
+      | e[marko-created->lop] |
+      | e[marko-knows->josh] |
+      | e[marko-knows->vadas] |
+      | e[peter-created->lop] |
+      | e[josh-created->lop] |
+      | e[josh-created->ripple] |
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/77d59ddf/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 282d8a8..dba865b 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
@@ -23,6 +23,7 @@ import org.apache.tinkerpop.gremlin.process.traversal.step.branch.ChooseTest;
 import org.apache.tinkerpop.gremlin.process.traversal.step.branch.OptionalTest;
 import org.apache.tinkerpop.gremlin.process.traversal.step.filter.CoinTest;
 import org.apache.tinkerpop.gremlin.process.traversal.step.filter.DropTest;
+import org.apache.tinkerpop.gremlin.process.traversal.step.filter.FilterTest;
 import org.apache.tinkerpop.gremlin.process.traversal.step.filter.IsTest;
 import org.apache.tinkerpop.gremlin.process.traversal.step.filter.OrTest;
 import org.apache.tinkerpop.gremlin.process.traversal.step.map.CountTest;
@@ -75,6 +76,7 @@ public class FeatureCoverageTest {
                 // filter
                 CoinTest.class,
                 DropTest.class,
+                FilterTest.class,
                 IsTest.class,
                 OrTest.class,
                 // map