File tree Expand file tree Collapse file tree 1 file changed +23
-21
lines changed
src/librustc_data_structures/graph/scc Expand file tree Collapse file tree 1 file changed +23
-21
lines changed Original file line number Diff line number Diff line change @@ -85,9 +85,30 @@ fn test_three_sccs() {
8585#[ test]
8686fn test_find_state_2 ( ) {
8787 // The order in which things will be visited is important to this
88- // test. It tests part of the `find_state` behavior.
88+ // test. It tests part of the `find_state` behavior. Here is the
89+ // graph:
8990 //
90- // We will start in our DFS by visiting:
91+ //
92+ // /----+
93+ // 0 <--+ |
94+ // | | |
95+ // v | |
96+ // +-> 1 -> 3 4
97+ // | | |
98+ // | v |
99+ // +-- 2 <----+
100+
101+ let graph = TestGraph :: new ( 0 , & [
102+ ( 0 , 1 ) ,
103+ ( 0 , 4 ) ,
104+ ( 1 , 2 ) ,
105+ ( 1 , 3 ) ,
106+ ( 2 , 1 ) ,
107+ ( 3 , 0 ) ,
108+ ( 4 , 2 ) ,
109+ ] ) ;
110+
111+ // For this graph, we will start in our DFS by visiting:
91112 //
92113 // 0 -> 1 -> 2 -> 1
93114 //
@@ -114,25 +135,6 @@ fn test_find_state_2() {
114135 // 2 InCycleWith { 1 }
115136 // 3 InCycleWith { 0 }
116137
117- /*
118- /----+
119- 0 <--+ |
120- | | |
121- v | |
122- +-> 1 -> 3 4
123- | | |
124- | v |
125- +-- 2 <----+
126- */
127- let graph = TestGraph :: new ( 0 , & [
128- ( 0 , 1 ) ,
129- ( 0 , 4 ) ,
130- ( 1 , 2 ) ,
131- ( 1 , 3 ) ,
132- ( 2 , 1 ) ,
133- ( 3 , 0 ) ,
134- ( 4 , 2 ) ,
135- ] ) ;
136138 let sccs: Sccs < _ , usize > = Sccs :: new ( & graph) ;
137139 assert_eq ! ( sccs. num_sccs( ) , 1 ) ;
138140 assert_eq ! ( sccs. scc( 0 ) , 0 ) ;
You can’t perform that action at this time.
0 commit comments