tests
This commit is contained in:
parent
126b71f690
commit
6ad61b9c3b
@ -1621,6 +1621,16 @@ fn test_range_step() {
|
|||||||
#[test]
|
#[test]
|
||||||
fn test_step_by_skip() {
|
fn test_step_by_skip() {
|
||||||
assert_eq!((0..640).step_by(128).skip(1).collect::<Vec<_>>(), [128, 256, 384, 512]);
|
assert_eq!((0..640).step_by(128).skip(1).collect::<Vec<_>>(), [128, 256, 384, 512]);
|
||||||
|
assert_eq!((0..=50).step_by(10).nth(3), Some(30));
|
||||||
|
assert_eq!((250..=255u8).step_by(10).nth(3), Some(230));
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_range_inclusive_step() {
|
||||||
|
assert_eq!((0..=50).step_by(10).collect::<Vec<_>>(), [0, 10, 20, 30, 40, 50]);
|
||||||
|
assert_eq!((0..=5).step_by(1).collect::<Vec<_>>(), [0, 1, 2, 3, 4, 5]);
|
||||||
|
assert_eq!((200..=255u8).step_by(10).collect::<Vec<_>>(), [200, 210, 220, 230, 240, 250]);
|
||||||
|
assert_eq!((250..=255u8).step_by(1).collect::<Vec<_>>(), [250, 251, 252, 253, 254, 255]);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
Loading…
Reference in New Issue
Block a user