diff -r f1158744a112 -r 37557a46e298 test/graph_test.cc --- a/test/graph_test.cc Mon Aug 04 22:00:36 2008 +0200 +++ b/test/graph_test.cc Thu Aug 14 21:49:39 2008 +0200 @@ -19,7 +19,7 @@ #include #include #include -// #include +#include // #include #include "test_tools.h" @@ -95,6 +95,53 @@ checkGraphEdgeMap(G); } +void checkFullGraph(int num) { + typedef FullGraph Graph; + GRAPH_TYPEDEFS(Graph); + + Graph G(num); + checkGraphNodeList(G, num); + checkGraphEdgeList(G, num * (num - 1) / 2); + + for (NodeIt n(G); n != INVALID; ++n) { + checkGraphOutArcList(G, n, num - 1); + checkGraphInArcList(G, n, num - 1); + checkGraphIncEdgeList(G, n, num - 1); + } + + checkGraphConArcList(G, num * (num - 1)); + checkGraphConEdgeList(G, num * (num - 1) / 2); + + checkArcDirections(G); + + checkNodeIds(G); + checkArcIds(G); + checkEdgeIds(G); + checkGraphNodeMap(G); + checkGraphArcMap(G); + checkGraphEdgeMap(G); + + + for (int i = 0; i < G.nodeNum(); ++i) { + check(G.index(G(i)) == i, "Wrong index"); + } + + for (NodeIt u(G); u != INVALID; ++u) { + for (NodeIt v(G); v != INVALID; ++v) { + Edge e = G.edge(u, v); + Arc a = G.arc(u, v); + if (u == v) { + check(e == INVALID, "Wrong edge lookup"); + check(a == INVALID, "Wrong arc lookup"); + } else { + check((G.u(e) == u && G.v(e) == v) || + (G.u(e) == v && G.v(e) == u), "Wrong edge lookup"); + check(G.source(a) == u && G.target(a) == v, "Wrong arc lookup"); + } + } + } +} + void checkConcepts() { { // Checking graph components checkConcept(); @@ -124,14 +171,12 @@ checkConcept, SmartGraph>(); checkConcept, SmartGraph>(); } -// { // Checking FullGraph -// checkConcept(); -// checkGraphIterators(); -// } -// { // Checking GridGraph -// checkConcept(); -// checkGraphIterators(); -// } + { // Checking FullGraph + checkConcept(); + } +// { // Checking GridGraph +// checkConcept(); +// } } template @@ -241,11 +286,10 @@ checkGraph(); checkGraphValidity(); } -// { // Checking FullGraph -// FullGraph g(5); -// checkGraphNodeList(g, 5); -// checkGraphEdgeList(g, 10); -// } + { // Checking FullGraph + checkFullGraph(7); + checkFullGraph(8); + } // { // Checking GridGraph // GridGraph g(5, 6); // checkGraphNodeList(g, 30);