pub struct Comparison {
pub case: String,
pub metric: String,
pub measured: f64,
pub reference: f64,
pub source: String,
pub tolerance: Tolerance,
pub difference: f64,
pub relative: Option<f64>,
pub verdict: Verdict,
pub note: Option<String>,
}Expand description
One metric of one case: what the oracle said, what hpr said, and whether that is close enough.
Fields§
§case: StringThe case’s id.
metric: StringThe metric’s name.
measured: f64What hpr measured.
reference: f64What the reference says.
source: StringWhere the reference value came from.
tolerance: ToleranceThe tolerance it was held to, if it was held to one.
difference: f64measured − reference.
relative: Option<f64>That difference as a fraction of the reference, where the reference is not zero.
verdict: VerdictPass, fail, not scored, or within or outside a predicted-mode target.
note: Option<String>Why it is not scored, for a Verdict::NotScored row.
Implementations§
Source§impl Comparison
impl Comparison
Sourcepub fn new(
case: &str,
metric: &str,
measured: f64,
reference: f64,
source: &str,
tolerance: Tolerance,
) -> Self
pub fn new( case: &str, metric: &str, measured: f64, reference: f64, source: &str, tolerance: Tolerance, ) -> Self
Compares measured against reference under tolerance.
Sourcepub fn targeted(
case: &str,
metric: &str,
measured: f64,
reference: f64,
source: &str,
tolerance: Tolerance,
) -> Self
pub fn targeted( case: &str, metric: &str, measured: f64, reference: f64, source: &str, tolerance: Tolerance, ) -> Self
Compares measured against reference under tolerance as a target, not a gate: predicted
mode’s rows, which are reported and never fail a run for being outside it.
A row with no bound, or a number that is not finite, is not a miss to explain but a broken comparison, so it fails the run, as a blank reason for not scoring does.
Sourcepub fn not_scored(
case: &str,
metric: &str,
measured: f64,
reference: f64,
source: &str,
reason: &str,
) -> Self
pub fn not_scored( case: &str, metric: &str, measured: f64, reference: f64, source: &str, reason: &str, ) -> Self
Records measured against reference without scoring it, for the written reason.
Sourcepub fn targeted_row(&self) -> bool
pub fn targeted_row(&self) -> bool
Whether this is a predicted-mode row, held to a target rather than a gate.
Trait Implementations§
Source§impl Clone for Comparison
impl Clone for Comparison
Source§fn clone(&self) -> Comparison
fn clone(&self) -> Comparison
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for Comparison
impl Debug for Comparison
Source§impl<'de> Deserialize<'de> for Comparison
impl<'de> Deserialize<'de> for Comparison
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for Comparison
impl PartialEq for Comparison
Source§fn eq(&self, other: &Comparison) -> bool
fn eq(&self, other: &Comparison) -> bool
self and other values to be equal, and is used by ==.