Crates.io | exhaustigen |
lib.rs | exhaustigen |
version | 0.1.0 |
source | src |
created_at | 2021-11-28 09:04:13.648892 |
updated_at | 2021-11-28 09:04:13.648892 |
description | exhaustive test generator |
homepage | |
repository | https://github.com/graydon/exhaustigen-rs |
max_upload_size | |
id | 488750 |
size | 9,856 |
This is a tiny (but delightful!) utility library for exhaustive testing.
It is based (directly) on the idea and code in the following blog post:
https://matklad.github.io//2021/11/07/generate-all-the-things.html
TL;DR: the idea is to write a test that is similar to the sort of test one writes against a PRNG -- an imperative test that just asks some "generator" to create scalars, booleans, data vectors, random shuffles, etc. -- but to use a special generator that has some interesting features:
By threading such a generator through such an imperative test, and putting the body of that test in a do-while loop, you can write straightforward code with elaborate value-dependent nesting structure -- eg. generate value K in 0..N and then value J in 0..K and so forth -- and it will automatically record and enumerate the space of sequences meaningful to the code, re-running until it has exhausted all possible paths/values.
MIT + ASL2.0, with permission from Aleksey.