diff --git a/test/graph_test.cc b/test/graph_test.cc --- a/test/graph_test.cc +++ b/test/graph_test.cc @@ -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,10 +171,9 @@ checkConcept, SmartGraph>(); checkConcept, SmartGraph>(); } -// { // Checking FullGraph -// checkConcept(); -// checkGraphIterators(); -// } + { // Checking FullGraph + checkConcept(); + } { // Checking GridGraph checkConcept(); } @@ -275,11 +321,10 @@ checkGraph(); checkGraphValidity(); } -// { // Checking FullGraph -// FullGraph g(5); -// checkGraphNodeList(g, 5); -// checkGraphEdgeList(g, 10); -// } + { // Checking FullGraph + checkFullGraph(7); + checkFullGraph(8); + } { // Checking GridGraph checkGridGraph(5, 8); checkGridGraph(8, 5);