Skip to content

Commit 6ad61b9

Browse files
committed
tests
1 parent 126b71f commit 6ad61b9

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/libcore/tests/iter.rs

+10
Original file line numberDiff line numberDiff line change
@@ -1621,6 +1621,16 @@ fn test_range_step() {
16211621
#[test]
16221622
fn test_step_by_skip() {
16231623
assert_eq!((0..640).step_by(128).skip(1).collect::<Vec<_>>(), [128, 256, 384, 512]);
1624+
assert_eq!((0..=50).step_by(10).nth(3), Some(30));
1625+
assert_eq!((250..=255u8).step_by(10).nth(3), Some(230));
1626+
}
1627+
1628+
#[test]
1629+
fn test_range_inclusive_step() {
1630+
assert_eq!((0..=50).step_by(10).collect::<Vec<_>>(), [0, 10, 20, 30, 40, 50]);
1631+
assert_eq!((0..=5).step_by(1).collect::<Vec<_>>(), [0, 1, 2, 3, 4, 5]);
1632+
assert_eq!((200..=255u8).step_by(10).collect::<Vec<_>>(), [200, 210, 220, 230, 240, 250]);
1633+
assert_eq!((250..=255u8).step_by(1).collect::<Vec<_>>(), [250, 251, 252, 253, 254, 255]);
16241634
}
16251635

16261636
#[test]

0 commit comments

Comments
 (0)