test/digraph_test.cc
changeset 353 37557a46e298
parent 228 b6732e0d38c5
child 354 80a4d0742e98
equal deleted inserted replaced
4:db88099cfdc8 5:aec518f84435
    17  */
    17  */
    18 
    18 
    19 #include <lemon/concepts/digraph.h>
    19 #include <lemon/concepts/digraph.h>
    20 #include <lemon/list_graph.h>
    20 #include <lemon/list_graph.h>
    21 #include <lemon/smart_graph.h>
    21 #include <lemon/smart_graph.h>
    22 //#include <lemon/full_graph.h>
    22 #include <lemon/full_graph.h>
    23 //#include <lemon/hypercube_graph.h>
    23 //#include <lemon/hypercube_graph.h>
    24 
    24 
    25 #include "test_tools.h"
    25 #include "test_tools.h"
    26 #include "graph_test.h"
    26 #include "graph_test.h"
    27 
    27 
    77   checkGraphNodeMap(G);
    77   checkGraphNodeMap(G);
    78   checkGraphArcMap(G);
    78   checkGraphArcMap(G);
    79 
    79 
    80 }
    80 }
    81 
    81 
       
    82 void checkFullDigraph(int num) {
       
    83   typedef FullDigraph Digraph;
       
    84   DIGRAPH_TYPEDEFS(Digraph);
       
    85   Digraph G(num);
       
    86 
       
    87   checkGraphNodeList(G, num);
       
    88   checkGraphArcList(G, num * num);
       
    89 
       
    90   for (NodeIt n(G); n != INVALID; ++n) {
       
    91     checkGraphOutArcList(G, n, num);
       
    92     checkGraphInArcList(G, n, num);
       
    93   }
       
    94 
       
    95   checkGraphConArcList(G, num * num);
       
    96 
       
    97   checkNodeIds(G);
       
    98   checkArcIds(G);
       
    99   checkGraphNodeMap(G);
       
   100   checkGraphArcMap(G);
       
   101 
       
   102   for (int i = 0; i < G.nodeNum(); ++i) {
       
   103     check(G.index(G(i)) == i, "Wrong index");
       
   104   }
       
   105 
       
   106   for (NodeIt s(G); s != INVALID; ++s) {
       
   107     for (NodeIt t(G); t != INVALID; ++t) {
       
   108       Arc a = G.arc(s, t);
       
   109       check(G.source(a) == s && G.target(a) == t, "Wrong arc lookup");
       
   110     }
       
   111   }
       
   112 
       
   113 }
       
   114 
    82 
   115 
    83 void checkConcepts() {
   116 void checkConcepts() {
    84   { // Checking digraph components
   117   { // Checking digraph components
    85     checkConcept<BaseDigraphComponent, BaseDigraphComponent >();
   118     checkConcept<BaseDigraphComponent, BaseDigraphComponent >();
    86 
   119 
   174   }
   207   }
   175   { // Checking SmartDigraph
   208   { // Checking SmartDigraph
   176     checkDigraph<SmartDigraph>();
   209     checkDigraph<SmartDigraph>();
   177     checkDigraphValidity<SmartDigraph>();
   210     checkDigraphValidity<SmartDigraph>();
   178   }
   211   }
       
   212   { // Checking FullDigraph
       
   213     checkFullDigraph(8);
       
   214   }
   179 }
   215 }
   180 
   216 
   181 int main() {
   217 int main() {
   182   checkDigraphs();
   218   checkDigraphs();
   183   checkConcepts();
   219   checkConcepts();