alpar@780: #include "test_tools.h" alpar@780: #include alpar@780: #include alpar@793: #include alpar@780: alpar@780: using namespace hugo; alpar@780: alpar@780: const int PET_SIZE =5; alpar@780: alpar@780: alpar@780: void check_Dfs_SmartGraph_Compile() alpar@780: { alpar@793: typedef skeleton::StaticGraphSkeleton Graph; alpar@780: alpar@780: typedef Graph::Edge Edge; alpar@780: typedef Graph::Node Node; alpar@780: typedef Graph::EdgeIt EdgeIt; alpar@780: typedef Graph::NodeIt NodeIt; alpar@780: alpar@793: typedef Dfs DType; alpar@780: alpar@780: Graph G; alpar@780: Node n; alpar@780: Edge e; alpar@793: int l; alpar@780: bool b; alpar@793: DType::DistMap d(G); alpar@793: DType::PredMap p(G); alpar@793: DType::PredNodeMap pn(G); alpar@780: alpar@793: DType dfs_test(G); alpar@780: alpar@780: dfs_test.run(n); alpar@780: alpar@780: l = dfs_test.dist(n); alpar@780: e = dfs_test.pred(n); alpar@780: n = dfs_test.predNode(n); alpar@780: d = dfs_test.distMap(); alpar@780: p = dfs_test.predMap(); alpar@780: pn = dfs_test.predNodeMap(); alpar@780: b = dfs_test.reached(n); alpar@780: alpar@780: } alpar@780: alpar@780: int main() alpar@780: { alpar@780: alpar@780: typedef SmartGraph Graph; alpar@780: alpar@780: typedef Graph::Edge Edge; alpar@780: typedef Graph::Node Node; alpar@780: typedef Graph::EdgeIt EdgeIt; alpar@780: typedef Graph::NodeIt NodeIt; alpar@780: typedef Graph::EdgeMap LengthMap; alpar@780: alpar@780: Graph G; alpar@780: Node s, t; alpar@780: PetStruct ps = addPetersen(G,PET_SIZE); alpar@780: alpar@780: s=ps.outer[2]; alpar@780: t=ps.inner[0]; alpar@780: alpar@780: Dfs dfs_test(G); alpar@780: dfs_test.run(s); alpar@780: alpar@780: for(NodeIt v(G); v!=INVALID; ++v) { alpar@780: check(dfs_test.reached(v),"Each node should be reached."); alpar@780: if ( dfs_test.pred(v)!=INVALID ) { alpar@780: Edge e=dfs_test.pred(v); alpar@780: Node u=G.tail(e); alpar@780: check(u==dfs_test.predNode(v),"Wrong tree."); alpar@780: check(dfs_test.dist(v) - dfs_test.dist(u) == 1, alpar@780: "Wrong distance." << dfs_test.dist(v) << " " <