Skip to content

Commit 13e20d3

Browse files
author
blake2-ppc
committed
---
yaml --- r: 143071 b: refs/heads/try2 c: ffe2623 h: refs/heads/master i: 143069: 90d1cf2 143067: 50c77dd 143063: bec1239 143055: 42cda62 143039: 76aa3d0 v: v3
1 parent 1565feb commit 13e20d3

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: 4623e81aa5429cf3b9b0837907b70da5e749facc
8+
refs/heads/try2: ffe2623e47d9c5a5914865a9556cb1298ca00058
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/src/libstd/iterator.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1494,6 +1494,20 @@ mod tests {
14941494
assert_eq!(i, 10);
14951495
}
14961496

1497+
#[test]
1498+
fn test_cycle() {
1499+
let cycle_len = 3;
1500+
let it = Counter::new(0u,1).take_(cycle_len).cycle();
1501+
assert_eq!(it.size_hint(), (uint::max_value, None));
1502+
for it.take_(100).enumerate().advance |(i, x)| {
1503+
assert_eq!(i % cycle_len, x);
1504+
}
1505+
1506+
let mut it = Counter::new(0u,1).take_(0).cycle();
1507+
assert_eq!(it.size_hint(), (0, Some(0)));
1508+
assert_eq!(it.next(), None);
1509+
}
1510+
14971511
#[test]
14981512
fn test_iterator_nth() {
14991513
let v = &[0, 1, 2, 3, 4];

0 commit comments

Comments
 (0)