Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion test/Jamfile.v2
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ alias graph_test_regular :
[ run test_graphs.cpp ]
[ run index_graph.cpp ] # TODO: Make this part of the test_graphs framework
[ run labeled_graph.cpp ]
[ run finish_edge_bug.cpp ]

[ run transitive_closure_test.cpp /boost/timer//boost_timer ]
[ run transitive_closure_test2.cpp ]
Expand Down
30 changes: 30 additions & 0 deletions test/dfs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,34 @@ template < typename Graph > struct dfs_test
}
};

// regression guard: finish_edge must fire once per edge (it once never did)
struct finish_edge_counter : boost::dfs_visitor<>
{
explicit finish_edge_counter(std::size_t& count) : m_count(&count) {}
template < class Edge, class Graph > void finish_edge(Edge, Graph&) const
{
++*m_count;
}
std::size_t* m_count;
};

void test_finish_edge_is_called()
{
using graph_t = boost::adjacency_list< boost::vecS, boost::vecS, boost::directedS >;
graph_t g;
graph_t::vertex_descriptor a = boost::add_vertex(g);
graph_t::vertex_descriptor b = boost::add_vertex(g);
graph_t::vertex_descriptor c = boost::add_vertex(g);
boost::add_edge(a, b, g);
boost::add_edge(b, c, g);
boost::add_edge(c, a, g);
boost::add_edge(a, c, g);

std::size_t finish_edge_calls = 0;
boost::depth_first_search(g, boost::visitor(finish_edge_counter(finish_edge_calls)));
BOOST_TEST_EQ(finish_edge_calls, boost::num_edges(g));
}

// usage: dfs.exe [max-vertices=15]

int main(int argc, char* argv[])
Expand All @@ -202,5 +230,7 @@ int main(int argc, char* argv[])
boost::property< boost::vertex_color_t,
boost::default_color_type > > >::go(max_V);

test_finish_edge_is_called();

return boost::report_errors();
}
84 changes: 0 additions & 84 deletions test/finish_edge_bug.cpp

This file was deleted.

Loading