Skip to content

Commit

Permalink
add max value from iterator
Browse files Browse the repository at this point in the history
  • Loading branch information
matthew-piziak committed Nov 2, 2016
1 parent dd6e8c5 commit 8f19d5c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/test/run-pass/iter-step-overflow-debug.rs
Expand Up @@ -15,12 +15,14 @@ use std::panic;
fn main() {
let r = panic::catch_unwind(|| {
let mut it = u8::max_value()..;
it.next().unwrap(); // 255
it.next().unwrap();
});
assert!(r.is_err());

let r = panic::catch_unwind(|| {
let mut it = i8::max_value()..;
it.next().unwrap(); // 127
it.next().unwrap();
});
assert!(r.is_err());
Expand Down
2 changes: 2 additions & 0 deletions src/test/run-pass/iter-step-overflow-ndebug.rs
Expand Up @@ -12,8 +12,10 @@

fn main() {
let mut it = u8::max_value()..;
assert_eq!(it.next().unwrap(), 255);
assert_eq!(it.next().unwrap(), u8::min_value());

let mut it = i8::max_value()..;
assert_eq!(it.next().unwrap(), 127);
assert_eq!(it.next().unwrap(), i8::min_value());
}

0 comments on commit 8f19d5c

Please sign in to comment.