1.1 --- a/test/digraph_test.cc Tue Nov 04 10:25:47 2008 +0000
1.2 +++ b/test/digraph_test.cc Wed Nov 05 21:36:28 2008 +0100
1.3 @@ -20,7 +20,7 @@
1.4 #include <lemon/list_graph.h>
1.5 #include <lemon/smart_graph.h>
1.6 #include <lemon/full_graph.h>
1.7 -//#include <lemon/hypercube_graph.h>
1.8 +#include <lemon/hypercube_graph.h>
1.9
1.10 #include "test_tools.h"
1.11 #include "graph_test.h"
1.12 @@ -112,6 +112,35 @@
1.13
1.14 }
1.15
1.16 +void checkHypercubeDigraph(int dim) {
1.17 + DIGRAPH_TYPEDEFS(HypercubeDigraph);
1.18 +
1.19 + HypercubeDigraph G(dim);
1.20 + checkGraphNodeList(G, 1 << dim);
1.21 + checkGraphArcList(G, (1 << dim) * dim);
1.22 +
1.23 + Node n = G.nodeFromId(dim);
1.24 +
1.25 + checkGraphOutArcList(G, n, dim);
1.26 + for (OutArcIt a(G, n); a != INVALID; ++a)
1.27 + check(G.source(a) == n &&
1.28 + G.id(G.target(a)) == G.id(n) ^ (1 << G.dimension(a)),
1.29 + "Wrong arc");
1.30 +
1.31 + checkGraphInArcList(G, n, dim);
1.32 + for (InArcIt a(G, n); a != INVALID; ++a)
1.33 + check(G.target(a) == n &&
1.34 + G.id(G.source(a)) == G.id(n) ^ (1 << G.dimension(a)),
1.35 + "Wrong arc");
1.36 +
1.37 + checkGraphConArcList(G, (1 << dim) * dim);
1.38 +
1.39 + checkNodeIds(G);
1.40 + checkArcIds(G);
1.41 + checkGraphNodeMap(G);
1.42 + checkGraphArcMap(G);
1.43 +}
1.44 +
1.45
1.46 void checkConcepts() {
1.47 { // Checking digraph components
1.48 @@ -145,9 +174,9 @@
1.49 { // Checking FullDigraph
1.50 checkConcept<Digraph, FullDigraph>();
1.51 }
1.52 -// { // Checking HyperCubeDigraph
1.53 -// checkConcept<Digraph, HyperCubeDigraph>();
1.54 -// }
1.55 + { // Checking HypercubeDigraph
1.56 + checkConcept<Digraph, HypercubeDigraph>();
1.57 + }
1.58 }
1.59
1.60 template <typename Digraph>
1.61 @@ -212,6 +241,12 @@
1.62 { // Checking FullDigraph
1.63 checkFullDigraph(8);
1.64 }
1.65 + { // Checking HypercubeDigraph
1.66 + checkHypercubeDigraph(1);
1.67 + checkHypercubeDigraph(2);
1.68 + checkHypercubeDigraph(3);
1.69 + checkHypercubeDigraph(4);
1.70 + }
1.71 }
1.72
1.73 int main() {