jsverify/jsverify

Array size and element size are linked?

fson opened this issue · 3 comments

fson commented

Trying to generate arrays of natural numbers with given maxsize returns only numbers smaller than or equal to array size:

// returns arrays with maximum length of 5 and numbers from 0 to 5
jsc.array(jsc.nat(10000)).arbitrary(5);  //=> [ 3, 5, 0, 4, 2 ]

Is this intentional? Looks like arbitraryArray uses the same size both as the size of the array and size of an arbitrary element. It seems weird that these two sizes are linked together, as it would mean that it's impossible to generate small arrays with large values like [10000], for example.

"Fixed" in #23

I published new alpha. Size linking wasn't intentional, hadn't thought that far.

fson commented

That's already better. Thanks!