Rework unit test report to leverage new reification

And also provide slightly better errors when traces, or trace-if-false operators are present.
This commit is contained in:
KtorZ
2024-03-07 01:04:50 +01:00
parent 59996850c1
commit bff822ea7f
10 changed files with 377 additions and 254 deletions

View File

@@ -1,6 +1,5 @@
use crate::ast::{Constant, NamedDeBruijn, Term};
use super::{cost_model::ExBudget, Error};
use crate::ast::{Constant, NamedDeBruijn, Term};
#[derive(Debug)]
pub struct EvalResult {
@@ -44,6 +43,14 @@ impl EvalResult {
}
}
#[allow(clippy::result_unit_err)]
pub fn unwrap_constant(self) -> Result<Constant, ()> {
match self.result {
Ok(Term::Constant(cst)) => Ok(cst.as_ref().to_owned()),
_ => Err(()),
}
}
pub fn result(&self) -> Result<Term<NamedDeBruijn>, Error> {
self.result.clone()
}