Lines Matching +full:test +full:. +full:rgb
5 …<p><strong>The trait for generating structured data from arbitrary, unstructured input.</strong></…
7 …img alt="GitHub Actions Status" src="https://github.com/rust-fuzz/rust_arbitrary/workflows/Rust/ba…
13 The `Arbitrary` crate lets you construct arbitrary instances of a type.
16 and `cargo-fuzz`](https://github.com/rust-fuzz/cargo-fuzz) or
17 [AFL](https://github.com/rust-fuzz/afl.rs), and to help you turn the raw,
19 values. This allows you to combine structure-aware test case generation with
20 coverage-guided, mutation-based fuzzers.
24 [**Read the API documentation on `docs.rs`!**](https://docs.rs/arbitrary)
28 Say you're writing a color conversion library, and you have an `Rgb` struct to
29 represent RGB colors. You might want to implement `Arbitrary` for `Rgb` so that
30 you could take arbitrary `Rgb` instances in a test function that asserts some
31 property (for example, asserting that RGB converted to HSL and converted back to
32 RGB always ends up exactly where we started).
37 `Arbitrary` for your types.
43 # Cargo.toml
52 // rgb.rs
57 pub struct Rgb {
66 …e that does not implement `Arbitrary` or you want to have more customization for particular fields.
83 // where `T` is the field's type.
88 #[arbitrary(with = |u: &mut Unstructured| u.int_in_range(0..=64))]
93 u.int_in_range(64..=128)
102 // rgb.rs
107 pub struct Rgb {
113 impl<'a> Arbitrary<'a> for Rgb {
118 Ok(Rgb { r, g, b })
125 Licensed under dual MIT or Apache-2.0 at your choice.
129 shall be dual licensed as above, without any additional terms or conditions.