Add test for sccc of a long list
This commit is contained in:
parent
a41e2fd963
commit
355904dca0
1 changed files with 26 additions and 0 deletions
|
@ -142,6 +142,32 @@ fn test_find_state_3() {
|
|||
assert_eq!(sccs.successors(1), &[0]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_deep_linear() {
|
||||
/*
|
||||
0
|
||||
|
|
||||
v
|
||||
1
|
||||
|
|
||||
v
|
||||
2
|
||||
|
|
||||
v
|
||||
…
|
||||
*/
|
||||
const NR_NODES: usize = 1 << 14;
|
||||
let mut nodes = vec![];
|
||||
for i in 1..NR_NODES {
|
||||
nodes.push((i - 1, i));
|
||||
}
|
||||
let graph = TestGraph::new(0, nodes.as_slice());
|
||||
let sccs: Sccs<_, usize> = Sccs::new(&graph);
|
||||
assert_eq!(sccs.num_sccs(), NR_NODES);
|
||||
assert_eq!(sccs.scc(0), NR_NODES - 1);
|
||||
assert_eq!(sccs.scc(NR_NODES - 1), 0);
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn bench_sccc(b: &mut test::Bencher) {
|
||||
// Like `test_three_sccs` but each state is replaced by a group of
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue