src/test/graph_test.cc
changeset 592 5961cce7ec53
parent 579 859f8c7e2a40
child 717 6874df3f61db
     1.1 --- a/src/test/graph_test.cc	Sun May 09 16:22:49 2004 +0000
     1.2 +++ b/src/test/graph_test.cc	Sun May 09 16:29:53 2004 +0000
     1.3 @@ -2,6 +2,7 @@
     1.4  #include<hugo/smart_graph.h>
     1.5  #include<hugo/skeletons/graph.h>
     1.6  #include<hugo/list_graph.h>
     1.7 +#include<hugo/full_graph.h>
     1.8  
     1.9  #include"test_tools.h"
    1.10  
    1.11 @@ -10,11 +11,12 @@
    1.12  
    1.13  G.addNode(), G.addEdge(), G.valid(), G.tail(), G.head()
    1.14  
    1.15 +\todo Checks for empty graphs and isolated points.
    1.16  */
    1.17  
    1.18  using namespace hugo;
    1.19  
    1.20 -template<class Graph> void checkCompile(Graph &G) 
    1.21 +template<class Graph> void checkCompileStaticGraph(Graph &G) 
    1.22  {
    1.23    typedef typename Graph::Node Node;
    1.24    typedef typename Graph::NodeIt NodeIt;
    1.25 @@ -79,9 +81,9 @@
    1.26    }
    1.27  
    1.28    Node n,m;
    1.29 -  n=G.addNode();
    1.30 +  n=m=INVALID;
    1.31    Edge e;
    1.32 -  e=G.addEdge(n,m);
    1.33 +  e=INVALID;
    1.34    n=G.tail(e);
    1.35    n=G.head(e);
    1.36  
    1.37 @@ -91,7 +93,7 @@
    1.38    { int i=G.id(n); i=i; }
    1.39    { int i=G.id(e); i=i; }
    1.40    
    1.41 -  G.clear();
    1.42 +  //  G.clear();
    1.43  
    1.44    //NodeMap tests
    1.45    {
    1.46 @@ -160,6 +162,25 @@
    1.47    
    1.48  }
    1.49  
    1.50 +template<class Graph> void checkCompile(Graph &G) 
    1.51 +{
    1.52 +  checkCompileStaticGraph(G);
    1.53 +
    1.54 +  typedef typename Graph::Node Node;
    1.55 +  typedef typename Graph::NodeIt NodeIt;
    1.56 +  typedef typename Graph::Edge Edge;
    1.57 +  typedef typename Graph::EdgeIt EdgeIt;
    1.58 +  typedef typename Graph::InEdgeIt InEdgeIt;
    1.59 +  typedef typename Graph::OutEdgeIt OutEdgeIt;
    1.60 +  
    1.61 +  Node n,m;
    1.62 +  n=G.addNode();
    1.63 +  m=G.addNode();
    1.64 +  
    1.65 +  G.addEdge(n,m);
    1.66 +}
    1.67 +
    1.68 +
    1.69  template<class Graph> void checkNodeList(Graph &G, int nn)
    1.70  {
    1.71    typename Graph::NodeIt n(G);
    1.72 @@ -244,6 +265,7 @@
    1.73  template void checkCompile<SymSmartGraph>(SymSmartGraph &);
    1.74  template void checkCompile<ListGraph>(ListGraph &);
    1.75  template void checkCompile<SymListGraph>(SymListGraph &);
    1.76 +template void checkCompileStaticGraph<FullGraph>(FullGraph &);
    1.77  
    1.78  //Due to some mysterious problems it does not work.
    1.79  template void checkCompile<EdgeSet <ListGraph> >(EdgeSet <ListGraph> &);