diff --git a/src/corpus/testcase.rs b/src/corpus/testcase.rs index cc689e9465..450a3ab9c2 100644 --- a/src/corpus/testcase.rs +++ b/src/corpus/testcase.rs @@ -195,9 +195,10 @@ where } /// Create a new Testcase instace given an input - pub fn new(input: I) -> Self { + pub fn new(input: T) -> Self + where T: Into{ Testcase { - input: Some(input), + input: Some(input.into()), filename: None, metadatas: HashMap::default(), } diff --git a/src/engines/mod.rs b/src/engines/mod.rs index 45fd50370f..52749d1e54 100644 --- a/src/engines/mod.rs +++ b/src/engines/mod.rs @@ -87,7 +87,7 @@ mod tests { use core::cell::RefCell; use crate::corpus::{Corpus, InMemoryCorpus, Testcase}; - use crate::engines::{Engine, DefaultEngine}; + use crate::engines::{DefaultEngine, Engine}; use crate::executors::inmemory::InMemoryExecutor; use crate::executors::{Executor, ExitKind}; use crate::inputs::bytes::BytesInput; @@ -106,7 +106,7 @@ mod tests { let rand: Rc<_> = DefaultRand::new(0).into(); let mut corpus = InMemoryCorpus::::new(&rand); - let testcase = Testcase::new(BytesInput::new(vec![0; 4])).into(); + let testcase = Testcase::new(vec![0; 4]).into(); corpus.add(testcase); let executor: Rc>> = InMemoryExecutor::new(harness).into(); diff --git a/src/mutators/scheduled.rs b/src/mutators/scheduled.rs index ed7bfe6e6d..8c59575175 100644 --- a/src/mutators/scheduled.rs +++ b/src/mutators/scheduled.rs @@ -339,9 +339,9 @@ mod tests { // With the current impl, seed of 1 will result in a split at pos 2. let rand: Rc<_> = XKCDRand::new().into(); let mut has_rand = DefaultHasRand::new(&rand); - let mut corpus = InMemoryCorpus::new(&rand); - corpus.add(Testcase::new(BytesInput::new(vec!['a' as u8, 'b' as u8, 'c' as u8])).into()); - corpus.add(Testcase::new(BytesInput::new(vec!['d' as u8, 'e' as u8, 'f' as u8])).into()); + let mut corpus: InMemoryCorpus = InMemoryCorpus::new(&rand); + corpus.add(Testcase::new(vec!['a' as u8, 'b' as u8, 'c' as u8]).into()); + corpus.add(Testcase::new(vec!['d' as u8, 'e' as u8, 'f' as u8]).into()); let testcase_rr = corpus.next().expect("Corpus did not contain entries"); let mut testcase = testcase_rr.borrow_mut();