Skip to content

Commit 538070c

Browse files
committed
Add tests for for_each_predecessor() and for_each_successor()
1 parent ba0420c commit 538070c

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

unit/util/graph.cpp

+11
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,17 @@ SCENARIO("predecessors-successors-graph", "[core][util][graph]")
329329
REQUIRE(graph.get_successors(indices[0]).size() == 1);
330330
REQUIRE(graph.get_predecessors(indices[1]).size() == 1);
331331
REQUIRE(graph.get_successors(indices[1]).size() == 0);
332+
333+
int count = 0;
334+
graph.for_each_predecessor(
335+
indices[1], [&](const simple_grapht::node_indext &n) { count++; });
336+
REQUIRE(count == 1);
337+
338+
// Refresh counter.
339+
count = 0;
340+
graph.for_each_successor(
341+
indices[1], [&](const simple_grapht::node_indext &n) { count++; });
342+
REQUIRE(count == 0);
332343
}
333344
}
334345
}

0 commit comments

Comments
 (0)