diff --git a/src/corpus/mod.rs b/src/corpus/mod.rs index 87c9acbc9a..802927768d 100644 --- a/src/corpus/mod.rs +++ b/src/corpus/mod.rs @@ -302,6 +302,55 @@ where } } +/* TODO: Iterator corpus, like: + +enum MutationAction { + ReplaceInput(old_ref, new_val), + AppendNewInput(new_val), +} + +struct NewCorpus { + testcases: Vec, + offset: usize; +} + +impl NewCorpus { + + pub fn handle_mutation(&mut self, action: MutationAction) { + match action { + MutationAction::ReplaceInput() => {}, + MutationAction::AppendNewInput() => {}, + } + } +} + +impl Iterator for NewCorpus { + type Item = NewTestCase; + + fn next(&mut self) -> Option<&Self::Item> { + // FIXME: implement next here + self.offset = 3; + + // When no more stuff, return None + None + } +} + +And then: + + corpus.iter() + .mutate_foo() + .mutate_bar() + .set_observer(obs) + .execute_binary(|input| { + ... + }) + .map(|observers, input, mutators| match result { + /// do things depending on coverage, etc... + e.g. corpus.handle_mutation(MutationAction::AppendNewInput) + }) +*/ + #[cfg(test)] mod tests { use crate::corpus::Corpus;