Skip to Main Content
Property-Based Testing with PropEr, Erlang, and Elixir
book

Property-Based Testing with PropEr, Erlang, and Elixir

by Fred Hebert
January 2019
Intermediate to advanced content levelIntermediate to advanced
376 pages
8h 49m
English
Pragmatic Bookshelf
Content preview from Property-Based Testing with PropEr, Erlang, and Elixir

Targeted Properties in Practice

The targeted properties you’ve seen so far are pretty representative of the whole thing. Aside from respecting their limitations (no recursive generators nor stats), not much changes. The path example from early in the chapter was easy for simulated annealing to handle, so in this section, we’ll explore a slightly trickier case: forcing trees to be more or less balanced or skewed, and how to best optimize that.

A binary tree[40] is generally simple to keep balanced when using random data; if the data’s randomness is uniform (or follows a standard distribution), chances are that you’ll get numbers that will naturally distribute themselves on both sides of the tree. But let’s validate that.

We’ll start by writing ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Erlang and OTP in Action

Erlang and OTP in Action

Eric Merritt, Richard Carlsson, Martin Logan
Testing Elixir

Testing Elixir

Andrea Leopardi, Jeffrey Matthias

Publisher Resources

ISBN: 9781680506556Errata Page