Skip to content

Commit

Permalink
add underflow/overflow tests
Browse files Browse the repository at this point in the history
  • Loading branch information
durka committed Mar 4, 2016
1 parent 003120a commit a928c83
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/test/run-pass/range_inclusive.rs
Expand Up @@ -103,6 +103,14 @@ pub fn main() {
let mut narrow = 1...0;
assert_eq!(narrow.next_back(), None);
assert_eq!(narrow, RangeInclusive::Empty { at: 0 });
let mut zero = 0u8...0;
assert_eq!(zero.next_back(), Some(0));
assert_eq!(zero.next_back(), None);
assert_eq!(zero, RangeInclusive::Empty { at: 0 });
let mut high = 255u8...255;
assert_eq!(high.next_back(), Some(255));
assert_eq!(high.next_back(), None);
assert_eq!(high, RangeInclusive::Empty { at: 255 });

// what happens if you have a nonsense range?
let mut nonsense = 10...5;
Expand Down

0 comments on commit a928c83

Please sign in to comment.