[erlang-questions] Generating fake data with PropEr?

Kostis Sagonas kostis@REDACTED
Thu Jan 23 17:50:49 CET 2014

On 01/23/2014 05:43 PM, David Welton wrote:
> Is there a way to simply use PropEr to generate some fake data?
> For instance proper_types:integer() returns some kind of generator.
> How do I grab an integer from that?

Not sure what you mean by "fake data", but probably you want to look at 
function proper_gen:pick/1.

For example:

1> {ok, Term1} = proper_gen:pick(proper_types:term()).
2> {ok, Term2} = proper_gen:pick(proper_types:term()).
{ok,[{},4,-4,{},'Ö\001º_?','ÁJ\017<é ']}
3> {ok, Term3} = proper_gen:pick(proper_types:term()).
4> {ok, Term4} = proper_gen:pick(proper_types:term()).

You can of course pass to this function any type.


More information about the erlang-questions mailing list