Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change substring() to use startIndex, endIndex instead of startIndex, length #85

Closed
wants to merge 1 commit into from

Conversation

ryn5
Copy link

@ryn5 ryn5 commented Oct 12, 2023

No description provided.

@codecov
Copy link

codecov bot commented Oct 12, 2023

Codecov Report

Merging #85 (c87171b) into master (1e3c881) will increase coverage by 0.44%.
Report is 14 commits behind head on master.
The diff coverage is 100.00%.

@@             Coverage Diff              @@
##             master      #85      +/-   ##
============================================
+ Coverage     75.86%   76.30%   +0.44%     
- Complexity    12737    12803      +66     
============================================
  Files          1060     1037      -23     
  Lines         64353    60637    -3716     
  Branches       7110     7136      +26     
============================================
- Hits          48821    46270    -2551     
+ Misses        12891    11917     -974     
+ Partials       2641     2450     -191     
Files Coverage Δ
...in/process/traversal/dsl/graph/GraphTraversal.java 93.62% <100.00%> (-0.15%) ⬇️
...kerpop/gremlin/process/traversal/dsl/graph/__.java 79.68% <100.00%> (ø)
...mlin/process/traversal/step/map/SubstringStep.java 100.00% <100.00%> (ø)

... and 40 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

CHANGELOG.asciidoc Outdated Show resolved Hide resolved
Copy link

@Cole-Greer Cole-Greer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, just a few minor docs nits and I think it's ready for an external PR.

// to the positive index position or 0 when negative index exceeds the string length, which means an empty string
// will be returned, if it is positive and exceeds the length of the string, it is converted to the length of the
// string.
private int processEndIndex(int strLen) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is basically the same function as processStartIndex(). Consider refactoring.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Merged into processStringIndex()

assertEquals("ello world", __.__("hello world").substring(1, 11).next());
assertEquals("d", __.__("hello world").substring(10, 11).next());
assertEquals("hello world", __.__("hello world").substring(-11, 11).next());
assertEquals("h", __.__("hello world").substring(-11, 1).next());
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing a test for two negative numbers like (-3,-2).

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added (-3, -1) and (-1, -3) cases

docs/src/dev/provider/gremlin-semantics.asciidoc Outdated Show resolved Hide resolved
@@ -55,11 +55,11 @@ Feature: Step - substring()
| p |
| pple |

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

General comment, I would add some feature test cases with combinations of (pos start index, neg end index), (neg start index, pos end index), and (neg start index, neg end index).

@ryn5 ryn5 force-pushed the ryan/substring-update branch from 02b865b to c87171b Compare October 17, 2023 19:03
@ryn5 ryn5 closed this Dec 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants