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

Bug in BoundedRange's Iterator implementation #4

Closed
rsnively opened this issue Dec 20, 2021 · 1 comment
Closed

Bug in BoundedRange's Iterator implementation #4

rsnively opened this issue Dec 20, 2021 · 1 comment
Labels
bug Something isn't working

Comments

@rsnively
Copy link
Owner

There's an off-by-one error in BoundedRanges with an excluded lower bound. The following test fails:

#[test]
fn test_excluded_lower_bound() {
    let r = BoundedRange::new(Bound::Excluded(3), Bound::Excluded(4));
    assert_eq!(r.collect::<Vec<_>>(), vec![]);
}

with the message:

thread 'bounded_range::test_excluded_lower_bound' panicked at 'assertion failed: `(left == right)`
  left: `[4]`,
 right: `[]`', src/bounded_range.rs:136:5
@rsnively
Copy link
Owner Author

Fixed in 0.1.1

Specializing Bound into LowerBound and UpperBound made BoundedRange's iterator implementation make sense again.

@rsnively rsnively added the bug Something isn't working label Mar 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant