@@ -64,6 +64,7 @@ SCENARIO("call_graph",
64
64
// }
65
65
// void C() { }
66
66
// void D() { }
67
+ // void E() { }
67
68
68
69
goto_modelt goto_model;
69
70
code_typet void_function_type;
@@ -101,6 +102,8 @@ SCENARIO("call_graph",
101
102
create_void_function_symbol (" C" , code_skipt ()));
102
103
goto_model.symbol_table .add (
103
104
create_void_function_symbol (" D" , code_skipt ()));
105
+ goto_model.symbol_table .add (
106
+ create_void_function_symbol (" E" , code_skipt ()));
104
107
105
108
stream_message_handlert msg (std::cout);
106
109
goto_convert (goto_model, msg);
@@ -183,6 +186,11 @@ SCENARIO("call_graph",
183
186
for (node_indext i=0 ; i<exported.size (); ++i)
184
187
nodes_by_name[exported[i].function ]=i;
185
188
189
+ THEN (" We expect 5 nodes" )
190
+ {
191
+ REQUIRE (exported.size () == 5 );
192
+ }
193
+
186
194
THEN (" We expect edges A -> { A, B }, B -> { C, D }" )
187
195
{
188
196
// Note that means the extra A -> B edge has gone away (the grapht
@@ -228,6 +236,14 @@ SCENARIO("call_graph",
228
236
REQUIRE (predecessors.count (" B" ));
229
237
REQUIRE (predecessors.count (" D" ));
230
238
}
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
+ }
231
247
}
232
248
233
249
WHEN (" The call graph, with call sites, is exported as a grapht" )
@@ -241,6 +257,11 @@ SCENARIO("call_graph",
241
257
for (node_indext i=0 ; i<exported.size (); ++i)
242
258
nodes_by_name[exported[i].function ]=i;
243
259
260
+ THEN (" We expect 5 nodes" )
261
+ {
262
+ REQUIRE (exported.size () == 5 );
263
+ }
264
+
244
265
THEN (" We expect edges A -> { A, B }, B -> { C, D }" )
245
266
{
246
267
// Note that means the extra A -> B edge has gone away (the grapht
0 commit comments