elm-explorations / elm-explorations/test
Fuzzers should exhaustively check all values of a type if possible/reasonable
- Dominant language
- Elm
- Stars
- 244
- Forks
- 40
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 2
Description
We've been talking with @gampleman about this a few times, and I believe I have a rough plan of attack.
Expand the Fuzzer definition, add an `exhaustive : Maybe (() -> List a)` field inside or make a sum type:
```elm
type Fuzzer
= Random (PRNG -> GenResult a)
| Exhaustive (() -> List a)
```
For certain fuzzers (`bool`, `unit`, `intRange` in case the range is below some threshold, etc.) this would be populated with `\() -> [False, True]` etc. and would be used _instead of_ randomly generating values.
For other fuzzers it would be disabled (`float`, `int`, `string`, `list` etc.).
Then there's a class of fuzzers which preserve the exhaustive mode if all their children are exhaustive: `map`, `lazy`, `tuple`, `triple`, `oneOf`, etc.
----
We would still honor the `runs : Int` config, but we'd warn if exhaustiveness was possible but above the threshold: something like
> NOTE: Fuzzer for this test can be checked exhaustively (324 cases). To enable the exhaustive check increase your `--runs` configuration value.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.