Bring the whole workspace into compliance with the repo's rustfmt config (edition 2024, max_width 100, use_small_heuristics = "Max"), which had drifted across many crates. Pure formatting — no logic changes; `cargo fmt --check` is now clean and `cargo build --workspace` is green.
10 lines
435 B
Rust
10 lines
435 B
Rust
use lawsynth_causal::{CausalError, CausalGraph};
|
|
#[test]
|
|
fn graph_rejects_cycles_and_orders_nodes() {
|
|
let mut graph = CausalGraph::new(["rain", "soil", "growth"]).unwrap();
|
|
graph.add_edge("rain", "soil").unwrap();
|
|
graph.add_edge("soil", "growth").unwrap();
|
|
assert_eq!(graph.topological_order(), vec!["rain", "soil", "growth"]);
|
|
assert!(matches!(graph.add_edge("growth", "rain"), Err(CausalError::Cycle { .. })));
|
|
}
|