-
Notifications
You must be signed in to change notification settings - Fork 0
Feature/add slice #14
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
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
e5cf005
Added a UTF-8 ValueStringBuilder in the Utf8 namespace, with correspo…
mwadams 6461895
Added Slice()
mwadams f01d340
Merged with main.
mwadams e03ede4
Added tests for the slice capability.
mwadams efd54a6
Addressed review comments.
mwadams File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
69 changes: 69 additions & 0 deletions
69
Solutions/Corvus.HighPerformance.Specs/ValueStringBuilderFeatures/Slice.feature
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| Feature: Slice values from a ValueStringBuilder | ||
|
|
||
| Scenario Outline: Slice the ValueStringBuilder | ||
| Given a ValueStringBuilder initialized with '<InitializationType>' of length <InitialLength> | ||
| And I append 'Hello' to the ValueStringBuilder | ||
| And I slice <Start> characters from the start of the ValueStringBuilder | ||
| When I get the Span from the ValueStringBuilder | ||
| Then the ValueStringBuilder string should be '<ExpectedValue>' | ||
| Examples: | ||
| | InitializationType | InitialLength | Start | ExpectedValue | | ||
| | Span | 10 | 0 | Hello | | ||
| | Capacity | 10 | 0 | Hello | | ||
| | Span | 10 | 1 | ello | | ||
| | Capacity | 10 | 1 | ello | | ||
| | Span | 10 | 2 | llo | | ||
| | Capacity | 10 | 2 | llo | | ||
| | Span | 10 | 5 | | | ||
| | Capacity | 10 | 5 | | | ||
|
|
||
| Scenario Outline: Slice the ValueStringBuilder with start and length | ||
| Given a ValueStringBuilder initialized with '<InitializationType>' of length <InitialLength> | ||
| And I append 'Hello' to the ValueStringBuilder | ||
| And I slice <Start> characters from the start of the ValueStringBuilder with length <Length> | ||
| When I get the Span from the ValueStringBuilder | ||
| Then the ValueStringBuilder string should be '<ExpectedValue>' | ||
| Examples: | ||
| | InitializationType | InitialLength | Start | Length | ExpectedValue | | ||
| | Span | 10 | 0 | 5 | Hello | | ||
| | Capacity | 10 | 0 | 5 | Hello | | ||
| | Span | 10 | 1 | 4 | ello | | ||
| | Capacity | 10 | 1 | 4 | ello | | ||
| | Span | 10 | 2 | 3 | llo | | ||
| | Capacity | 10 | 2 | 3 | llo | | ||
| | Span | 10 | 0 | 4 | Hell | | ||
| | Capacity | 10 | 0 | 4 | Hell | | ||
| | Span | 10 | 1 | 3 | ell | | ||
| | Capacity | 10 | 1 | 3 | ell | | ||
| | Span | 10 | 2 | 2 | ll | | ||
| | Capacity | 10 | 2 | 2 | ll | | ||
| | Span | 10 | 1 | 0 | | | ||
| | Capacity | 10 | 1 | 0 | | | ||
| | Span | 10 | 0 | 0 | | | ||
| | Capacity | 10 | 0 | 0 | | | ||
|
|
||
| Scenario Outline: Specified range is out of bounds (start and length) | ||
| Given a ValueStringBuilder initialized with '<InitializationType>' of length 25 | ||
| And I append 'Hello' to the ValueStringBuilder | ||
| And I slice <Start> characters from the start of the ValueStringBuilder with length <Length> | ||
| Then the attempt should have thrown a 'System.ArgumentOutOfRangeException' | ||
| Examples: | ||
| | InitializationType | Start | Length | | ||
| | Span | 0 | 6 | | ||
| | Span | 1 | 5 | | ||
| | Span | 5 | 1 | | ||
| | Span | 6 | 0 | | ||
| | Capacity | 0 | 6 | | ||
| | Capacity | 1 | 5 | | ||
| | Capacity | 5 | 1 | | ||
| | Capacity | 6 | 0 | | ||
|
|
||
| Scenario Outline: Specified range is out of bounds (start only) | ||
| Given a ValueStringBuilder initialized with '<InitializationType>' of length 25 | ||
| And I append 'Hello' to the ValueStringBuilder | ||
| And I slice <Start> characters from the start of the ValueStringBuilder | ||
| Then the attempt should have thrown a 'System.ArgumentOutOfRangeException' | ||
| Examples: | ||
| | InitializationType | Start | | ||
| | Span | 6 | | ||
| | Capacity | 7 | |
69 changes: 69 additions & 0 deletions
69
Solutions/Corvus.HighPerformance.Specs/ValueStringBuilderFeatures/Utf8/SliceUtf8.feature
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| Feature: Slice values from a UTF-8 ValueStringBuilder | ||
|
|
||
| Scenario Outline: Slice the UTF-8 ValueStringBuilder | ||
| Given a UTF-8 ValueStringBuilder initialized with '<InitializationType>' of length <InitialLength> | ||
| And I append 'Hello' to the UTF-8 ValueStringBuilder | ||
| And I slice <Start> characters from the start of the UTF-8 ValueStringBuilder | ||
| When I get the Span from the UTF-8 ValueStringBuilder | ||
| Then the UTF-8 ValueStringBuilder string should be '<ExpectedValue>' | ||
| Examples: | ||
| | InitializationType | InitialLength | Start | ExpectedValue | | ||
| | Span | 10 | 0 | Hello | | ||
| | Capacity | 10 | 0 | Hello | | ||
| | Span | 10 | 1 | ello | | ||
| | Capacity | 10 | 1 | ello | | ||
| | Span | 10 | 2 | llo | | ||
| | Capacity | 10 | 2 | llo | | ||
| | Span | 10 | 5 | | | ||
| | Capacity | 10 | 5 | | | ||
|
|
||
| Scenario Outline: Slice the UTF-8 ValueStringBuilder with start and length | ||
| Given a UTF-8 ValueStringBuilder initialized with '<InitializationType>' of length <InitialLength> | ||
| And I append 'Hello' to the UTF-8 ValueStringBuilder | ||
| And I slice <Start> characters from the start of the UTF-8 ValueStringBuilder with length <Length> | ||
| When I get the Span from the UTF-8 ValueStringBuilder | ||
| Then the UTF-8 ValueStringBuilder string should be '<ExpectedValue>' | ||
| Examples: | ||
| | InitializationType | InitialLength | Start | Length | ExpectedValue | | ||
| | Span | 10 | 0 | 5 | Hello | | ||
| | Capacity | 10 | 0 | 5 | Hello | | ||
| | Span | 10 | 1 | 4 | ello | | ||
| | Capacity | 10 | 1 | 4 | ello | | ||
| | Span | 10 | 2 | 3 | llo | | ||
| | Capacity | 10 | 2 | 3 | llo | | ||
| | Span | 10 | 0 | 4 | Hell | | ||
| | Capacity | 10 | 0 | 4 | Hell | | ||
| | Span | 10 | 1 | 3 | ell | | ||
| | Capacity | 10 | 1 | 3 | ell | | ||
| | Span | 10 | 2 | 2 | ll | | ||
| | Capacity | 10 | 2 | 2 | ll | | ||
| | Span | 10 | 1 | 0 | | | ||
| | Capacity | 10 | 1 | 0 | | | ||
| | Span | 10 | 0 | 0 | | | ||
| | Capacity | 10 | 0 | 0 | | | ||
|
|
||
| Scenario Outline: Specified range is out of bounds (start and length) | ||
| Given a UTF-8 ValueStringBuilder initialized with '<InitializationType>' of length 25 | ||
| And I append 'Hello' to the UTF-8 ValueStringBuilder | ||
| And I slice <Start> characters from the start of the UTF-8 ValueStringBuilder with length <Length> | ||
| Then the attempt should have thrown a 'System.ArgumentOutOfRangeException' | ||
| Examples: | ||
| | InitializationType | Start | Length | | ||
| | Span | 0 | 6 | | ||
| | Span | 1 | 5 | | ||
| | Span | 5 | 1 | | ||
| | Span | 6 | 0 | | ||
| | Capacity | 0 | 6 | | ||
| | Capacity | 1 | 5 | | ||
| | Capacity | 5 | 1 | | ||
| | Capacity | 6 | 0 | | ||
|
|
||
| Scenario Outline: Specified range is out of bounds (start only) | ||
| Given a UTF-8 ValueStringBuilder initialized with '<InitializationType>' of length 25 | ||
| And I append 'Hello' to the UTF-8 ValueStringBuilder | ||
| And I slice <Start> characters from the start of the UTF-8 ValueStringBuilder | ||
| Then the attempt should have thrown a 'System.ArgumentOutOfRangeException' | ||
| Examples: | ||
| | InitializationType | Start | | ||
| | Span | 6 | | ||
| | Capacity | 7 | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.