diff options
| author | Daniel Micay <danielmicay@gmail.com> | 2013-09-15 00:54:32 -0400 |
|---|---|---|
| committer | Daniel Micay <danielmicay@gmail.com> | 2013-09-15 00:54:32 -0400 |
| commit | 48f61ecbf93740359b62ad5326e70759e738d9e6 (patch) | |
| tree | 2622bffdc4d72ce00e2af54ebdd9a561840f411e /src/libstd | |
| parent | 8149e5c99f4fddae5d442fdedfda4c085249a12e (diff) | |
| download | rust-48f61ecbf93740359b62ad5326e70759e738d9e6.tar.gz rust-48f61ecbf93740359b62ad5326e70759e738d9e6.zip | |
iter: add the edge case tests for `range` too
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/iter.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/libstd/iter.rs b/src/libstd/iter.rs index 0903d6d0b23..07d2aeac627 100644 --- a/src/libstd/iter.rs +++ b/src/libstd/iter.rs @@ -2709,6 +2709,16 @@ mod tests { } #[test] + fn test_range() { + assert_eq!(range(0i, 5).collect::<~[int]>(), ~[0i, 1, 2, 3, 4]); + assert_eq!(range(0i, 5).invert().collect::<~[int]>(), ~[4, 3, 2, 1, 0]); + assert_eq!(range(200, -5).collect::<~[int]>(), ~[]); + assert_eq!(range(200, -5).invert().collect::<~[int]>(), ~[]); + assert_eq!(range(200, 200).collect::<~[int]>(), ~[]); + assert_eq!(range(200, 200).invert().collect::<~[int]>(), ~[]); + } + + #[test] fn test_range_inclusive() { assert_eq!(range_inclusive(0i, 5).collect::<~[int]>(), ~[0i, 1, 2, 3, 4, 5]); assert_eq!(range_inclusive(0i, 5).invert().collect::<~[int]>(), ~[5i, 4, 3, 2, 1, 0]); |
