summaryrefslogtreecommitdiff
path: root/test/scalacheck/duration.scala
diff options
context:
space:
mode:
Diffstat (limited to 'test/scalacheck/duration.scala')
-rw-r--r--test/scalacheck/duration.scala5
1 files changed, 4 insertions, 1 deletions
diff --git a/test/scalacheck/duration.scala b/test/scalacheck/duration.scala
index 89cb9ff955..fc861b886a 100644
--- a/test/scalacheck/duration.scala
+++ b/test/scalacheck/duration.scala
@@ -32,7 +32,10 @@ object DurationTest extends Properties("Division of Duration by Long") {
val genClose = for {
a <- weightedLong
if a != 0
- b <- choose(Long.MaxValue / a - 10, Long.MaxValue / a + 10)
+ val center = Long.MaxValue / a
+ b <-
+ if (center - 10 < center + 10) choose(center - 10, center + 10)
+ else choose(center + 10, center - 10) // deal with overflow if abs(a) == 1
} yield (a, b)
val genBorderline =