Drop streams and iterators: correct test data.

This commit is contained in:
Ilya Gorbunov
2015-06-26 04:09:32 +03:00
parent 6b700c4ba6
commit 0e896ea1bb
3 changed files with 4 additions and 12 deletions
@@ -1,19 +1,13 @@
package foo
fun streamFromFunctionWithInitialValue() {
val values = stream(3) { n -> if (n > 0) n - 1 else null }
fun sequenceFromFunctionWithInitialValue() {
val values = sequence(3) { n -> if (n > 0) n - 1 else null }
assertEquals(arrayListOf(3, 2, 1, 0), values.toList())
}
fun iterateOverFunction() {
val values = iterate<Int>(3) { n -> if (n > 0) n - 1 else null }
assertEquals(arrayList(3, 2, 1, 0), values.toList())
}
fun box(): String {
streamFromFunctionWithInitialValue()
iterateOverFunction()
sequenceFromFunctionWithInitialValue()
return "OK"
}