Skip to content

Commit

Permalink
Added test to verify that #1035 is fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
pchlupacek committed Jan 1, 2018
1 parent b2db70f commit 399deba
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions core/jvm/src/test/scala/fs2/StreamPerformanceSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,24 @@ class StreamPerformanceSpec extends Fs2Spec {
}
}}

"left-associated eval_() ++ flatMap 1" - { Ns.foreach { N =>
N.toString in {
runLog((1 until N).map(emit).foldLeft(emit(0).covary[IO])((acc,a) => acc flatMap { _ => eval(IO {()}) flatMap { _ => a }})) shouldBe Vector(N-1)
}
}}

"right-associated flatMap 1" - { Ns.foreach { N =>
N.toString in {
runLog((1 until N).map(emit).reverse.foldLeft(emit(0))((acc,a) => a flatMap { _ => acc })) shouldBe Vector(0)
}
}}

"right-associated eval_() ++ flatMap 1" - { Ns.foreach { N =>
N.toString in {
runLog((1 until N).map(emit).reverse.foldLeft(emit(0).covary[IO])((acc,a) => a flatMap { _ => eval(IO {()}) flatMap { _=> acc } })) shouldBe Vector(0)
}
}}

"left-associated flatMap 2" - { Ns.foreach { N =>
N.toString in {
runLog((1 until N).map(emit).foldLeft(emit(0) ++ emit(1) ++ emit(2))(
Expand Down

0 comments on commit 399deba

Please # to comment.