Shorthand for differential fuzzing results (#526)

* Shorthand for differential fuzzing results

* must_use
This commit is contained in:
Dominik Maier 2022-02-08 04:07:42 +01:00 committed by GitHub
parent 914bcd5c47
commit a3345902c2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -28,6 +28,23 @@ pub enum DiffResult {
Diff,
}
impl DiffResult {
/// Returns `true` if the two observers report the same outcome.
#[must_use]
pub fn is_equal(&self) -> bool {
match self {
DiffResult::Equal => true,
DiffResult::Diff => false,
}
}
/// Returns `true` if the two observers report different outcomes.
#[must_use]
pub fn is_diff(&self) -> bool {
!self.is_equal()
}
}
/// A [`DiffFeedback`] compares the content of two [`Observer`]s using the given compare function.
#[derive(Serialize, Deserialize)]
pub struct DiffFeedback<F, O1, O2>