added info about corpus concept

This commit is contained in:
Dominik Maier 2020-11-13 12:53:15 +01:00
parent 66a1d4f206
commit 59e61c2e3d

View File

@ -302,6 +302,55 @@ where
}
}
/* TODO: Iterator corpus, like:
enum MutationAction {
ReplaceInput(old_ref, new_val),
AppendNewInput(new_val),
}
struct NewCorpus {
testcases: Vec<NewTestCase>,
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;