test/graph_test.cc
changeset 368 99f1bdf8f7db
parent 348 052cecabcb71
parent 365 37557a46e298
child 377 a12eef1f82b2
     1.1 --- a/test/graph_test.cc	Wed Oct 29 15:29:34 2008 +0100
     1.2 +++ b/test/graph_test.cc	Tue Nov 04 10:21:22 2008 +0000
     1.3 @@ -19,7 +19,7 @@
     1.4  #include <lemon/concepts/graph.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  #include <lemon/grid_graph.h>
    1.10  
    1.11  #include "test_tools.h"
    1.12 @@ -95,6 +95,53 @@
    1.13    checkGraphEdgeMap(G);
    1.14  }
    1.15  
    1.16 +void checkFullGraph(int num) {
    1.17 +  typedef FullGraph Graph;
    1.18 +  GRAPH_TYPEDEFS(Graph);
    1.19 +
    1.20 +  Graph G(num);
    1.21 +  checkGraphNodeList(G, num);
    1.22 +  checkGraphEdgeList(G, num * (num - 1) / 2);
    1.23 +
    1.24 +  for (NodeIt n(G); n != INVALID; ++n) {
    1.25 +    checkGraphOutArcList(G, n, num - 1);    
    1.26 +    checkGraphInArcList(G, n, num - 1);    
    1.27 +    checkGraphIncEdgeList(G, n, num - 1);    
    1.28 +  }
    1.29 +
    1.30 +  checkGraphConArcList(G, num * (num - 1));
    1.31 +  checkGraphConEdgeList(G, num * (num - 1) / 2);
    1.32 +
    1.33 +  checkArcDirections(G);
    1.34 +
    1.35 +  checkNodeIds(G);
    1.36 +  checkArcIds(G);
    1.37 +  checkEdgeIds(G);
    1.38 +  checkGraphNodeMap(G);
    1.39 +  checkGraphArcMap(G);
    1.40 +  checkGraphEdgeMap(G);
    1.41 +
    1.42 +  
    1.43 +  for (int i = 0; i < G.nodeNum(); ++i) {
    1.44 +    check(G.index(G(i)) == i, "Wrong index");
    1.45 +  }
    1.46 +
    1.47 +  for (NodeIt u(G); u != INVALID; ++u) {
    1.48 +    for (NodeIt v(G); v != INVALID; ++v) {
    1.49 +      Edge e = G.edge(u, v);
    1.50 +      Arc a = G.arc(u, v);
    1.51 +      if (u == v) {
    1.52 +        check(e == INVALID, "Wrong edge lookup");
    1.53 +        check(a == INVALID, "Wrong arc lookup");
    1.54 +      } else {
    1.55 +        check((G.u(e) == u && G.v(e) == v) ||
    1.56 +              (G.u(e) == v && G.v(e) == u), "Wrong edge lookup");
    1.57 +        check(G.source(a) == u && G.target(a) == v, "Wrong arc lookup");
    1.58 +      }
    1.59 +    }
    1.60 +  }
    1.61 +}
    1.62 +
    1.63  void checkConcepts() {
    1.64    { // Checking graph components
    1.65      checkConcept<BaseGraphComponent, BaseGraphComponent >();
    1.66 @@ -124,10 +171,9 @@
    1.67      checkConcept<ExtendableGraphComponent<>, SmartGraph>();
    1.68      checkConcept<ClearableGraphComponent<>, SmartGraph>();
    1.69    }
    1.70 -//  { // Checking FullGraph
    1.71 -//    checkConcept<Graph, FullGraph>();
    1.72 -//    checkGraphIterators<FullGraph>();
    1.73 -//  }
    1.74 +  { // Checking FullGraph
    1.75 +    checkConcept<Graph, FullGraph>();
    1.76 +  }
    1.77    { // Checking GridGraph
    1.78      checkConcept<Graph, GridGraph>();
    1.79    }
    1.80 @@ -275,11 +321,10 @@
    1.81      checkGraph<SmartGraph>();
    1.82      checkGraphValidity<SmartGraph>();
    1.83    }
    1.84 -//   { // Checking FullGraph
    1.85 -//     FullGraph g(5);
    1.86 -//     checkGraphNodeList(g, 5);
    1.87 -//     checkGraphEdgeList(g, 10);
    1.88 -//   }
    1.89 +  { // Checking FullGraph   
    1.90 +    checkFullGraph(7);
    1.91 +    checkFullGraph(8);
    1.92 +  }
    1.93    { // Checking GridGraph
    1.94      checkGridGraph(5, 8);
    1.95      checkGridGraph(8, 5);