pub struct GraphAssertions<'a, State> { /* private fields */ }Expand description
A fluent, panic-on-failure assertion builder over a GraphRun.
Returned by assert_graph. Every method asserts and
returns &Self so checks chain:
assert_graph(&run)
.visited(["agent", "tools", "agent"])
.routed("agent", "tools")
.checkpoint_count(3)
.completed();Implementations§
Source§impl<State> GraphAssertions<'_, State>
impl<State> GraphAssertions<'_, State>
Sourcepub fn visited<I, N>(&self, expected: I) -> &Self
pub fn visited<I, N>(&self, expected: I) -> &Self
Asserts the run visited exactly expected, in order (repeats included).
Sourcepub fn routed(&self, from: impl Into<NodeId>, to: impl Into<NodeId>) -> &Self
pub fn routed(&self, from: impl Into<NodeId>, to: impl Into<NodeId>) -> &Self
Asserts the executor selected a route from from to to.
Reads the recorded RouteSelected events when present; when no events
were recorded it falls back to adjacency in the visited sequence (to
immediately follows from).
Sourcepub fn checkpoint_count(&self, n: usize) -> &Self
pub fn checkpoint_count(&self, n: usize) -> &Self
Asserts the run persisted exactly n checkpoints.
Counts the recorded CheckpointSaved events when present, else falls
back to the collected checkpoint-history length.
Sourcepub fn state_history(&self, f: impl FnOnce(&[StateSnapshot<State>])) -> &Self
pub fn state_history(&self, f: impl FnOnce(&[StateSnapshot<State>])) -> &Self
Asserts against the thread’s checkpoint history (newest-first) via a caller-supplied predicate closure.
Sourcepub fn checkpoint(&self, f: impl FnOnce(&StateSnapshot<State>)) -> &Self
pub fn checkpoint(&self, f: impl FnOnce(&StateSnapshot<State>)) -> &Self
Asserts against the latest checkpoint snapshot via a caller-supplied closure. Panics when the run has no checkpoint history.
Sourcepub fn completed(&self) -> &Self
pub fn completed(&self) -> &Self
Asserts the run completed (no pending interrupts and a Completed
status).
Sourcepub fn interrupted(&self) -> &Self
pub fn interrupted(&self) -> &Self
Asserts the run paused on an interrupt rather than completing.