[erlang-questions] Testing data with subsets using QuickCheck

Jesper Louis Andersen jesper.louis.andersen@REDACTED
Wed May 10 22:37:52 CEST 2017

On Wed, May 10, 2017 at 8:27 PM Alex S. <alex0player@REDACTED> wrote:

> Remember that you can generate a random element of the list using built-in
> generators. I think this would be the most natural approach.
gen_alex() ->
    ?LET(L, non_empty(list(nat())),
      {L, elements(L)}).

Indeed, this is also a way to do it. Generate a non-empty list of elements,
then pick a random element in the list. This is quite a deal faster since
you don't have to run appending all the time. 270.000 test cases in 10
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20170510/f7735af1/attachment.htm>

More information about the erlang-questions mailing list