Macros
Explore how to use Elixir macros check all and gen all for property-based testing. Understand generating test data with StreamData, filtering inputs, and configuring test runs to create robust test generators and assertions.
We'll cover the following...
We'll cover the following...
This lesson will introduce you to the check all and gen all macros. Let’s do it.
The check all macro
The check all supports multiple <- clauses. It also supports simple assignments (with =) as well as expressions that are used as filters, similar to what for supports.
To show a more complex use of check all, let’s write an example of a test that does the following:
- Generate a list
- Filter out empty lists
- Generate an element taken out of that list and finally
- Check that