});
}
-fn test_adjacent_edges<N:PartialEq+Debug,E:PartialEq+Debug>(graph: &Graph<N,E>,
- start_index: NodeIndex,
- start_data: N,
- expected_incoming: &[(E,N)],
- expected_outgoing: &[(E,N)]) {
+fn test_adjacent_edges<N: PartialEq + Debug, E: PartialEq + Debug>(graph: &Graph<N, E>,
+ start_index: NodeIndex,
+ start_data: N,
+ expected_incoming: &[(E, N)],
+ expected_outgoing: &[(E, N)]) {
assert!(graph.node_data(start_index) == &start_data);
let mut counter = 0;
assert!(graph.edge_data(edge_index) == &edge.data);
assert!(counter < expected_incoming.len());
debug!("counter={:?} expected={:?} edge_index={:?} edge={:?}",
- counter, expected_incoming[counter], edge_index, edge);
+ counter,
+ expected_incoming[counter],
+ edge_index,
+ edge);
match expected_incoming[counter] {
(ref e, ref n) => {
assert!(e == &edge.data);
assert!(graph.edge_data(edge_index) == &edge.data);
assert!(counter < expected_outgoing.len());
debug!("counter={:?} expected={:?} edge_index={:?} edge={:?}",
- counter, expected_outgoing[counter], edge_index, edge);
+ counter,
+ expected_outgoing[counter],
+ edge_index,
+ edge);
match expected_outgoing[counter] {
(ref e, ref n) => {
assert!(e == &edge.data);
#[test]
fn each_adjacent_from_a() {
let graph = create_graph();
- test_adjacent_edges(&graph, NodeIndex(0), "A",
- &[],
- &[("AB", "B")]);
+ test_adjacent_edges(&graph, NodeIndex(0), "A", &[], &[("AB", "B")]);
}
#[test]
fn each_adjacent_from_b() {
let graph = create_graph();
- test_adjacent_edges(&graph, NodeIndex(1), "B",
- &[("FB", "F"), ("AB", "A"),],
- &[("BD", "D"), ("BC", "C"),]);
+ test_adjacent_edges(&graph,
+ NodeIndex(1),
+ "B",
+ &[("FB", "F"), ("AB", "A")],
+ &[("BD", "D"), ("BC", "C")]);
}
#[test]
fn each_adjacent_from_c() {
let graph = create_graph();
- test_adjacent_edges(&graph, NodeIndex(2), "C",
- &[("EC", "E"), ("BC", "B")],
- &[]);
+ test_adjacent_edges(&graph, NodeIndex(2), "C", &[("EC", "E"), ("BC", "B")], &[]);
}
#[test]
fn each_adjacent_from_d() {
let graph = create_graph();
- test_adjacent_edges(&graph, NodeIndex(3), "D",
- &[("BD", "B")],
- &[("DE", "E")]);
+ test_adjacent_edges(&graph, NodeIndex(3), "D", &[("BD", "B")], &[("DE", "E")]);
}