Added a fix and more test cases for TINKERPOP-1528. The fix was just the change 
of a wrongly initialized boolean value.


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

Branch: refs/heads/TINKERPOP-1612
Commit: 83125578df6d89d1a617ffa2a1c3c82d0f78f331
Parents: c49c107
Author: Daniel Kuppitz <[email protected]>
Authored: Sat Feb 25 19:35:05 2017 +0100
Committer: Daniel Kuppitz <[email protected]>
Committed: Sat Feb 25 19:35:05 2017 +0100

----------------------------------------------------------------------
 .../strategy/optimization/RangeByIsCountStrategy.java |  2 +-
 .../optimization/RangeByIsCountStrategyTest.java      | 14 ++++++++++----
 2 files changed, 11 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/83125578/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/RangeByIsCountStrategy.java
----------------------------------------------------------------------
diff --git 
a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/RangeByIsCountStrategy.java
 
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/RangeByIsCountStrategy.java
index 9dcb380..b0cdb39 100644
--- 
a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/RangeByIsCountStrategy.java
+++ 
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/RangeByIsCountStrategy.java
@@ -101,7 +101,7 @@ public final class RangeByIsCountStrategy extends 
AbstractTraversalStrategy<Trav
                         final boolean update = highRange == null || 
highRangeCandidate > highRange;
                         if (update) {
                             if (parent instanceof EmptyStep) {
-                                useNotStep = true;
+                                useNotStep = false;
                             } else {
                                 if (parent instanceof RepeatStep) {
                                     final RepeatStep repeatStep = (RepeatStep) 
parent;

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/83125578/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/RangeByIsCountStrategyTest.java
----------------------------------------------------------------------
diff --git 
a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/RangeByIsCountStrategyTest.java
 
b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/RangeByIsCountStrategyTest.java
index 8023e35..9f3b97d 100644
--- 
a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/RangeByIsCountStrategyTest.java
+++ 
b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/RangeByIsCountStrategyTest.java
@@ -56,11 +56,17 @@ public class RangeByIsCountStrategyTest {
     public static Iterable<Object[]> generateTestParameters() {
 
         return Arrays.asList(new Traversal[][]{
-                {__.count().is(0), __.not(__.identity())},
+                {__.count().is(0), __.limit(1).count().is(0)},
                 {__.count().is(1), __.limit(2).count().is(1)},
-                {__.out().count().is(0), __.not(__.out())},
-                {__.outE().count().is(lt(1)), __.not(__.outE())},
-                {__.both().count().is(lte(0)), __.not(__.both())},
+                {__.out().count().is(0), __.out().limit(1).count().is(0)},
+                {__.outE().count().is(lt(1)), 
__.outE().limit(1).count().is(lt(1))},
+                {__.both().count().is(lte(0)), 
__.both().limit(1).count().is(lte(0))},
+                {__.map(__.out().count().is(0)), 
__.map(__.out().limit(1).count().is(0))},
+                {__.map(__.outE().count().is(lt(1))), 
__.map(__.outE().limit(1).count().is(lt(1)))},
+                {__.map(__.both().count().is(lte(0))), 
__.map(__.both().limit(1).count().is(lte(0)))},
+                {__.filter(__.out().count().is(0)), __.not(__.out())},
+                {__.filter(__.outE().count().is(lt(1))), __.not(__.outE())},
+                {__.filter(__.both().count().is(lte(0))), __.not(__.both())},
                 {__.store("x").count().is(0).as("a"), 
__.store("x").limit(1).count().is(0).as("a")},
                 {__.out().count().as("a").is(0), 
__.out().limit(1).count().as("a").is(0)},
                 {__.out().count().is(neq(4)), 
__.out().limit(5).count().is(neq(4))},

Reply via email to