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

Range Methods Work for Empty Ranges #1361

Closed
1 task
4e6 opened this issue Dec 16, 2020 · 1 comment
Closed
1 task

Range Methods Work for Empty Ranges #1361

4e6 opened this issue Dec 16, 2020 · 1 comment
Labels
d-easy Difficulty: little prior knowledge required p-high Should be completed in the next sprint

Comments

@4e6
Copy link
Contributor

4e6 commented Dec 16, 2020

Summary

Methods on Range were not tested to work with empty ranges like 6.to 1 (when the range start is bigger than the end).
For example, to_vector (when fixed) throws java.lang.NegativeArraySizeException: -1, and each runs indefinitely.

Value

Range methods work for empty ranges like 6.to 1

Specification

  • Fix the to_vector implementation, it should be:
     to_vector : Vector.Vector
     to_vector = Vector.new (this.end - this.start) (i -> i + this.start)
    
  • Add the appropriate test cases for Range methods

Acceptance Criteria & Test Cases

  • Range methods work for empty ranges
@4e6 4e6 added Type: Bug d-easy Difficulty: little prior knowledge required p-high Should be completed in the next sprint labels Dec 16, 2020
@4e6
Copy link
Contributor Author

4e6 commented Feb 22, 2022

Fixed in #1702

@4e6 4e6 closed this as completed Feb 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
d-easy Difficulty: little prior knowledge required p-high Should be completed in the next sprint
Projects
None yet
Development

No branches or pull requests

2 participants