-
Notifications
You must be signed in to change notification settings - Fork 698
Description
Input coverage = how well we test the range of inputs, not just which lines or branches we hit. For example:
fn is_even(n: u32) -> bool {
n % 2 == 0
}
Here, testing only n = 2
gives 100% line coverage but misses 0
, 1
, u32::MAX
, etc. That’s low input coverage. We want to hit edge cases, boundaries, and weird values.
By pairing property-based testing (proptest
via cargo test
) with coverage-guided fuzzing (libFuzzer via cargo +nightly fuzz
), we can explore code paths with broader, more meaningful input variation.
Specifics
Use of arbitrary
One approach is to use a shared arbitrary::Arbitrary
model across both tools. This improves consistency and avoids duplication. But it should be documented, with pros (reuse, shared logic) and cons (higher discard rates, less fuzzing depth) made clear.
Use of mockall
These tools work best when tests run fast. Mock I/O, networking, etc, as needed. Use mockall
to generate static mocks, and configure them per test using closures. For traits with associated types, wire them manually (example).
Metadata
Metadata
Assignees
Labels
Type
Projects
Status