You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thanks for pointing into right direction. However I'm facing below issue with genDateTimeWithinRange and jdk8.
import java.time.ZonedDateTime
import org.scalacheck.{Gen, Prop}
import com.fortysevendeg.scalacheck.datetime.GenDateTime.genDateTimeWithinRange
import com.fortysevendeg.scalacheck.datetime.jdk8.ArbitraryJdk8.{genDuration, genZonedDateTime}
import com.fortysevendeg.scalacheck.datetime.instances.jdk8.jdk8ForDuration
import com.fortysevendeg.scalacheck.datetime.jdk8.granularity.days
val startAndEndDateTimeGen : Gen[(ZonedDateTime,ZonedDateTime)] = for {
startZonedDateTime <- genZonedDateTime
duration <- genDuration //BTW This gen should be parametrized to control future vs past date
endZonedDateTime <- genDateTimeWithinRange(startZonedDateTime,duration)
} yield (startZonedDateTime, endZonedDateTime)
Prop.forAll(startAndEndDateTimeGen) { case (start,end ) => true }.check
! Exception raised on property evaluation.
> Exception: java.lang.ArithmeticException: long overflow
java.lang.Math.multiplyExact(Math.java:892)
genZonedDateTime has very big space for year which is preventing strict date formatting like yyyyMMdd.
With above range below filter mostly fails
I know the range is due to
However, it is better if library can provide some way to constraint year range for rational generator
The text was updated successfully, but these errors were encountered: