-
Notifications
You must be signed in to change notification settings - Fork 408
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Choose[BigInt] #631
Comments
Yeah, the bounds of arbitrary BigInt is by design. An implementation of |
A ticket for BigDecimal is #637. I thought there might be some commonality, but it seems like BigInt may be a dependency of BigDecimal. |
@dmurvihill has an open PR in #636. We began to realize that there are practical limits of what ScalaCheck can offer in coverage of BigInt values in terms of performance. As @non pointed out, there are other practical issues, including printing large failing BigInt values. Given these limits, I wonder what safe guards ScalaCheck should provide to |
In addition to implicit Choose instances for scala.math.BigDecimal and java.math.BigDecimal we also include explicit constructor methods, since users may wish to be explicit about the scale they want. We may want to put those methods directly on Gen, currently the ergonomics of using this are a bit bad: Gen.Choose.chooseBigDecimalScale(100).choose(0, 1) The BigDecimal generation is not yet tested. That will also be added in a follow up. This also optimizes the BigInt generator a bit and generalizes it to java.math.BigInteger to support that as well. Addresses typelevel#631, typelevel#637, and typelevel#664
ScalaCheck's arbitrary BigInt is bounded, which can be very limiting for some applications and requires e.g. scientific and cryptographic users to implement custom generators. Providing a
Choose[BigInt]
implementation could save considerable boilerplate. This is my implementation:Any interest in a PR?
The text was updated successfully, but these errors were encountered: