]> git.proxmox.com Git - rustc.git/blobdiff - src/librustc_data_structures/graph/tests.rs
Imported Upstream version 1.9.0+dfsg1
[rustc.git] / src / librustc_data_structures / graph / tests.rs
index 33b2edd2e106d22ec0dd98f4b17a7067dc38f43f..be7f48d27e0416a5c34b7c557e1ce8654dfa1b70 100644 (file)
@@ -64,11 +64,11 @@ fn each_edge() {
     });
 }
 
-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;
@@ -76,7 +76,10 @@ fn test_adjacent_edges<N:PartialEq+Debug,E:PartialEq+Debug>(graph: &Graph<N,E>,
         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);
@@ -93,7 +96,10 @@ fn test_adjacent_edges<N:PartialEq+Debug,E:PartialEq+Debug>(graph: &Graph<N,E>,
         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);
@@ -109,31 +115,27 @@ fn test_adjacent_edges<N:PartialEq+Debug,E:PartialEq+Debug>(graph: &Graph<N,E>,
 #[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")]);
 }