src/test/graph_test.h
changeset 938 70e2886211d5
parent 937 d4e911acef3d
child 946 c94ef40a22ce
     1.1 --- a/src/test/graph_test.h	Mon Oct 04 17:13:21 2004 +0000
     1.2 +++ b/src/test/graph_test.h	Tue Oct 05 09:41:05 2004 +0000
     1.3 @@ -24,251 +24,6 @@
     1.4  //! \brief Some utility to  test graph classes.
     1.5  namespace lemon {
     1.6  
     1.7 -  struct DummyType {
     1.8 -    int value;
     1.9 -    DummyType() {}
    1.10 -    DummyType(int p) : value(p) {}
    1.11 -    DummyType& operator=(int p) { value = p; return *this;}
    1.12 -  };
    1.13 -
    1.14 -
    1.15 -  template<class Graph> void checkCompileStaticGraph(Graph &G) 
    1.16 -    {
    1.17 -      typedef typename Graph::Node Node;
    1.18 -      typedef typename Graph::NodeIt NodeIt;
    1.19 -      typedef typename Graph::Edge Edge;
    1.20 -      typedef typename Graph::EdgeIt EdgeIt;
    1.21 -      typedef typename Graph::InEdgeIt InEdgeIt;
    1.22 -      typedef typename Graph::OutEdgeIt OutEdgeIt;
    1.23 -  
    1.24 -      {
    1.25 -	Node i; Node j(i); Node k(INVALID);
    1.26 -	i=j;
    1.27 -	bool b; b=true;
    1.28 -	b=(i==INVALID); b=(i!=INVALID);
    1.29 -	b=(i==j); b=(i!=j); b=(i<j);
    1.30 -      }
    1.31 -      {
    1.32 -	NodeIt i; NodeIt j(i); NodeIt k(INVALID); NodeIt l(G);
    1.33 -	i=j;
    1.34 -	j=G.first(i);
    1.35 -	j=++i;
    1.36 -	bool b; b=true;
    1.37 -	b=(i==INVALID); b=(i!=INVALID);
    1.38 -	Node n(i);
    1.39 -	n=i;
    1.40 -	b=(i==j); b=(i!=j); b=(i<j);
    1.41 -	//Node ->NodeIt conversion
    1.42 -	NodeIt ni(G,n);
    1.43 -      }
    1.44 -      {
    1.45 -	Edge i; Edge j(i); Edge k(INVALID);
    1.46 -	i=j;
    1.47 -	bool b; b=true;
    1.48 -	b=(i==INVALID); b=(i!=INVALID);
    1.49 -	b=(i==j); b=(i!=j); b=(i<j);
    1.50 -      }
    1.51 -      {
    1.52 -	EdgeIt i; EdgeIt j(i); EdgeIt k(INVALID); EdgeIt l(G);
    1.53 -	i=j;
    1.54 -	j=G.first(i);
    1.55 -	j=++i;
    1.56 -	bool b; b=true;
    1.57 -	b=(i==INVALID); b=(i!=INVALID);
    1.58 -	Edge e(i);
    1.59 -	e=i;
    1.60 -	b=(i==j); b=(i!=j); b=(i<j);
    1.61 -	//Edge ->EdgeIt conversion
    1.62 -	EdgeIt ei(G,e);
    1.63 -      }
    1.64 -      {
    1.65 -	Node n;
    1.66 -	InEdgeIt i; InEdgeIt j(i); InEdgeIt k(INVALID); InEdgeIt l(G,n);
    1.67 -	i=j;
    1.68 -	j=G.first(i,n);
    1.69 -	j=++i;
    1.70 -	bool b; b=true;
    1.71 -	b=(i==INVALID); b=(i!=INVALID);
    1.72 -	Edge e(i);
    1.73 -	e=i;
    1.74 -	b=(i==j); b=(i!=j); b=(i<j);
    1.75 -	//Edge ->InEdgeIt conversion
    1.76 -	InEdgeIt ei(G,e);
    1.77 -      }
    1.78 -      {
    1.79 -	Node n;
    1.80 -	OutEdgeIt i; OutEdgeIt j(i); OutEdgeIt k(INVALID); OutEdgeIt l(G,n);
    1.81 -	i=j;
    1.82 -	j=G.first(i,n);
    1.83 -	j=++i;
    1.84 -	bool b; b=true;
    1.85 -	b=(i==INVALID); b=(i!=INVALID);
    1.86 -	Edge e(i);
    1.87 -	e=i;
    1.88 -	b=(i==j); b=(i!=j); b=(i<j);
    1.89 -	//Edge ->OutEdgeIt conversion
    1.90 -	OutEdgeIt ei(G,e);
    1.91 -      }
    1.92 -      {
    1.93 -	Node n,m;
    1.94 -	n=m=INVALID;
    1.95 -	Edge e;
    1.96 -	e=INVALID;
    1.97 -	n=G.tail(e);
    1.98 -	n=G.head(e);
    1.99 -      }
   1.100 -      // id tests
   1.101 -      { Node n; int i=G.id(n); i=i; }
   1.102 -      { Edge e; int i=G.id(e); i=i; }
   1.103 -      //NodeMap tests
   1.104 -      {
   1.105 -	Node k;
   1.106 -	typename Graph::template NodeMap<int> m(G);
   1.107 -	//Const map
   1.108 -	typename Graph::template NodeMap<int> const &cm = m;
   1.109 -	//Inicialize with default value
   1.110 -	typename Graph::template NodeMap<int> mdef(G,12);
   1.111 -	//Copy
   1.112 -	typename Graph::template NodeMap<int> mm(cm);
   1.113 -	//Copy from another type
   1.114 -	typename Graph::template NodeMap<double> dm(cm);
   1.115 -	//Copy to more complex type
   1.116 -	typename Graph::template NodeMap<DummyType> em(cm);
   1.117 -	int v;
   1.118 -	v=m[k]; m[k]=v; m.set(k,v);
   1.119 -	v=cm[k];
   1.120 -    
   1.121 -	m=cm;  
   1.122 -	dm=cm; //Copy from another type  
   1.123 -	em=cm; //Copy to more complex type
   1.124 -	{
   1.125 -	  //Check the typedef's
   1.126 -	  typename Graph::template NodeMap<int>::ValueType val;
   1.127 -	  val=1;
   1.128 -	  typename Graph::template NodeMap<int>::KeyType key;
   1.129 -	  key = typename Graph::NodeIt(G);
   1.130 -	}
   1.131 -      }  
   1.132 -      { //bool NodeMap
   1.133 -	Node k;
   1.134 -	typename Graph::template NodeMap<bool> m(G);
   1.135 -	typename Graph::template NodeMap<bool> const &cm = m;  //Const map
   1.136 -	//Inicialize with default value
   1.137 -	typename Graph::template NodeMap<bool> mdef(G,12);
   1.138 -	typename Graph::template NodeMap<bool> mm(cm);   //Copy
   1.139 -	typename Graph::template NodeMap<int> dm(cm); //Copy from another type
   1.140 -	bool v;
   1.141 -	v=m[k]; m[k]=v; m.set(k,v);
   1.142 -	v=cm[k];
   1.143 -    
   1.144 -	m=cm;  
   1.145 -	dm=cm; //Copy from another type
   1.146 -	m=dm; //Copy to another type
   1.147 -
   1.148 -	{
   1.149 -	  //Check the typedef's
   1.150 -	  typename Graph::template NodeMap<bool>::ValueType val;
   1.151 -	  val=true;
   1.152 -	  typename Graph::template NodeMap<bool>::KeyType key;
   1.153 -	  key= typename Graph::NodeIt(G);
   1.154 -	}
   1.155 -      }
   1.156 -      //EdgeMap tests
   1.157 -      {
   1.158 -	Edge k;
   1.159 -	typename Graph::template EdgeMap<int> m(G);
   1.160 -	typename Graph::template EdgeMap<int> const &cm = m;  //Const map
   1.161 -	//Inicialize with default value
   1.162 -	typename Graph::template EdgeMap<int> mdef(G,12);
   1.163 -	typename Graph::template EdgeMap<int> mm(cm);   //Copy
   1.164 -	typename Graph::template EdgeMap<double> dm(cm); //Copy from another type
   1.165 -	int v;
   1.166 -	v=m[k]; m[k]=v; m.set(k,v);
   1.167 -	v=cm[k];
   1.168 -    
   1.169 -	m=cm;  
   1.170 -	dm=cm; //Copy from another type
   1.171 -	{
   1.172 -	  //Check the typedef's
   1.173 -	  typename Graph::template EdgeMap<int>::ValueType val;
   1.174 -	  val=1;
   1.175 -	  typename Graph::template EdgeMap<int>::KeyType key;
   1.176 -	  key= typename Graph::EdgeIt(G);
   1.177 -	}
   1.178 -      }  
   1.179 -      { //bool EdgeMap
   1.180 -	Edge k;
   1.181 -	typename Graph::template EdgeMap<bool> m(G);
   1.182 -	typename Graph::template EdgeMap<bool> const &cm = m;  //Const map
   1.183 -	//Inicialize with default value
   1.184 -	typename Graph::template EdgeMap<bool> mdef(G,12);
   1.185 -	typename Graph::template EdgeMap<bool> mm(cm);   //Copy
   1.186 -	typename Graph::template EdgeMap<int> dm(cm); //Copy from another type
   1.187 -	bool v;
   1.188 -	v=m[k]; m[k]=v; m.set(k,v);
   1.189 -	v=cm[k];
   1.190 -    
   1.191 -	m=cm;  
   1.192 -	dm=cm; //Copy from another type
   1.193 -	m=dm; //Copy to another type
   1.194 -	{
   1.195 -	  //Check the typedef's
   1.196 -	  typename Graph::template EdgeMap<bool>::ValueType val;
   1.197 -	  val=true;
   1.198 -	  typename Graph::template EdgeMap<bool>::KeyType key;
   1.199 -	  key= typename Graph::EdgeIt(G);
   1.200 -	}
   1.201 -      }
   1.202 -    }
   1.203 -
   1.204 -  template<class Graph> void checkCompileGraph(Graph &G) 
   1.205 -    {
   1.206 -      checkCompileStaticGraph(G);
   1.207 -
   1.208 -      typedef typename Graph::Node Node;
   1.209 -      typedef typename Graph::NodeIt NodeIt;
   1.210 -      typedef typename Graph::Edge Edge;
   1.211 -      typedef typename Graph::EdgeIt EdgeIt;
   1.212 -      typedef typename Graph::InEdgeIt InEdgeIt;
   1.213 -      typedef typename Graph::OutEdgeIt OutEdgeIt;
   1.214 -  
   1.215 -      Node n,m;
   1.216 -      n=G.addNode();
   1.217 -      m=G.addNode();
   1.218 -      Edge e;
   1.219 -      e=G.addEdge(n,m); 
   1.220 -  
   1.221 -      //  G.clear();
   1.222 -    }
   1.223 -
   1.224 -  template<class Graph> void checkCompileGraphEraseEdge(Graph &G) 
   1.225 -    {
   1.226 -      typename Graph::Edge e;
   1.227 -      G.erase(e);
   1.228 -    }
   1.229 -
   1.230 -  template<class Graph> void checkCompileGraphEraseNode(Graph &G) 
   1.231 -    {
   1.232 -      typename Graph::Node n;
   1.233 -      G.erase(n);
   1.234 -    }
   1.235 -
   1.236 -  template<class Graph> void checkCompileErasableGraph(Graph &G) 
   1.237 -    {
   1.238 -      checkCompileGraph(G);
   1.239 -      checkCompileGraphEraseNode(G);
   1.240 -      checkCompileGraphEraseEdge(G);
   1.241 -    }
   1.242 -
   1.243 -  template<class Graph> void checkCompileGraphFindEdge(Graph &G) 
   1.244 -    {
   1.245 -      typedef typename Graph::NodeIt Node;
   1.246 -      typedef typename Graph::NodeIt NodeIt;
   1.247 -
   1.248 -      G.findEdge(NodeIt(G),++NodeIt(G),G.findEdge(NodeIt(G),++NodeIt(G)));
   1.249 -      G.findEdge(Node(),Node(),G.findEdge(Node(),Node()));  
   1.250 -    }
   1.251 -
   1.252    template<class Graph> void checkGraphNodeList(Graph &G, int nn)
   1.253      {
   1.254        typename Graph::NodeIt n(G);