@@ -64,6 +64,7 @@ SCENARIO("call_graph",
6464 // }
6565 // void C() { }
6666 // void D() { }
67+ // void E() { }
6768
6869 goto_modelt goto_model;
6970 code_typet void_function_type;
@@ -101,6 +102,8 @@ SCENARIO("call_graph",
101102 create_void_function_symbol (" C" , code_skipt ()));
102103 goto_model.symbol_table .add (
103104 create_void_function_symbol (" D" , code_skipt ()));
105+ goto_model.symbol_table .add (
106+ create_void_function_symbol (" E" , code_skipt ()));
104107
105108 stream_message_handlert msg (std::cout);
106109 goto_convert (goto_model, msg);
@@ -111,7 +114,7 @@ SCENARIO("call_graph",
111114 {
112115 THEN (" We expect A -> { A, B, B }, B -> { C, D }" )
113116 {
114- const auto &check_graph=call_graph_from_goto_functions.graph ;
117+ const auto &check_graph=call_graph_from_goto_functions.edges ;
115118 REQUIRE (check_graph.size ()==5 );
116119 REQUIRE (multimap_key_matches (check_graph, " A" , {" A" , " B" , " B" }));
117120 REQUIRE (multimap_key_matches (check_graph, " B" , {" C" , " D" }));
@@ -128,7 +131,7 @@ SCENARIO("call_graph",
128131 call_graph_from_goto_functions.get_inverted ();
129132 THEN (" We expect A -> { A }, B -> { A, A }, C -> { B }, D -> { B }" )
130133 {
131- const auto &check_graph=inverse_call_graph_from_goto_functions.graph ;
134+ const auto &check_graph=inverse_call_graph_from_goto_functions.edges ;
132135 REQUIRE (check_graph.size ()==5 );
133136 REQUIRE (multimap_key_matches (check_graph, " A" , {" A" }));
134137 REQUIRE (multimap_key_matches (check_graph, " B" , {" A" , " A" }));
@@ -143,9 +146,9 @@ SCENARIO("call_graph",
143146 THEN (" We expect two callsites for the A -> B edge, one for all others" )
144147 {
145148 const auto &check_callsites=call_graph_from_goto_functions.callsites ;
146- for (const auto &edge : call_graph_from_goto_functions.graph )
149+ for (const auto &edge : call_graph_from_goto_functions.edges )
147150 {
148- if (edge==call_grapht::grapht ::value_type (" A" , " B" ))
151+ if (edge==call_grapht::edgest ::value_type (" A" , " B" ))
149152 REQUIRE (check_callsites.at (edge).size ()==2 );
150153 else
151154 REQUIRE (check_callsites.at (edge).size ()==1 );
@@ -167,7 +170,7 @@ SCENARIO("call_graph",
167170 call_grapht::create_from_root_function (goto_model, " B" , false );
168171 THEN (" We expect only B -> C and B -> D in the resulting graph" )
169172 {
170- const auto &check_graph=call_graph_from_b.graph ;
173+ const auto &check_graph=call_graph_from_b.edges ;
171174 REQUIRE (check_graph.size ()==2 );
172175 REQUIRE (multimap_key_matches (check_graph, " B" , {" C" , " D" }));
173176 }
@@ -183,6 +186,11 @@ SCENARIO("call_graph",
183186 for (node_indext i=0 ; i<exported.size (); ++i)
184187 nodes_by_name[exported[i].function ]=i;
185188
189+ THEN (" We expect 5 nodes" )
190+ {
191+ REQUIRE (exported.size () == 5 );
192+ }
193+
186194 THEN (" We expect edges A -> { A, B }, B -> { C, D }" )
187195 {
188196 // Note that means the extra A -> B edge has gone away (the grapht
@@ -228,6 +236,14 @@ SCENARIO("call_graph",
228236 REQUIRE (predecessors.count (" B" ));
229237 REQUIRE (predecessors.count (" D" ));
230238 }
239+
240+ THEN (" We expect {E} to be able to reach E" )
241+ {
242+ std::set<irep_idt> predecessors =
243+ get_reaching_functions (exported, " E" );
244+ REQUIRE (predecessors.size () == 1 );
245+ REQUIRE (predecessors.count (" E" ));
246+ }
231247 }
232248
233249 WHEN (" The call graph, with call sites, is exported as a grapht" )
@@ -241,6 +257,11 @@ SCENARIO("call_graph",
241257 for (node_indext i=0 ; i<exported.size (); ++i)
242258 nodes_by_name[exported[i].function ]=i;
243259
260+ THEN (" We expect 5 nodes" )
261+ {
262+ REQUIRE (exported.size () == 5 );
263+ }
264+
244265 THEN (" We expect edges A -> { A, B }, B -> { C, D }" )
245266 {
246267 // Note that means the extra A -> B edge has gone away (the grapht
0 commit comments