use crate::{
assertion::{traits::LessThan, Assertion},
dsl::expression::Predicate,
LogSettings,
};
pub trait TimeDsl<T> {
fn is_less_than(&self, actual: T) -> Assertion<u64>;
fn eval(&self, actual: T, predicate: Predicate, log_settings: &LogSettings) -> Assertion<u64> {
match predicate {
Predicate::LessThan => self.is_less_than(actual).assert(log_settings),
_ => unimplemented!("Invalid predicate for the time DSL: {predicate}"),
}
}
}
impl TimeDsl<u64> for u64 {
fn is_less_than(&self, actual: u64) -> Assertion<u64> {
actual.less_than(self)
}
}