Skip to content

Commit 12437a0

Browse files
committed
Ensure ordering for args to choose in DurationTest
Fix scala/scala-dev#296
1 parent 419a639 commit 12437a0

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

test/scalacheck/duration.scala

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,10 @@ object DurationTest extends Properties("Division of Duration by Long") {
3232
val genClose = for {
3333
a <- weightedLong
3434
if a != 0
35-
b <- choose(Long.MaxValue / a - 10, Long.MaxValue / a + 10)
35+
val center = Long.MaxValue / a
36+
b <-
37+
if (center - 10 < center + 10) choose(center - 10, center + 10)
38+
else choose(center + 10, center - 10) // deal with overflow if abs(a) == 1
3639
} yield (a, b)
3740

3841
val genBorderline =

0 commit comments

Comments
 (0)