Claim a stream produced from a Sequence having ORDERED property.

Add a test verifying that property is respected.
This commit is contained in:
Ilya Gorbunov
2016-07-01 17:43:12 +03:00
parent 22ee3a8dc1
commit 157ed3f8c1
2 changed files with 9 additions and 1 deletions
@@ -41,6 +41,14 @@ class StreamsTest {
assertEquals(expected.limit(7).toList(), stream.limit(7).toList())
}
@Test fun asParallelStream() {
val sequence = generateSequence(0) { it + 2 } // even numbers
val stream = sequence.asStream().parallel().map { it / 2 }
val n = 100000
val expected = (0 until n).toList()
assertEquals(expected, stream.limit(n.toLong()).toList())
}
}