January 2019
Intermediate to advanced
376 pages
8h 49m
English
We’ve written a good lot of properties in this chapter covering multiple techniques, and they’ve been a bit all over the place. Let’s put them back into the context of the full test suite so we can give them a once-over:
| | Erlang code/ThinkingInProperties/erlang/pbt/test/prop_thinking.erl |
| | -module(prop_thinking). |
| | -include_lib("proper/include/proper.hrl"). |
| | |
| | %%%%%%%%%%%%%%%%%% |
| | %%% Properties %%% |
| | %%%%%%%%%%%%%%%%%% |
| | |
| | prop_biggest() -> |
| | ?FORALL(List, non_empty(list(integer())), |
| | begin |
| | thinking:biggest(List) =:= model_biggest(List) |
| | end). |
| | |
| | prop_last() -> |
| | %% pick a list and a last number |
| | ?FORALL({List, KnownLast}, {list(number()), number()}, |
| | begin |
| | KnownList = List ++ ... |
Read now
Unlock full access