Drop streams and iterators: correct test data.
This commit is contained in:
@@ -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"
|
||||
}
|
||||
Reference in New Issue
Block a user