1.1 --- a/test/bpgraph_test.cc Sun Nov 14 20:06:23 2010 +0100
1.2 +++ b/test/bpgraph_test.cc Sun Nov 14 22:48:32 2010 +0100
1.3 @@ -19,7 +19,7 @@
1.4 #include <lemon/concepts/bpgraph.h>
1.5 //#include <lemon/list_graph.h>
1.6 #include <lemon/smart_graph.h>
1.7 -//#include <lemon/full_graph.h>
1.8 +#include <lemon/full_graph.h>
1.9
1.10 #include "test_tools.h"
1.11 #include "graph_test.h"
1.12 @@ -250,12 +250,90 @@
1.13 }
1.14 }
1.15
1.16 +void checkFullBpGraph(int redNum, int blueNum) {
1.17 + typedef FullBpGraph BpGraph;
1.18 + BPGRAPH_TYPEDEFS(BpGraph);
1.19 +
1.20 + BpGraph G(redNum, blueNum);
1.21 + checkGraphNodeList(G, redNum + blueNum);
1.22 + checkGraphRedNodeList(G, redNum);
1.23 + checkGraphBlueNodeList(G, blueNum);
1.24 + checkGraphEdgeList(G, redNum * blueNum);
1.25 + checkGraphArcList(G, 2 * redNum * blueNum);
1.26 +
1.27 + G.resize(redNum, blueNum);
1.28 + checkGraphNodeList(G, redNum + blueNum);
1.29 + checkGraphRedNodeList(G, redNum);
1.30 + checkGraphBlueNodeList(G, blueNum);
1.31 + checkGraphEdgeList(G, redNum * blueNum);
1.32 + checkGraphArcList(G, 2 * redNum * blueNum);
1.33 +
1.34 + for (RedIt n(G); n != INVALID; ++n) {
1.35 + checkGraphOutArcList(G, n, blueNum);
1.36 + checkGraphInArcList(G, n, blueNum);
1.37 + checkGraphIncEdgeList(G, n, blueNum);
1.38 + }
1.39 +
1.40 + for (BlueIt n(G); n != INVALID; ++n) {
1.41 + checkGraphOutArcList(G, n, redNum);
1.42 + checkGraphInArcList(G, n, redNum);
1.43 + checkGraphIncEdgeList(G, n, redNum);
1.44 + }
1.45 +
1.46 + checkGraphConArcList(G, 2 * redNum * blueNum);
1.47 + checkGraphConEdgeList(G, redNum * blueNum);
1.48 +
1.49 + checkArcDirections(G);
1.50 +
1.51 + checkNodeIds(G);
1.52 + checkRedNodeIds(G);
1.53 + checkBlueNodeIds(G);
1.54 + checkArcIds(G);
1.55 + checkEdgeIds(G);
1.56 +
1.57 + checkGraphNodeMap(G);
1.58 + checkGraphRedMap(G);
1.59 + checkGraphBlueMap(G);
1.60 + checkGraphArcMap(G);
1.61 + checkGraphEdgeMap(G);
1.62 +
1.63 + for (int i = 0; i < G.redNum(); ++i) {
1.64 + check(G.red(G.redNode(i)), "Wrong node");
1.65 + check(G.redIndex(G.redNode(i)) == i, "Wrong index");
1.66 + }
1.67 +
1.68 + for (int i = 0; i < G.blueNum(); ++i) {
1.69 + check(G.blue(G.blueNode(i)), "Wrong node");
1.70 + check(G.blueIndex(G.blueNode(i)) == i, "Wrong index");
1.71 + }
1.72 +
1.73 + for (NodeIt u(G); u != INVALID; ++u) {
1.74 + for (NodeIt v(G); v != INVALID; ++v) {
1.75 + Edge e = G.edge(u, v);
1.76 + Arc a = G.arc(u, v);
1.77 + if (G.red(u) == G.red(v)) {
1.78 + check(e == INVALID, "Wrong edge lookup");
1.79 + check(a == INVALID, "Wrong arc lookup");
1.80 + } else {
1.81 + check((G.u(e) == u && G.v(e) == v) ||
1.82 + (G.u(e) == v && G.v(e) == u), "Wrong edge lookup");
1.83 + check(G.source(a) == u && G.target(a) == v, "Wrong arc lookup");
1.84 + }
1.85 + }
1.86 + }
1.87 +
1.88 +}
1.89 +
1.90 void checkGraphs() {
1.91 { // Checking SmartGraph
1.92 checkBpGraphBuild<SmartBpGraph>();
1.93 checkBpGraphSnapshot<SmartBpGraph>();
1.94 checkBpGraphValidity<SmartBpGraph>();
1.95 }
1.96 + { // Checking FullBpGraph
1.97 + checkFullBpGraph(6, 8);
1.98 + checkFullBpGraph(7, 4);
1.99 + }
1.100 }
1.101
1.102 int main() {