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

Extend unit tests for SubArray #23

Open
hctrdev opened this issue Jun 12, 2020 · 0 comments
Open

Extend unit tests for SubArray #23

hctrdev opened this issue Jun 12, 2020 · 0 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@hctrdev
Copy link
Collaborator

hctrdev commented Jun 12, 2020

Requirement

Add a new unit test for the SubArray array extension to ensure it works as expected when one index is out-of-bounds, e.g. -2 to n/2 (where n is the size of the array).

In this case the SubArray function should return the array of values from 0 to n/2.

Also update the test to take multiple parameters instead of having multiple assert statements in the same test. This will make it easier to add new test cases.

Value Proposition

The existing tests cases only cover cases with indices that are always in-bounds or out-of-bounds. Not a mix of the two. This test would help ensure the function behaves correctly in all cases.

Design Ideas

  • Refactor test case provider to provide the array, the start/end index, and the expected array
  • Add test cases for out-of-bound indices on one or both sides
@hctrdev hctrdev added enhancement New feature or request good first issue Good for newcomers labels Jun 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant