January 2019
Intermediate to advanced
376 pages
8h 49m
English
As you use PropEr, you may find yourself stuck with generators creating huge data structures that take a long time to shrink and often don’t give very interesting results back. This often happens when some very low-probability failure is triggered, meaning that the framework had to generate a lot of data to find it, and has limited chances of shrinking things in a significant manner.
Whenever that happens, the ?LETSHRINK([Pattern, ...], [Generator, ...], Expression) is what you need. In practice, we use the generator like this:
| | Erlang |
| | ?LETSHRINK([A,B,C], [list(number()), list(number()), list(number())], |
| | A ++ B ++ C) |
| | Elixir |
| | let_shrink([ |
| | a <- list(number()), |
| | b <- list(number()), |
| | c <- list(number()) ... |