File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed
compiler/rustc_data_structures/src/graph/scc Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -142,6 +142,32 @@ fn test_find_state_3() {
142142 assert_eq ! ( sccs. successors( 1 ) , & [ 0 ] ) ;
143143}
144144
145+ #[ test]
146+ fn test_deep_linear ( ) {
147+ /*
148+ 0
149+ |
150+ v
151+ 1
152+ |
153+ v
154+ 2
155+ |
156+ v
157+ …
158+ */
159+ const NR_NODES : usize = 1 << 14 ;
160+ let mut nodes = vec ! [ ] ;
161+ for i in 1 ..NR_NODES {
162+ nodes. push ( ( i - 1 , i) ) ;
163+ }
164+ let graph = TestGraph :: new ( 0 , nodes. as_slice ( ) ) ;
165+ let sccs: Sccs < _ , usize > = Sccs :: new ( & graph) ;
166+ assert_eq ! ( sccs. num_sccs( ) , NR_NODES ) ;
167+ assert_eq ! ( sccs. scc( 0 ) , NR_NODES - 1 ) ;
168+ assert_eq ! ( sccs. scc( NR_NODES - 1 ) , 0 ) ;
169+ }
170+
145171#[ bench]
146172fn bench_sccc ( b : & mut test:: Bencher ) {
147173 // Like `test_three_sccs` but each state is replaced by a group of
You can’t perform that action at this time.
0 commit comments