()
| 67 | |
| 68 | #[test] |
| 69 | fn dfs_paths() { |
| 70 | let graph = create_graph(TINY_CG); |
| 71 | let paths = DepthFirstPaths::new(graph.as_ref(), 0); |
| 72 | for (v, expect) in vec![ |
| 73 | Some(vec![0usize]), // 0 |
| 74 | Some(vec![0, 2, 1]), // 1 |
| 75 | Some(vec![0, 2]), // 2 |
| 76 | Some(vec![0, 2, 3]), // 3 |
| 77 | Some(vec![0, 2, 3, 4]), // 4 |
| 78 | Some(vec![0, 2, 3, 5]), // 5 |
| 79 | ] |
| 80 | .iter() |
| 81 | .enumerate() |
| 82 | { |
| 83 | let paths: Option<Vec<usize>> = paths |
| 84 | .path_to(v) |
| 85 | .and_then(|paths| Some(paths.iter().map(|&v| v).collect())); |
| 86 | assert_eq!(expect, &paths); |
| 87 | } |
| 88 | } |
| 89 | |
| 90 | #[test] |
| 91 | fn bfs_paths() { |
nothing calls this directly
no test coverage detected