19 lines
451 B
Rust
19 lines
451 B
Rust
use core::iter::*;
|
|
|
|
#[test]
|
|
fn test_copied() {
|
|
let xs = [2, 4, 6, 8];
|
|
|
|
let mut it = xs.iter().copied();
|
|
assert_eq!(it.len(), 4);
|
|
assert_eq!(it.next(), Some(2));
|
|
assert_eq!(it.len(), 3);
|
|
assert_eq!(it.next(), Some(4));
|
|
assert_eq!(it.len(), 2);
|
|
assert_eq!(it.next_back(), Some(8));
|
|
assert_eq!(it.len(), 1);
|
|
assert_eq!(it.next_back(), Some(6));
|
|
assert_eq!(it.len(), 0);
|
|
assert_eq!(it.next_back(), None);
|
|
}
|