Contributor
njichev

Elixir Idea #1: Typespecs to StreamData generators


Mentors
Andrea Leopardi
Organization
Beam Community
Project Description

StreamData is a library that adds data generation and property-based testing to Elixir. The goal of this project is to read @type declarations from BEAM code and automatically get generators out of them. Once that is done, we should use this information to automatically validate @spec annotations with data generators.

Goal 1 - Getting data generators out of @types

First part - Provide a simple way to generate all simple types(int, atom, all, etc.). Maybe a way to compose different generators and getting new ones would be useful for union/all types.

Second part - generators for recursive/recursively dependant/parameterized types which will be a greater challenge.

Goal 2 - Automatically validate function @specs

If we have a function spec, we can automatically feed the function it's arguments and check that the result always belongs to the return type of the function.

To check whether a result belong to the correct type generator, we should probably extend the StreamData struct to include a member function as a field. We would check whether different types belong to a data through it.