Documentation
¶
Overview ¶
exhaustigen implements a simple utility tool for exhaustive testing described by Alex Kladov on his blog: https://matklad.github.io//2021/11/07/generate-all-the-things.html This implementation is ported from a Rust implementation of the idea by the creator of Rust, Graydon Hoare: https://github.com/graydon/exhaustigen-rs/
Index ¶
- func GenBoundBy[T any](g *Gen, bound int, f func(*Gen) T) iter.Seq[T]
- func GenBoundComb(g *Gen, bound, n int) iter.Seq[int]
- func GenComb(g *Gen, n int) iter.Seq[int]
- func GenElts(g *Gen, lenBound, eltBound int) iter.Seq[int]
- func GenFixedBy[T any](g *Gen, fixed int, f func(*Gen) T) iter.Seq[T]
- func GenFixedComb(g *Gen, fixed, n int) iter.Seq[int]
- func GenPerm(g *Gen, n int) iter.Seq[int]
- func GenSubset(g *Gen, n int) iter.Seq[int]
- type Gen
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenBoundBy ¶
GenBoundBy generates a variable-length sequence (up to bound) of values produced by calling f(gen).
func GenBoundComb ¶
GenBoundComb generates variable-size (up to bound) combinations with replacement from n elements. Yields indices in [0, n).
func GenComb ¶
GenComb generates variable-size combinations with replacement from n elements. Yields indices in [0, n). Equivalent to GenBoundComb(g, n, n).
func GenElts ¶
GenElts generates variable-length sequences of bounded ints. Length <= lenBound, each element <= eltBound.
func GenFixedBy ¶
GenFixedBy generates a fixed-length sequence of values produced by calling f(gen).
func GenFixedComb ¶
GenFixedComb generates fixed-size combinations with replacement from n elements. Yields indices in [0, n).
Types ¶
type Gen ¶
type Gen struct {
// contains filtered or unexported fields
}
Gen exhaustively enumerates all combinations of nondeterministic choices. It tracks variable-radix digit counters, incrementing like an odometer on each Done() call.
func (*Gen) Done ¶
Done returns false while there are unexplored combinations. On each call, it advances the odometer. Call this in the head of a for loop.