use fsm_guards::{ApplyError, GuardError};
#[test]
fn apply_error_unknown_operator_display() {
assert_eq!(
ApplyError::UnknownOperator("my_op".into()).to_string(),
"unknown operator: my_op"
);
}
#[test]
fn apply_error_invalid_arguments_display() {
assert_eq!(
ApplyError::InvalidArguments("expected 2 args".into()).to_string(),
"invalid arguments: expected 2 args"
);
}
#[test]
fn apply_error_custom_op_failed_display() {
assert_eq!(
ApplyError::CustomOpFailed {
op: "state_in".into(),
source: "index out of bounds".into(),
}
.to_string(),
"custom operator 'state_in' failed: index out of bounds"
);
}
#[test]
fn guard_error_missing_var_display() {
assert_eq!(
GuardError::MissingVar("customer.id".into()).to_string(),
"guard references missing variable 'customer.id'"
);
}
#[test]
fn guard_error_fuel_exceeded_display() {
assert_eq!(
GuardError::FuelExceeded { limit: 50 }.to_string(),
"guard rule too complex (node limit: 50)"
);
}
#[test]
fn guard_error_custom_op_failed_display() {
assert_eq!(
GuardError::CustomOpFailed {
op: "state_in".into(),
source: "index out of bounds".into(),
}
.to_string(),
"custom operator 'state_in' failed: index out of bounds"
);
}
#[test]
fn guard_error_malformed_display() {
assert_eq!(
GuardError::Malformed("bad arity".into()).to_string(),
"guard rule malformed: bad arity"
);
}
#[test]
fn guard_error_type_error_display() {
assert_eq!(
GuardError::TypeError("expected number, got string".into()).to_string(),
"guard type error: expected number, got string"
);
}