[erlang-questions] PropEr way to deal with recursive types

Motiejus Jakštys <>
Sat Sep 10 13:46:33 CEST 2011


On Fri, Sep 09, 2011 at 05:10:30PM -0700, James Aimonetti wrote:
> I tried limiting the proplist to 5 tuples, heavily weighting the
> proplist_value union towards binary(), etc. When I run
> "proper:module(json_tester).", I see a string of periods (varies how far
> it gets), then the VM hangs and I have to get into the JCL to interrupt
> the process. My assumption is that the generator is getting stuck
> creating a big data structure, as CPU and memory increase rapidly.
> 
> I've looked at three examples[1][2][3] that Fred Herbert shared but
> haven't found the mental bridge between his examples and my attempt. I
> don't doubt that I'm misusing or ignorant of the right functions or
> macros in PropEr to make this easier.
> 
> Any hints? :)
> 

You can limit recursion depth as well. Just pass max_size to the
proper:quickcheck() function. That helped me as I didn't have to write
my own recursive generator. :)

As the topic is quite similar, I would like to remind about creating
custom types in PropEr.
http://erlang.org/pipermail/erlang-questions/2011-August/060619.html

Thanks

Motiejus



More information about the erlang-questions mailing list