Skip to content

Commit

Permalink
added a test
Browse files Browse the repository at this point in the history
  • Loading branch information
nikiforo committed Oct 10, 2021
1 parent cde7f6b commit 24515bf
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions core/shared/src/test/scala/fs2/StreamSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -990,6 +990,14 @@ class StreamSuite extends Fs2Suite {

group("parEvalMap") {

test("should preserve element ordering") {
forAllF { (stream: Stream[Pure, Int]) =>
val smaller = stream.map(i => math.abs(i % 10))
val delayed = smaller.covary[IO].parEvalMap(Int.MaxValue)(i => IO.sleep(i.millis).as(i))
delayed.compile.toList.assertEquals(smaller.toList)
}
}

test("should launch no more than maxConcurrent") {
forAllF { (stream: Stream[Pure, Unit], int: Int) =>
val concurrency = math.abs(int % 20) + 1
Expand Down

0 comments on commit 24515bf

Please sign in to comment.