Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
bytecodealliance
GitHub Repository: bytecodealliance/wasmtime
Path: blob/main/crates/fuzzing/src/generators/wast_test.rs
1693 views
1
//! Arbitrarily choose a spec test from the list of known spec tests.
2
3
use arbitrary::{Arbitrary, Unstructured};
4
5
// See `build.rs` for how the `FILES` array is generated.
6
include!(concat!(env!("OUT_DIR"), "/wasttests.rs"));
7
8
/// A wast test from this repository.
9
#[derive(Debug)]
10
pub struct WastTest {
11
#[expect(missing_docs, reason = "self-describing field")]
12
pub test: wasmtime_test_util::wast::WastTest,
13
}
14
15
impl<'a> Arbitrary<'a> for WastTest {
16
fn arbitrary(u: &mut Unstructured<'a>) -> arbitrary::Result<Self> {
17
log::debug!("{}", u.is_empty());
18
Ok(WastTest {
19
test: u.choose(FILES)?(),
20
})
21
}
22
23
fn size_hint(_depth: usize) -> (usize, Option<usize>) {
24
(1, Some(std::mem::size_of::<usize>()))
25
}
26
}
27
28