spire icon indicating copy to clipboard operation
spire copied to clipboard

Arbitrary[Algebraic] only generates ConstantLong Exprs

Open LukaJCB opened this issue 6 years ago • 3 comments

This is the Gen used for Algebraic right now:

lazy val algebraic: Gen[Algebraic] =
  arbitrary[Int].map(Algebraic(_))

I'd argue to really test Algebraic we need a more throrough Gen.

LukaJCB avatar Jan 09 '19 14:01 LukaJCB

Definitely agree. One annoyance is that the Algebraic tests can be pretty slow and making them more complicated will only make things worse. We'll probably want to disproportionately weight the random Algebraics towards simpler ones, but still allow some complex ones through.

tixxit avatar Jan 09 '19 14:01 tixxit

We could potentially restrict the number of values generated for CI only, WDYT?

LukaJCB avatar Jan 09 '19 15:01 LukaJCB

How do we do that, actually?

PS: I dream of a scalacheck-type framework, where the complexity of generated instances could be described by a tuple of integers (i,j,k,...); properties would then declare a time t(i,j,k,...) and space s(i,j,k,...) complexity. Then, when running the tests, we could assign a time budget for all the runs (which the sum of all time complexities must not overrun), and a memory budget (which each run can't cross).

denisrosset avatar Jan 11 '19 00:01 denisrosset