Boltzgen a test generator for teachers.
I am pleased to introduce Benoit Barbot / BoltzGen · GitLab ; Boltzgen
: Boltzmann sampler test generator is a tool to generate tests. Given a function signature it generates a random set of call of this function on generated random input. Inputs are generated using a Boltzmann sampler for unlabeled structure. This project has the following objectives:
- The primary goal was developing automatic grading system for purely functional programming exercises.
- Generate values with as little information as possible in most case only its type, the input by the user should be as small as possible;
- Strong probabilistic guarantee on the uniformity of the sample process thanks to Boltzmann sampler theory.
Given a function specification as a type signature :
type 'a tree = Empty | Node of 'a tree * 'a * 'a tree val sum: int list tree -> int
Boltzgen returns calls to this function :
sum (Node((Empty,,(Node((Empty,[(-4); (-2); 6],Empty)))))) sum (Node(((Node((Empty,,Empty))),,Empty))) sum (Node(((Node((Empty,,Empty))),,(Node((Empty,,(Node((Empty,,(Node((Empty,,Empty)))))))))))) ...
You can try it with a buggy web interface here OCaml test gen.
Or install it with opam and test locally.
This tool was quickly developed during the first COVID 19 lockdown to quickly generate tests for programming exercise, many bugs remains, comments and contributions are welcome.