pub enum Eval {
Boolean {
criterion: String,
expected: bool,
name: Option<String>,
},
Numeric {
criterion: String,
min: f64,
max: f64,
threshold: f64,
comparator: Comparator,
name: Option<String>,
},
}Expand description
An eval specification, as written in a test case’s YAML.
Variants§
Boolean
Assert a plain-English criterion holds (or, with expected: false, that
it does not).
Fields
Numeric
Score a plain-English criterion on a numeric scale and compare it to a threshold.
Fields
comparator: ComparatorHow the score is compared to threshold. Defaults to >=.
Implementations§
Source§impl Eval
impl Eval
Sourcepub fn label(&self) -> &str
pub fn label(&self) -> &str
A short label for reports: the explicit name if given, else the
criterion.
Sourcepub fn validate(&self) -> Result<()>
pub fn validate(&self) -> Result<()>
Validate the eval’s own parameters (independent of any transcript).
§Errors
Error::Invalid when a criterion is empty or a numeric scale is
degenerate (min >= max) or the threshold falls outside [min, max].
Sourcepub fn outcome(&self, raw: &JudgeValue, reason: String) -> Result<EvalOutcome>
pub fn outcome(&self, raw: &JudgeValue, reason: String) -> Result<EvalOutcome>
Apply this eval’s pass rule to a raw judge value, producing an outcome.
raw is the value the judge returned: JudgeValue::Bool for boolean
evals, JudgeValue::Number for numeric. A mismatch is a provider error.
§Errors
Error::Provider if the judge returned the wrong value kind for this
eval.