diff options
author | Martin Odersky <odersky@gmail.com> | 2008-02-06 18:43:12 +0000 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2008-02-06 18:43:12 +0000 |
commit | 5ffe50c3dfc793eb983f341f4e9e816de3636a4f (patch) | |
tree | ecb40df9cbf8595bcfad682045d45ab170880b79 /test/files/run/iterators.scala | |
parent | 11d8e2c4870d13be7b4a651495aae8fb8946d60f (diff) | |
download | scala-5ffe50c3dfc793eb983f341f4e9e816de3636a4f.tar.gz scala-5ffe50c3dfc793eb983f341f4e9e816de3636a4f.tar.bz2 scala-5ffe50c3dfc793eb983f341f4e9e816de3636a4f.zip |
fixed problems with ranges
Diffstat (limited to 'test/files/run/iterators.scala')
-rw-r--r-- | test/files/run/iterators.scala | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/test/files/run/iterators.scala b/test/files/run/iterators.scala index 714861ef68..7972418059 100644 --- a/test/files/run/iterators.scala +++ b/test/files/run/iterators.scala @@ -22,10 +22,13 @@ object Test { } def check_range2: Int = { - val r1 = Iterator.range(0, 10) - val r2 = Iterator.range(r1.start, r1.end, r1.step + 1) - val r3 = Iterator.range(r1.end, r1.start, -r1.step) - val r4 = Iterator.range(0, 10, 11) + val r1start = 0 + val r1end = 10 + val r1step = 1 + val r1 = Iterator.range(r1start, r1end, r1step) toList; + val r2 = Iterator.range(r1start, r1end, r1step + 1) toList; + val r3 = Iterator.range(r1end, r1start, -r1step) toList; + val r4 = Iterator.range(0, 10, 11) toList; // 10 + 5 + 10 + 1 r1.length + r2.length + r3.length + r4.length } @@ -34,8 +37,9 @@ object Test { def trues(xs: List[Boolean]) = xs.foldLeft(0)((a, b) => if (b) a+1 else a) val r1 = Iterator.range(0, 10) val xs1 = List(r1 contains 5, r1 contains 6) - val r2 = Iterator.range(0, 10, 2) - val xs2 = List(r2 contains 5, r2 contains 6) + val r2a = Iterator.range(0, 10, 2) + val r2b = Iterator.range(0, 10, 2) + val xs2 = List(r2a contains 5, r2b contains 6) val r3 = Iterator.range(0, 10, 11) val xs3 = List(r3 contains 5, r3 contains 6) // 2 + 1 + 0 |