pub struct GenOptions {
pub max_depth: usize,
pub spread: usize,
pub coverage: bool,
pub preserve_case: bool,
pub max_output_len: Option<usize>,
pub max_steps: Option<u64>,
}Expand description
How to generate.
Fields§
§max_depth: usizeHow deep to recurse before switching to witness mode. Default DEFAULT_GEN_DEPTH.
This is a steering budget, not a safety limit: exhausting it does not fail, it makes
the walk take the shortest derivation it knows. The safety limits are
GenOptions::max_output_len and GenOptions::max_steps.
spread: usizeHow many repetitions beyond the minimum to consider. Default DEFAULT_SPREAD.
A repetition takes a count uniformly from min..=min(max, min + spread), so *"a"
with the default produces nought to three characters rather than an unbounded run.
coverage: boolSteer towards branches that have not been taken yet, rather than choosing randomly.
With this set, and subject to the resource limits, each successful call covers at
least one new coverage unit while any reachable one remains uncovered — so full
coverage takes at most uncovered(rule) calls. That is a guarantee rather than a
probability, and it does not depend on GenOptions::max_depth (D10, D38).
preserve_case: boolEmit case-insensitive strings exactly as written, rather than varying their case.
Varying case is the more useful default for a fuzzer — "abc" really does match AbC —
but it makes output unpredictable, so a test that compares generated text against an
expected string wants this set.
max_output_len: Option<usize>Give up once the output reaches this many scalar values. Default
DEFAULT_MAX_OUTPUT_LEN.
Finite by default, because termination alone does not make generation practical: a grammar can demand a gigabyte without being wrong (D29).
max_steps: Option<u64>Give up after visiting this many nodes. Default DEFAULT_MAX_STEPS.