Skip to content

Commit

Permalink
fixup! Revert "fixup! fixup! fixup! fixup! fixup! fixup! Backport Laz…
Browse files Browse the repository at this point in the history
…yList"

laziness test fixes
  • Loading branch information
NthPortal committed Jan 19, 2020
1 parent 06be2c9 commit 8b3a38c
Showing 1 changed file with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class LazyListLazinessTest {
private def genericFilter_properlyLazy(filter: (LazyList[Int], Int => Boolean) => LazyList[Int],
isFlipped: Boolean): Unit = {
val ops: OpProfileMap = Map(
lazyListOp(filter(_, _ => true)) -> NoDrops,
lazyListOp(filter(_, _ => !isFlipped)) -> NoDrops,
lazyListOp(filter(_, i => (i % 2 != 0) == isFlipped)) -> DropProfile(dropCount = 1,
repeatedDrops = true),
)
Expand Down Expand Up @@ -902,12 +902,15 @@ class LazyListLazinessTest {
}
}

LazyList.range(CustomLong(0), CustomLong(1000))
assert(counter < 10)
def checkRange(ll: => LazyList[CustomLong]): Unit = {
counter = 0
ll
assert(counter < 10)
}

counter = 0
LazyList.range(CustomLong(0), CustomLong(1000), CustomLong(2))
assert(counter < 10)
checkRange(LazyList.range(CustomLong(0), CustomLong(1000)))
checkRange(LazyList.range(CustomLong(0), CustomLong(1000), CustomLong(2)))
checkRange(LazyList.range(CustomLong(0), CustomLong(1000), CustomLong(-2)))
}

@Test
Expand Down

0 comments on commit 8b3a38c

Please sign in to comment.