mirror of
https://github.com/n0-computer/noq.git
synced 2026-09-21 10:43:25 +00:00
feeafe40c9
With this we no longer get compile errors in vscode because the fuzzing code uses fns that are themselves gated with cfg(fuzzing). We have to tell rust about the feature in Cargo.toml to avoid warnings.
21 lines
423 B
Rust
21 lines
423 B
Rust
#![no_main]
|
|
#![cfg(fuzzing)]
|
|
use arbitrary::Arbitrary;
|
|
use libfuzzer_sys::fuzz_target;
|
|
|
|
extern crate proto;
|
|
use proto::{Dir, Side, StreamId};
|
|
|
|
#[derive(Arbitrary, Debug)]
|
|
struct StreamIdParams {
|
|
side: Side,
|
|
dir: Dir,
|
|
index: u64,
|
|
}
|
|
|
|
fuzz_target!(|data: StreamIdParams| {
|
|
let s = StreamId::new(data.side, data.dir, data.index);
|
|
assert_eq!(s.initiator(), data.side);
|
|
assert_eq!(s.dir(), data.dir);
|
|
});
|