Skip to content

Commit 48f61ec

Browse files
committed
iter: add the edge case tests for range too
1 parent 8149e5c commit 48f61ec

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/libstd/iter.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2708,6 +2708,16 @@ mod tests {
27082708
}
27092709
}
27102710

2711+
#[test]
2712+
fn test_range() {
2713+
assert_eq!(range(0i, 5).collect::<~[int]>(), ~[0i, 1, 2, 3, 4]);
2714+
assert_eq!(range(0i, 5).invert().collect::<~[int]>(), ~[4, 3, 2, 1, 0]);
2715+
assert_eq!(range(200, -5).collect::<~[int]>(), ~[]);
2716+
assert_eq!(range(200, -5).invert().collect::<~[int]>(), ~[]);
2717+
assert_eq!(range(200, 200).collect::<~[int]>(), ~[]);
2718+
assert_eq!(range(200, 200).invert().collect::<~[int]>(), ~[]);
2719+
}
2720+
27112721
#[test]
27122722
fn test_range_inclusive() {
27132723
assert_eq!(range_inclusive(0i, 5).collect::<~[int]>(), ~[0i, 1, 2, 3, 4, 5]);

0 commit comments

Comments
 (0)