Move general graph compilation tests to 'src/test/graph_test.h'.
authoralpar
Fri, 03 Sep 2004 17:34:22 +0000
changeset 800b70a494b4912
parent 799 3393abe30678
child 801 48638058e188
Move general graph compilation tests to 'src/test/graph_test.h'.
src/test/Makefile.am
src/test/graph_test.cc
src/test/graph_test.h
     1.1 --- a/src/test/Makefile.am	Fri Sep 03 15:32:03 2004 +0000
     1.2 +++ b/src/test/Makefile.am	Fri Sep 03 17:34:22 2004 +0000
     1.3 @@ -1,6 +1,6 @@
     1.4  AM_CPPFLAGS = -I$(top_srcdir)/src
     1.5  
     1.6 -noinst_HEADERS = test_tools.h
     1.7 +noinst_HEADERS = test_tools.h graph_test.h
     1.8  
     1.9  check_PROGRAMS = test_tools_pass test_tools_fail \
    1.10  	graph_test \
     2.1 --- a/src/test/graph_test.cc	Fri Sep 03 15:32:03 2004 +0000
     2.2 +++ b/src/test/graph_test.cc	Fri Sep 03 17:34:22 2004 +0000
     2.3 @@ -5,6 +5,7 @@
     2.4  #include<hugo/full_graph.h>
     2.5  
     2.6  #include"test_tools.h"
     2.7 +#include"graph_test.h"
     2.8  
     2.9  /**
    2.10  \file
    2.11 @@ -13,306 +14,17 @@
    2.12  G.addNode(), G.addEdge(), G.tail(), G.head()
    2.13  
    2.14  \todo Checks for empty graphs and isolated points.
    2.15 -\todo Checks for Node->NodeIt, Edge->{EdgeIt,InEdgeIt,OutEdgeIt}
    2.16  conversion.
    2.17  */
    2.18  
    2.19  using namespace hugo;
    2.20  
    2.21 -template<class Graph> void checkCompileStaticGraph(Graph &G) 
    2.22 -{
    2.23 -  typedef typename Graph::Node Node;
    2.24 -  typedef typename Graph::NodeIt NodeIt;
    2.25 -  typedef typename Graph::Edge Edge;
    2.26 -  typedef typename Graph::EdgeIt EdgeIt;
    2.27 -  typedef typename Graph::InEdgeIt InEdgeIt;
    2.28 -  typedef typename Graph::OutEdgeIt OutEdgeIt;
    2.29 -  
    2.30 -  {
    2.31 -    Node i; Node j(i); Node k(INVALID);
    2.32 -    i=j;
    2.33 -    //    bool b=G.valid(i); b=b;
    2.34 -    bool b; b=b;
    2.35 -    b=(i==INVALID); b=(i!=INVALID);
    2.36 -    b=(i==j); b=(i!=j); b=(i<j);
    2.37 -  }
    2.38 -  {
    2.39 -    NodeIt i; NodeIt j(i); NodeIt k(INVALID); NodeIt l(G);
    2.40 -    i=j;
    2.41 -    j=G.first(i);
    2.42 -    j=++i;
    2.43 -    //    bool b=G.valid(i); b=b;
    2.44 -    bool b; b=b;
    2.45 -    b=(i==INVALID); b=(i!=INVALID);
    2.46 -    Node n(i);
    2.47 -    n=i;
    2.48 -    b=(i==j); b=(i!=j); b=(i<j);
    2.49 -    //Node ->NodeIt conversion
    2.50 -    NodeIt ni(G,n);
    2.51 -  }
    2.52 -  {
    2.53 -    Edge i; Edge j(i); Edge k(INVALID);
    2.54 -    i=j;
    2.55 -    //    bool b=G.valid(i); b=b;
    2.56 -    bool b; b=b;
    2.57 -    b=(i==INVALID); b=(i!=INVALID);
    2.58 -    b=(i==j); b=(i!=j); b=(i<j);
    2.59 -  }
    2.60 -  {
    2.61 -    EdgeIt i; EdgeIt j(i); EdgeIt k(INVALID); EdgeIt l(G);
    2.62 -    i=j;
    2.63 -    j=G.first(i);
    2.64 -    j=++i;
    2.65 -    //    bool b=G.valid(i); b=b;
    2.66 -    bool b; b=b;
    2.67 -    b=(i==INVALID); b=(i!=INVALID);
    2.68 -    Edge e(i);
    2.69 -    e=i;
    2.70 -    b=(i==j); b=(i!=j); b=(i<j);
    2.71 -    //Edge ->EdgeIt conversion
    2.72 -    EdgeIt ei(G,e);
    2.73 -  }
    2.74 -  {
    2.75 -    Node n;
    2.76 -    InEdgeIt i; InEdgeIt j(i); InEdgeIt k(INVALID); InEdgeIt l(G,n);
    2.77 -    i=j;
    2.78 -    j=G.first(i,n);
    2.79 -    j=++i;
    2.80 -    //    bool b=G.valid(i); b=b;
    2.81 -    bool b; b=b;
    2.82 -    b=(i==INVALID); b=(i!=INVALID);
    2.83 -    Edge e(i);
    2.84 -    e=i;
    2.85 -    b=(i==j); b=(i!=j); b=(i<j);
    2.86 -    //Edge ->InEdgeIt conversion
    2.87 -    InEdgeIt ei(G,e);
    2.88 -  }
    2.89 -  {
    2.90 -    Node n;
    2.91 -    OutEdgeIt i; OutEdgeIt j(i); OutEdgeIt k(INVALID); OutEdgeIt l(G,n);
    2.92 -    i=j;
    2.93 -    j=G.first(i,n);
    2.94 -    j=++i;
    2.95 -    //    bool b=G.valid(i); b=b;
    2.96 -    bool b; b=b;
    2.97 -    b=(i==INVALID); b=(i!=INVALID);
    2.98 -    Edge e(i);
    2.99 -    e=i;
   2.100 -    b=(i==j); b=(i!=j); b=(i<j);
   2.101 -    //Edge ->OutEdgeIt conversion
   2.102 -    OutEdgeIt ei(G,e);
   2.103 -  }
   2.104 -  {
   2.105 -    Node n,m;
   2.106 -    n=m=INVALID;
   2.107 -    Edge e;
   2.108 -    e=INVALID;
   2.109 -    n=G.tail(e);
   2.110 -    n=G.head(e);
   2.111 -  }
   2.112 -  // id tests
   2.113 -  { Node n; int i=G.id(n); i=i; }
   2.114 -  { Edge e; int i=G.id(e); i=i; }
   2.115 -  //NodeMap tests
   2.116 -  {
   2.117 -    Node k;
   2.118 -    typename Graph::template NodeMap<int> m(G);
   2.119 -    //Const map
   2.120 -    typename Graph::template NodeMap<int> const &cm = m;
   2.121 -    //Inicialize with default value
   2.122 -    typename Graph::template NodeMap<int> mdef(G,12);
   2.123 -    //Copy
   2.124 -    typename Graph::template NodeMap<int> mm(cm);
   2.125 -    //Copy from another type
   2.126 -    typename Graph::template NodeMap<double> dm(cm);
   2.127 -    int v;
   2.128 -    v=m[k]; m[k]=v; m.set(k,v);
   2.129 -    v=cm[k];
   2.130 -    
   2.131 -    m=cm;  
   2.132 -    dm=cm; //Copy from another type
   2.133 -    {
   2.134 -      //Check the typedef's
   2.135 -      typename Graph::template NodeMap<int>::ValueType val;
   2.136 -      val=1;
   2.137 -      typename Graph::template NodeMap<int>::KeyType key;
   2.138 -      key = typename Graph::NodeIt(G);
   2.139 -    }
   2.140 -  }  
   2.141 -  { //bool NodeMap
   2.142 -    Node k;
   2.143 -    typename Graph::template NodeMap<bool> m(G);
   2.144 -    typename Graph::template NodeMap<bool> const &cm = m;  //Const map
   2.145 -    //Inicialize with default value
   2.146 -    typename Graph::template NodeMap<bool> mdef(G,12);
   2.147 -    typename Graph::template NodeMap<bool> mm(cm);   //Copy
   2.148 -    typename Graph::template NodeMap<int> dm(cm); //Copy from another type
   2.149 -    bool v;
   2.150 -    v=m[k]; m[k]=v; m.set(k,v);
   2.151 -    v=cm[k];
   2.152 -    
   2.153 -    m=cm;  
   2.154 -    dm=cm; //Copy from another type
   2.155 -    m=dm; //Copy to another type
   2.156 -
   2.157 -    {
   2.158 -      //Check the typedef's
   2.159 -      typename Graph::template NodeMap<bool>::ValueType val;
   2.160 -      val=true;
   2.161 -      typename Graph::template NodeMap<bool>::KeyType key;
   2.162 -      key= typename Graph::NodeIt(G);
   2.163 -    }
   2.164 -  }
   2.165 -  //EdgeMap tests
   2.166 -  {
   2.167 -    Edge k;
   2.168 -    typename Graph::template EdgeMap<int> m(G);
   2.169 -    typename Graph::template EdgeMap<int> const &cm = m;  //Const map
   2.170 -    //Inicialize with default value
   2.171 -    typename Graph::template EdgeMap<int> mdef(G,12);
   2.172 -    typename Graph::template EdgeMap<int> mm(cm);   //Copy
   2.173 -    typename Graph::template EdgeMap<double> dm(cm); //Copy from another type
   2.174 -    int v;
   2.175 -    v=m[k]; m[k]=v; m.set(k,v);
   2.176 -    v=cm[k];
   2.177 -    
   2.178 -    m=cm;  
   2.179 -    dm=cm; //Copy from another type
   2.180 -    {
   2.181 -      //Check the typedef's
   2.182 -      typename Graph::template EdgeMap<int>::ValueType val;
   2.183 -      val=1;
   2.184 -      typename Graph::template EdgeMap<int>::KeyType key;
   2.185 -      key= typename Graph::EdgeIt(G);
   2.186 -    }
   2.187 -  }  
   2.188 -  { //bool EdgeMap
   2.189 -    Edge k;
   2.190 -    typename Graph::template EdgeMap<bool> m(G);
   2.191 -    typename Graph::template EdgeMap<bool> const &cm = m;  //Const map
   2.192 -    //Inicialize with default value
   2.193 -    typename Graph::template EdgeMap<bool> mdef(G,12);
   2.194 -    typename Graph::template EdgeMap<bool> mm(cm);   //Copy
   2.195 -    typename Graph::template EdgeMap<int> dm(cm); //Copy from another type
   2.196 -    bool v;
   2.197 -    v=m[k]; m[k]=v; m.set(k,v);
   2.198 -    v=cm[k];
   2.199 -    
   2.200 -    m=cm;  
   2.201 -    dm=cm; //Copy from another type
   2.202 -    m=dm; //Copy to another type
   2.203 -    {
   2.204 -      //Check the typedef's
   2.205 -      typename Graph::template EdgeMap<bool>::ValueType val;
   2.206 -      val=true;
   2.207 -      typename Graph::template EdgeMap<bool>::KeyType key;
   2.208 -      key= typename Graph::EdgeIt(G);
   2.209 -    }
   2.210 -  }
   2.211 -}
   2.212 -
   2.213 -template<class Graph> void checkCompile(Graph &G) 
   2.214 -{
   2.215 -  checkCompileStaticGraph(G);
   2.216 -
   2.217 -  typedef typename Graph::Node Node;
   2.218 -  typedef typename Graph::NodeIt NodeIt;
   2.219 -  typedef typename Graph::Edge Edge;
   2.220 -  typedef typename Graph::EdgeIt EdgeIt;
   2.221 -  typedef typename Graph::InEdgeIt InEdgeIt;
   2.222 -  typedef typename Graph::OutEdgeIt OutEdgeIt;
   2.223 -  
   2.224 -  Node n,m;
   2.225 -  n=G.addNode();
   2.226 -  m=G.addNode();
   2.227 -  Edge e;
   2.228 -  e=G.addEdge(n,m); 
   2.229 -  
   2.230 -  //  G.clear();
   2.231 -}
   2.232 -
   2.233 -template<class Graph> void checkCompileErase(Graph &G) 
   2.234 -{
   2.235 -  typedef typename Graph::Node Node;
   2.236 -  typedef typename Graph::Edge Edge;
   2.237 -  Node n;
   2.238 -  Edge e;
   2.239 -  G.erase(n);
   2.240 -  G.erase(e);
   2.241 -}
   2.242 -
   2.243 -template<class Graph> void checkCompileEraseEdge(Graph &G) 
   2.244 -{
   2.245 -  typedef typename Graph::Edge Edge;
   2.246 -  Edge e;
   2.247 -  G.erase(e);
   2.248 -}
   2.249 -
   2.250 -template<class Graph> void checkCompileFindEdge(Graph &G) 
   2.251 -{
   2.252 -  typedef typename Graph::NodeIt Node;
   2.253 -  typedef typename Graph::NodeIt NodeIt;
   2.254 -
   2.255 -  G.findEdge(NodeIt(G),++NodeIt(G),G.findEdge(NodeIt(G),++NodeIt(G)));
   2.256 -  G.findEdge(Node(),Node(),G.findEdge(Node(),Node()));  
   2.257 -}
   2.258 -
   2.259 -
   2.260 -template<class Graph> void checkNodeList(Graph &G, int nn)
   2.261 -{
   2.262 -  typename Graph::NodeIt n(G);
   2.263 -  for(int i=0;i<nn;i++) {
   2.264 -    check(n!=INVALID,"Wrong Node list linking.");
   2.265 -    ++n;
   2.266 -  }
   2.267 -  check(n==INVALID,"Wrong Node list linking.");
   2.268 -}
   2.269 -
   2.270 -template<class Graph> void checkEdgeList(Graph &G, int nn)
   2.271 -{
   2.272 -  typedef typename Graph::EdgeIt EdgeIt;
   2.273 -
   2.274 -  EdgeIt e(G);
   2.275 -  for(int i=0;i<nn;i++) {
   2.276 -    check(e!=INVALID,"Wrong Edge list linking.");
   2.277 -    ++e;
   2.278 -  }
   2.279 -  check(e==INVALID,"Wrong Edge list linking.");
   2.280 -}
   2.281 -
   2.282 -template<class Graph> void checkOutEdgeList(Graph &G,
   2.283 -					    typename Graph::Node n,
   2.284 -					    int nn)
   2.285 -{
   2.286 -  typename Graph::OutEdgeIt e(G,n);
   2.287 -  for(int i=0;i<nn;i++) {
   2.288 -    check(e!=INVALID,"Wrong OutEdge list linking.");
   2.289 -    ++e;
   2.290 -  }
   2.291 -  check(e==INVALID,"Wrong OutEdge list linking.");
   2.292 -}
   2.293 -
   2.294 -template<class Graph> void checkInEdgeList(Graph &G,
   2.295 -					   typename Graph::Node n,
   2.296 -					   int nn)
   2.297 -{
   2.298 -  typename Graph::InEdgeIt e(G,n);
   2.299 -  for(int i=0;i<nn;i++) {
   2.300 -    check(e!=INVALID,"Wrong InEdge list linking.");
   2.301 -    ++e;
   2.302 -  }
   2.303 -  check(e==INVALID,"Wrong InEdge list linking.");
   2.304 -}
   2.305 -
   2.306 -///\file
   2.307 -///\todo Checks head(), tail() as well;
   2.308 -
   2.309  template<class Graph> void bidirPetersen(Graph &G)
   2.310  {
   2.311    typedef typename Graph::Edge Edge;
   2.312    typedef typename Graph::EdgeIt EdgeIt;
   2.313    
   2.314 -  checkEdgeList(G,15);
   2.315 +  checkGraphEdgeList(G,15);
   2.316    
   2.317    std::vector<Edge> ee;
   2.318    
   2.319 @@ -329,12 +41,12 @@
   2.320    typedef typename Graph::EdgeIt EdgeIt;
   2.321    typedef typename Graph::NodeIt NodeIt;
   2.322  
   2.323 -  checkNodeList(G,10);
   2.324 -  checkEdgeList(G,30);
   2.325 +  checkGraphNodeList(G,10);
   2.326 +  checkGraphEdgeList(G,30);
   2.327  
   2.328    for(NodeIt n(G);n!=INVALID;++n) {
   2.329 -    checkInEdgeList(G,n,3);
   2.330 -    checkOutEdgeList(G,n,3);
   2.331 +    checkGraphInEdgeList(G,n,3);
   2.332 +    checkGraphOutEdgeList(G,n,3);
   2.333      ++n;
   2.334    }  
   2.335  }
   2.336 @@ -343,44 +55,48 @@
   2.337  template void checkCompileStaticGraph<skeleton::StaticGraphSkeleton>
   2.338  (skeleton::StaticGraphSkeleton &);
   2.339  
   2.340 -template void checkCompile<skeleton::GraphSkeleton>(skeleton::GraphSkeleton &);
   2.341 +template void checkCompileGraph<skeleton::GraphSkeleton>
   2.342 +(skeleton::GraphSkeleton &);
   2.343  
   2.344 -template void checkCompileErase<skeleton::EraseableGraphSkeleton>
   2.345 +template void checkCompileErasableGraph<skeleton::EraseableGraphSkeleton>
   2.346  (skeleton::EraseableGraphSkeleton &);
   2.347  
   2.348  //Compile SmartGraph
   2.349 -template void checkCompile<SmartGraph>(SmartGraph &);
   2.350 +template void checkCompileGraph<SmartGraph>(SmartGraph &);
   2.351 +template void checkCompileGraphFindEdge<SmartGraph>(SmartGraph &);
   2.352  
   2.353  //Compile SymSmartGraph
   2.354 -template void checkCompile<SymSmartGraph>(SymSmartGraph &);
   2.355 +template void checkCompileGraph<SymSmartGraph>(SymSmartGraph &);
   2.356 +template void checkCompileGraphFindEdge<SymSmartGraph>(SymSmartGraph &);
   2.357  
   2.358  //Compile ListGraph
   2.359 -template void checkCompile<ListGraph>(ListGraph &);
   2.360 -template void checkCompileErase<ListGraph>(ListGraph &);
   2.361 -template void checkCompileFindEdge<ListGraph>(ListGraph &);
   2.362 +template void checkCompileGraph<ListGraph>(ListGraph &);
   2.363 +template void checkCompileErasableGraph<ListGraph>(ListGraph &);
   2.364 +template void checkCompileGraphFindEdge<ListGraph>(ListGraph &);
   2.365  
   2.366  
   2.367  //Compile SymListGraph
   2.368 -template void checkCompile<SymListGraph>(SymListGraph &);
   2.369 -template void checkCompileErase<SymListGraph>(SymListGraph &);
   2.370 -template void checkCompileFindEdge<SymListGraph>(SymListGraph &);
   2.371 +template void checkCompileGraph<SymListGraph>(SymListGraph &);
   2.372 +template void checkCompileErasableGraph<SymListGraph>(SymListGraph &);
   2.373 +template void checkCompileGraphFindEdge<SymListGraph>(SymListGraph &);
   2.374  
   2.375  //Compile FullGraph
   2.376  template void checkCompileStaticGraph<FullGraph>(FullGraph &);
   2.377 -template void checkCompileFindEdge<FullGraph>(FullGraph &);
   2.378 +template void checkCompileGraphFindEdge<FullGraph>(FullGraph &);
   2.379  
   2.380  //Compile EdgeSet <ListGraph>
   2.381 -template void checkCompile<EdgeSet <ListGraph> >(EdgeSet <ListGraph> &);
   2.382 -template
   2.383 -void checkCompileEraseEdge<EdgeSet <ListGraph> >(EdgeSet <ListGraph> &);
   2.384 -template
   2.385 -void checkCompileFindEdge<EdgeSet <ListGraph> >(EdgeSet <ListGraph> &);
   2.386 +template void checkCompileGraph<EdgeSet <ListGraph> >(EdgeSet <ListGraph> &);
   2.387 +template void checkCompileGraphEraseEdge<EdgeSet <ListGraph> >
   2.388 +(EdgeSet <ListGraph> &);
   2.389 +template void checkCompileGraphFindEdge<EdgeSet <ListGraph> >
   2.390 +(EdgeSet <ListGraph> &);
   2.391  
   2.392  //Compile EdgeSet <NodeSet>
   2.393 -template void checkCompile<EdgeSet <NodeSet> >(EdgeSet <NodeSet> &);
   2.394 -template
   2.395 -void checkCompileEraseEdge<EdgeSet <NodeSet> >(EdgeSet <NodeSet> &);
   2.396 -template void checkCompileFindEdge<EdgeSet <NodeSet> >(EdgeSet <NodeSet> &);
   2.397 +template void checkCompileGraph<EdgeSet <NodeSet> >(EdgeSet <NodeSet> &);
   2.398 +template void checkCompileGraphEraseEdge<EdgeSet <NodeSet> >
   2.399 +(EdgeSet <NodeSet> &);
   2.400 +template void checkCompileGraphFindEdge<EdgeSet <NodeSet> >
   2.401 +(EdgeSet <NodeSet> &);
   2.402  
   2.403  
   2.404  int main() 
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/src/test/graph_test.h	Fri Sep 03 17:34:22 2004 +0000
     3.3 @@ -0,0 +1,306 @@
     3.4 +#ifndef HUGO_TEST_GRAPH_TEST_H
     3.5 +#define HUGO_TEST_GRAPH_TEST_H
     3.6 +
     3.7 +
     3.8 +#include "test_tools.h"
     3.9 +
    3.10 +//! \ingroup misc
    3.11 +//! \file
    3.12 +//! \brief Some utility to  test graph classes.
    3.13 +namespace hugo {
    3.14 +
    3.15 +
    3.16 +template<class Graph> void checkCompileStaticGraph(Graph &G) 
    3.17 +{
    3.18 +  typedef typename Graph::Node Node;
    3.19 +  typedef typename Graph::NodeIt NodeIt;
    3.20 +  typedef typename Graph::Edge Edge;
    3.21 +  typedef typename Graph::EdgeIt EdgeIt;
    3.22 +  typedef typename Graph::InEdgeIt InEdgeIt;
    3.23 +  typedef typename Graph::OutEdgeIt OutEdgeIt;
    3.24 +  
    3.25 +  {
    3.26 +    Node i; Node j(i); Node k(INVALID);
    3.27 +    i=j;
    3.28 +    //    bool b=G.valid(i); b=b;
    3.29 +    bool b; b=b;
    3.30 +    b=(i==INVALID); b=(i!=INVALID);
    3.31 +    b=(i==j); b=(i!=j); b=(i<j);
    3.32 +  }
    3.33 +  {
    3.34 +    NodeIt i; NodeIt j(i); NodeIt k(INVALID); NodeIt l(G);
    3.35 +    i=j;
    3.36 +    j=G.first(i);
    3.37 +    j=++i;
    3.38 +    //    bool b=G.valid(i); b=b;
    3.39 +    bool b; b=b;
    3.40 +    b=(i==INVALID); b=(i!=INVALID);
    3.41 +    Node n(i);
    3.42 +    n=i;
    3.43 +    b=(i==j); b=(i!=j); b=(i<j);
    3.44 +    //Node ->NodeIt conversion
    3.45 +    NodeIt ni(G,n);
    3.46 +  }
    3.47 +  {
    3.48 +    Edge i; Edge j(i); Edge k(INVALID);
    3.49 +    i=j;
    3.50 +    //    bool b=G.valid(i); b=b;
    3.51 +    bool b; b=b;
    3.52 +    b=(i==INVALID); b=(i!=INVALID);
    3.53 +    b=(i==j); b=(i!=j); b=(i<j);
    3.54 +  }
    3.55 +  {
    3.56 +    EdgeIt i; EdgeIt j(i); EdgeIt k(INVALID); EdgeIt l(G);
    3.57 +    i=j;
    3.58 +    j=G.first(i);
    3.59 +    j=++i;
    3.60 +    //    bool b=G.valid(i); b=b;
    3.61 +    bool b; b=b;
    3.62 +    b=(i==INVALID); b=(i!=INVALID);
    3.63 +    Edge e(i);
    3.64 +    e=i;
    3.65 +    b=(i==j); b=(i!=j); b=(i<j);
    3.66 +    //Edge ->EdgeIt conversion
    3.67 +    EdgeIt ei(G,e);
    3.68 +  }
    3.69 +  {
    3.70 +    Node n;
    3.71 +    InEdgeIt i; InEdgeIt j(i); InEdgeIt k(INVALID); InEdgeIt l(G,n);
    3.72 +    i=j;
    3.73 +    j=G.first(i,n);
    3.74 +    j=++i;
    3.75 +    //    bool b=G.valid(i); b=b;
    3.76 +    bool b; b=b;
    3.77 +    b=(i==INVALID); b=(i!=INVALID);
    3.78 +    Edge e(i);
    3.79 +    e=i;
    3.80 +    b=(i==j); b=(i!=j); b=(i<j);
    3.81 +    //Edge ->InEdgeIt conversion
    3.82 +    InEdgeIt ei(G,e);
    3.83 +  }
    3.84 +  {
    3.85 +    Node n;
    3.86 +    OutEdgeIt i; OutEdgeIt j(i); OutEdgeIt k(INVALID); OutEdgeIt l(G,n);
    3.87 +    i=j;
    3.88 +    j=G.first(i,n);
    3.89 +    j=++i;
    3.90 +    //    bool b=G.valid(i); b=b;
    3.91 +    bool b; b=b;
    3.92 +    b=(i==INVALID); b=(i!=INVALID);
    3.93 +    Edge e(i);
    3.94 +    e=i;
    3.95 +    b=(i==j); b=(i!=j); b=(i<j);
    3.96 +    //Edge ->OutEdgeIt conversion
    3.97 +    OutEdgeIt ei(G,e);
    3.98 +  }
    3.99 +  {
   3.100 +    Node n,m;
   3.101 +    n=m=INVALID;
   3.102 +    Edge e;
   3.103 +    e=INVALID;
   3.104 +    n=G.tail(e);
   3.105 +    n=G.head(e);
   3.106 +  }
   3.107 +  // id tests
   3.108 +  { Node n; int i=G.id(n); i=i; }
   3.109 +  { Edge e; int i=G.id(e); i=i; }
   3.110 +  //NodeMap tests
   3.111 +  {
   3.112 +    Node k;
   3.113 +    typename Graph::template NodeMap<int> m(G);
   3.114 +    //Const map
   3.115 +    typename Graph::template NodeMap<int> const &cm = m;
   3.116 +    //Inicialize with default value
   3.117 +    typename Graph::template NodeMap<int> mdef(G,12);
   3.118 +    //Copy
   3.119 +    typename Graph::template NodeMap<int> mm(cm);
   3.120 +    //Copy from another type
   3.121 +    typename Graph::template NodeMap<double> dm(cm);
   3.122 +    int v;
   3.123 +    v=m[k]; m[k]=v; m.set(k,v);
   3.124 +    v=cm[k];
   3.125 +    
   3.126 +    m=cm;  
   3.127 +    dm=cm; //Copy from another type
   3.128 +    {
   3.129 +      //Check the typedef's
   3.130 +      typename Graph::template NodeMap<int>::ValueType val;
   3.131 +      val=1;
   3.132 +      typename Graph::template NodeMap<int>::KeyType key;
   3.133 +      key = typename Graph::NodeIt(G);
   3.134 +    }
   3.135 +  }  
   3.136 +  { //bool NodeMap
   3.137 +    Node k;
   3.138 +    typename Graph::template NodeMap<bool> m(G);
   3.139 +    typename Graph::template NodeMap<bool> const &cm = m;  //Const map
   3.140 +    //Inicialize with default value
   3.141 +    typename Graph::template NodeMap<bool> mdef(G,12);
   3.142 +    typename Graph::template NodeMap<bool> mm(cm);   //Copy
   3.143 +    typename Graph::template NodeMap<int> dm(cm); //Copy from another type
   3.144 +    bool v;
   3.145 +    v=m[k]; m[k]=v; m.set(k,v);
   3.146 +    v=cm[k];
   3.147 +    
   3.148 +    m=cm;  
   3.149 +    dm=cm; //Copy from another type
   3.150 +    m=dm; //Copy to another type
   3.151 +
   3.152 +    {
   3.153 +      //Check the typedef's
   3.154 +      typename Graph::template NodeMap<bool>::ValueType val;
   3.155 +      val=true;
   3.156 +      typename Graph::template NodeMap<bool>::KeyType key;
   3.157 +      key= typename Graph::NodeIt(G);
   3.158 +    }
   3.159 +  }
   3.160 +  //EdgeMap tests
   3.161 +  {
   3.162 +    Edge k;
   3.163 +    typename Graph::template EdgeMap<int> m(G);
   3.164 +    typename Graph::template EdgeMap<int> const &cm = m;  //Const map
   3.165 +    //Inicialize with default value
   3.166 +    typename Graph::template EdgeMap<int> mdef(G,12);
   3.167 +    typename Graph::template EdgeMap<int> mm(cm);   //Copy
   3.168 +    typename Graph::template EdgeMap<double> dm(cm); //Copy from another type
   3.169 +    int v;
   3.170 +    v=m[k]; m[k]=v; m.set(k,v);
   3.171 +    v=cm[k];
   3.172 +    
   3.173 +    m=cm;  
   3.174 +    dm=cm; //Copy from another type
   3.175 +    {
   3.176 +      //Check the typedef's
   3.177 +      typename Graph::template EdgeMap<int>::ValueType val;
   3.178 +      val=1;
   3.179 +      typename Graph::template EdgeMap<int>::KeyType key;
   3.180 +      key= typename Graph::EdgeIt(G);
   3.181 +    }
   3.182 +  }  
   3.183 +  { //bool EdgeMap
   3.184 +    Edge k;
   3.185 +    typename Graph::template EdgeMap<bool> m(G);
   3.186 +    typename Graph::template EdgeMap<bool> const &cm = m;  //Const map
   3.187 +    //Inicialize with default value
   3.188 +    typename Graph::template EdgeMap<bool> mdef(G,12);
   3.189 +    typename Graph::template EdgeMap<bool> mm(cm);   //Copy
   3.190 +    typename Graph::template EdgeMap<int> dm(cm); //Copy from another type
   3.191 +    bool v;
   3.192 +    v=m[k]; m[k]=v; m.set(k,v);
   3.193 +    v=cm[k];
   3.194 +    
   3.195 +    m=cm;  
   3.196 +    dm=cm; //Copy from another type
   3.197 +    m=dm; //Copy to another type
   3.198 +    {
   3.199 +      //Check the typedef's
   3.200 +      typename Graph::template EdgeMap<bool>::ValueType val;
   3.201 +      val=true;
   3.202 +      typename Graph::template EdgeMap<bool>::KeyType key;
   3.203 +      key= typename Graph::EdgeIt(G);
   3.204 +    }
   3.205 +  }
   3.206 +}
   3.207 +
   3.208 +template<class Graph> void checkCompileGraph(Graph &G) 
   3.209 +{
   3.210 +  checkCompileStaticGraph(G);
   3.211 +
   3.212 +  typedef typename Graph::Node Node;
   3.213 +  typedef typename Graph::NodeIt NodeIt;
   3.214 +  typedef typename Graph::Edge Edge;
   3.215 +  typedef typename Graph::EdgeIt EdgeIt;
   3.216 +  typedef typename Graph::InEdgeIt InEdgeIt;
   3.217 +  typedef typename Graph::OutEdgeIt OutEdgeIt;
   3.218 +  
   3.219 +  Node n,m;
   3.220 +  n=G.addNode();
   3.221 +  m=G.addNode();
   3.222 +  Edge e;
   3.223 +  e=G.addEdge(n,m); 
   3.224 +  
   3.225 +  //  G.clear();
   3.226 +}
   3.227 +
   3.228 +template<class Graph> void checkCompileGraphEraseEdge(Graph &G) 
   3.229 +{
   3.230 +  typename Graph::Edge e;
   3.231 +  G.erase(e);
   3.232 +}
   3.233 +
   3.234 +template<class Graph> void checkCompileGraphEraseNode(Graph &G) 
   3.235 +{
   3.236 +  typename Graph::Node n;
   3.237 +  G.erase(n);
   3.238 +}
   3.239 +
   3.240 +template<class Graph> void checkCompileErasableGraph(Graph &G) 
   3.241 +{
   3.242 +  checkCompileGraph(G);
   3.243 +  checkCompileGraphEraseNode(G);
   3.244 +  checkCompileGraphEraseEdge(G);
   3.245 +}
   3.246 +
   3.247 +template<class Graph> void checkCompileGraphFindEdge(Graph &G) 
   3.248 +{
   3.249 +  typedef typename Graph::NodeIt Node;
   3.250 +  typedef typename Graph::NodeIt NodeIt;
   3.251 +
   3.252 +  G.findEdge(NodeIt(G),++NodeIt(G),G.findEdge(NodeIt(G),++NodeIt(G)));
   3.253 +  G.findEdge(Node(),Node(),G.findEdge(Node(),Node()));  
   3.254 +}
   3.255 +
   3.256 +template<class Graph> void checkGraphNodeList(Graph &G, int nn)
   3.257 +{
   3.258 +  typename Graph::NodeIt n(G);
   3.259 +  for(int i=0;i<nn;i++) {
   3.260 +    check(n!=INVALID,"Wrong Node list linking.");
   3.261 +    ++n;
   3.262 +  }
   3.263 +  check(n==INVALID,"Wrong Node list linking.");
   3.264 +}
   3.265 +
   3.266 +template<class Graph> void checkGraphEdgeList(Graph &G, int nn)
   3.267 +{
   3.268 +  typedef typename Graph::EdgeIt EdgeIt;
   3.269 +
   3.270 +  EdgeIt e(G);
   3.271 +  for(int i=0;i<nn;i++) {
   3.272 +    check(e!=INVALID,"Wrong Edge list linking.");
   3.273 +    ++e;
   3.274 +  }
   3.275 +  check(e==INVALID,"Wrong Edge list linking.");
   3.276 +}
   3.277 +
   3.278 +template<class Graph> void checkGraphOutEdgeList(Graph &G,
   3.279 +						 typename Graph::Node n,
   3.280 +						 int nn)
   3.281 +{
   3.282 +  typename Graph::OutEdgeIt e(G,n);
   3.283 +  for(int i=0;i<nn;i++) {
   3.284 +    check(e!=INVALID,"Wrong OutEdge list linking.");
   3.285 +    ++e;
   3.286 +  }
   3.287 +  check(e==INVALID,"Wrong OutEdge list linking.");
   3.288 +}
   3.289 +
   3.290 +template<class Graph> void checkGraphInEdgeList(Graph &G,
   3.291 +						typename Graph::Node n,
   3.292 +						int nn)
   3.293 +{
   3.294 +  typename Graph::InEdgeIt e(G,n);
   3.295 +  for(int i=0;i<nn;i++) {
   3.296 +    check(e!=INVALID,"Wrong InEdge list linking.");
   3.297 +    ++e;
   3.298 +  }
   3.299 +  check(e==INVALID,"Wrong InEdge list linking.");
   3.300 +}
   3.301 +
   3.302 +///\file
   3.303 +///\todo Check head(), tail() as well;
   3.304 +
   3.305 +  
   3.306 +} //namespace hugo
   3.307 +
   3.308 +
   3.309 +#endif