PropCheck.BasicTypes.resize
You're seeing just the function
resize
, go back to PropCheck.BasicTypes module for more information.
Specs
Overrides the size
parameter used when generating instances of
type
with new_size
.
Has no effect on size-less types, such as unions.
Also, this will not affect the generation of any internal types contained in
type
, such as the elements of a list - those will still be generated
using the test-wide value of size
. One use of this function is to modify
types to produce instances that grow faster or slower, like so:
iex> quickcheck(forall l <- list(integer()) do
...> length(l) <= 42
...> end)
true
iex> long_list = sized(size, resize(size * 2, list(integer())))
iex> really_long = such_that_maybe l <- long_list, when:
...> length(l) > 42
iex> quickcheck(forall l <- really_long do
...> (length(l) <= 84)
...> |> measure("List length", length l)
...> |> collect(length l)
...> end)
true
The above specifies a list type that grows twice as fast as normal lists.