diff --git a/test/graph_copy_test.cc b/test/graph_copy_test.cc --- a/test/graph_copy_test.cc +++ b/test/graph_copy_test.cc @@ -18,6 +18,7 @@ #include #include +#include #include #include @@ -26,6 +27,7 @@ using namespace std; using namespace lemon; +template void digraph_copy_test() { const int nn = 10; @@ -51,19 +53,19 @@ if (i == 0 && j == 0) fa = arc; } } + + // Test digraph copy + GR to; + typename GR::template NodeMap tnm(to); + typename GR::template ArcMap tam(to); + typename GR::Node tn; + typename GR::Arc ta; - // Test digraph copy - ListDigraph to; - ListDigraph::NodeMap tnm(to); - ListDigraph::ArcMap tam(to); - ListDigraph::Node tn; - ListDigraph::Arc ta; + SmartDigraph::NodeMap nr(from); + SmartDigraph::ArcMap er(from); - SmartDigraph::NodeMap nr(from); - SmartDigraph::ArcMap er(from); - - ListDigraph::NodeMap ncr(to); - ListDigraph::ArcMap ecr(to); + typename GR::template NodeMap ncr(to); + typename GR::template ArcMap ecr(to); digraphCopy(from, to). nodeMap(fnm, tnm).arcMap(fam, tam). @@ -86,11 +88,11 @@ check(nr[from.target(it)] == to.target(er[it]), "Wrong copy."); } - for (ListDigraph::NodeIt it(to); it != INVALID; ++it) { + for (typename GR::NodeIt it(to); it != INVALID; ++it) { check(nr[ncr[it]] == it, "Wrong copy."); } - for (ListDigraph::ArcIt it(to); it != INVALID; ++it) { + for (typename GR::ArcIt it(to); it != INVALID; ++it) { check(er[ecr[it]] == it, "Wrong copy."); } check(tn == nr[fn], "Wrong copy."); @@ -103,6 +105,7 @@ check(countArcs(from) == countArcs(to), "Wrong copy."); } +template void graph_copy_test() { const int nn = 10; @@ -135,21 +138,21 @@ } // Test graph copy - ListGraph to; - ListGraph::NodeMap tnm(to); - ListGraph::ArcMap tam(to); - ListGraph::EdgeMap tem(to); - ListGraph::Node tn; - ListGraph::Arc ta; - ListGraph::Edge te; + GR to; + typename GR::template NodeMap tnm(to); + typename GR::template ArcMap tam(to); + typename GR::template EdgeMap tem(to); + typename GR::Node tn; + typename GR::Arc ta; + typename GR::Edge te; - SmartGraph::NodeMap nr(from); - SmartGraph::ArcMap ar(from); - SmartGraph::EdgeMap er(from); + SmartGraph::NodeMap nr(from); + SmartGraph::ArcMap ar(from); + SmartGraph::EdgeMap er(from); - ListGraph::NodeMap ncr(to); - ListGraph::ArcMap acr(to); - ListGraph::EdgeMap ecr(to); + typename GR::template NodeMap ncr(to); + typename GR::template ArcMap acr(to); + typename GR::template EdgeMap ecr(to); graphCopy(from, to). nodeMap(fnm, tnm).arcMap(fam, tam).edgeMap(fem, tem). @@ -184,14 +187,14 @@ "Wrong copy."); } - for (ListGraph::NodeIt it(to); it != INVALID; ++it) { + for (typename GR::NodeIt it(to); it != INVALID; ++it) { check(nr[ncr[it]] == it, "Wrong copy."); } - for (ListGraph::ArcIt it(to); it != INVALID; ++it) { + for (typename GR::ArcIt it(to); it != INVALID; ++it) { check(ar[acr[it]] == it, "Wrong copy."); } - for (ListGraph::EdgeIt it(to); it != INVALID; ++it) { + for (typename GR::EdgeIt it(to); it != INVALID; ++it) { check(er[ecr[it]] == it, "Wrong copy."); } check(tn == nr[fn], "Wrong copy."); @@ -208,8 +211,11 @@ int main() { - digraph_copy_test(); - graph_copy_test(); + digraph_copy_test(); + digraph_copy_test(); + digraph_copy_test(); + graph_copy_test(); + graph_copy_test(); return 0; }