()
| 89 | |
| 90 | #[test] |
| 91 | fn bfs_paths() { |
| 92 | let graph = create_graph(TINY_CG); |
| 93 | let paths = BreadthFirstPaths::new(graph.as_ref(), 0); |
| 94 | for (v, expect) in vec![ |
| 95 | Some(vec![0usize]), // 0 |
| 96 | Some(vec![0, 1]), // 1 |
| 97 | Some(vec![0, 2]), // 2 |
| 98 | Some(vec![0, 2, 3]), // 3 |
| 99 | Some(vec![0, 2, 4]), // 4 |
| 100 | Some(vec![0, 5]), // 5 |
| 101 | ] |
| 102 | .iter() |
| 103 | .enumerate() |
| 104 | { |
| 105 | { |
| 106 | let paths: Option<Vec<usize>> = paths |
| 107 | .path_to(v) |
| 108 | .and_then(|paths| Some(paths.iter().map(|&v| v).collect())); |
| 109 | assert_eq!(expect, &paths); |
| 110 | } |
| 111 | let expect_dist = expect.as_ref().map_or(usize::MAX, |v| v.len() - 1); |
| 112 | assert_eq!(expect_dist, paths.dist_to(v)); |
| 113 | } |
| 114 | } |
| 115 | |
| 116 | #[test] |
| 117 | fn cc() { |
nothing calls this directly
no test coverage detected