src/test/sym_graph_test.h
changeset 1435 8e85e6bbefdf
parent 1434 d8475431bbbb
child 1436 e0beb94d08bf
     1.1 --- a/src/test/sym_graph_test.h	Sat May 21 21:04:57 2005 +0000
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,183 +0,0 @@
     1.4 -/* -*- C++ -*-
     1.5 - * src/test/sym_graph_test.h - Part of LEMON, a generic C++ optimization library
     1.6 - *
     1.7 - * Copyright (C) 2005 Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
     1.8 - * (Egervary Research Group on Combinatorial Optimization, EGRES).
     1.9 - *
    1.10 - * Permission to use, modify and distribute this software is granted
    1.11 - * provided that this copyright notice appears in all copies. For
    1.12 - * precise terms see the accompanying LICENSE file.
    1.13 - *
    1.14 - * This software is provided "AS IS" with no warranty of any kind,
    1.15 - * express or implied, and with no claim as to its suitability for any
    1.16 - * purpose.
    1.17 - *
    1.18 - */
    1.19 -#ifndef LEMON_TEST_SYM_GRAPH_TEST_H
    1.20 -#define LEMON_TEST_SYM_GRAPH_TEST_H
    1.21 -
    1.22 -
    1.23 -#include "graph_test.h"
    1.24 -#include "test_tools.h"
    1.25 -
    1.26 -//! \ingroup misc
    1.27 -//! \file
    1.28 -//! \brief Some utility to test symmetric graph classes.
    1.29 -namespace lemon {
    1.30 -  
    1.31 -  /// \e
    1.32 -
    1.33 -  /// \todo This should go to lemon/concept/symgraph.h
    1.34 -  ///
    1.35 -  template<class Graph> void checkCompileStaticSymGraph(Graph &G) 
    1.36 -    {
    1.37 -      typedef typename Graph::Node Node;
    1.38 -      typedef typename Graph::NodeIt NodeIt;
    1.39 -      typedef typename Graph::SymEdge SymEdge;
    1.40 -      typedef typename Graph::SymEdgeIt SymEdgeIt;
    1.41 -      typedef typename Graph::Edge Edge;
    1.42 -      typedef typename Graph::EdgeIt EdgeIt;
    1.43 -      typedef typename Graph::InEdgeIt InEdgeIt;
    1.44 -      typedef typename Graph::OutEdgeIt OutEdgeIt;
    1.45 -
    1.46 -      lemon::concept::checkCompileStaticGraph(G);
    1.47 -  
    1.48 -      {
    1.49 -	SymEdge i; SymEdge j(i); SymEdge k(INVALID);
    1.50 -	i=j;
    1.51 -	bool b; b=true;
    1.52 -	b=(i==INVALID); b=(i!=INVALID);
    1.53 -	b=(i==j); b=(i!=j); b=(i<j);
    1.54 -	Edge e;
    1.55 -	e = G.forward(i);
    1.56 -	e = G.backward(i);
    1.57 -      }
    1.58 -      {
    1.59 -	SymEdgeIt i; SymEdgeIt j(i); SymEdgeIt k(INVALID); SymEdgeIt l(G);
    1.60 -	i=j;
    1.61 -	j=G.first(i);
    1.62 -	j=++i;
    1.63 -	bool b; b=true;
    1.64 -	b=(i==INVALID); b=(i!=INVALID);
    1.65 -	SymEdge n(i);
    1.66 -	n=i;
    1.67 -	b=(i==j); b=(i!=j); b=(i<j);
    1.68 -	//SymEdge ->SymEdgeIt conversion
    1.69 -	SymEdgeIt ni(G,n);
    1.70 -      }
    1.71 -      {
    1.72 -	Edge i, j;
    1.73 -	j = G.opposite(i);
    1.74 -      }      
    1.75 -      {
    1.76 -	Node n;
    1.77 -	SymEdge se;
    1.78 -	se=INVALID;
    1.79 -	n=G.source(se);
    1.80 -	n=G.target(se);
    1.81 -      }
    1.82 -      // id tests
    1.83 -      { SymEdge n; int i=G.id(n); i=i; }
    1.84 -      //SymEdgeMap tests
    1.85 -      {
    1.86 -	SymEdge k;
    1.87 -	typename Graph::template SymEdgeMap<int> m(G);
    1.88 -	typename Graph::template SymEdgeMap<int> const &cm = m;  //Const map
    1.89 -	//Inicialize with default value
    1.90 -	typename Graph::template SymEdgeMap<int> mdef(G,12);
    1.91 -	typename Graph::template SymEdgeMap<int> mm(cm);   //Copy
    1.92 -	typename Graph::template SymEdgeMap<double> dm(cm); //Copy from another type
    1.93 -	int v;
    1.94 -	v=m[k]; m[k]=v; m.set(k,v);
    1.95 -	v=cm[k];
    1.96 -    
    1.97 -	m=cm;  
    1.98 -	dm=cm; //Copy from another type
    1.99 -	{
   1.100 -	  //Check the typedef's
   1.101 -	  typename Graph::template SymEdgeMap<int>::Value val;
   1.102 -	  val = 1;
   1.103 -	  typename Graph::template SymEdgeMap<int>::Key key;
   1.104 -	  key = typename Graph::SymEdgeIt(G);
   1.105 -	}
   1.106 -      }  
   1.107 -      { //bool SymEdgeMap
   1.108 -	SymEdge k;
   1.109 -	typename Graph::template SymEdgeMap<bool> m(G);
   1.110 -	typename Graph::template SymEdgeMap<bool> const &cm = m;  //Const map
   1.111 -	//Inicialize with default value
   1.112 -	typename Graph::template SymEdgeMap<bool> mdef(G,12);
   1.113 -	typename Graph::template SymEdgeMap<bool> mm(cm);   //Copy
   1.114 -	typename Graph::template SymEdgeMap<int> dm(cm); //Copy from another type
   1.115 -	bool v;
   1.116 -	v=m[k]; m[k]=v; m.set(k,v);
   1.117 -	v=cm[k];
   1.118 -    
   1.119 -	m=cm;  
   1.120 -	dm=cm; //Copy from another type
   1.121 -	m=dm; //Copy to another type
   1.122 -	{
   1.123 -	  //Check the typedef's
   1.124 -	  typename Graph::template SymEdgeMap<bool>::Value val;
   1.125 -	  val=true;
   1.126 -	  typename Graph::template SymEdgeMap<bool>::Key key;
   1.127 -	  key= typename Graph::SymEdgeIt(G);
   1.128 -	}
   1.129 -      }
   1.130 -    }
   1.131 -
   1.132 -  template<class Graph> void checkCompileSymGraph(Graph &G) 
   1.133 -    {
   1.134 -      checkCompileStaticSymGraph(G);
   1.135 -
   1.136 -      typedef typename Graph::Node Node;
   1.137 -      typedef typename Graph::NodeIt NodeIt;
   1.138 -      typedef typename Graph::SymEdge SymEdge;
   1.139 -      typedef typename Graph::SymEdgeIt SymEdgeIt;
   1.140 -      typedef typename Graph::Edge Edge;
   1.141 -      typedef typename Graph::EdgeIt EdgeIt;
   1.142 -      typedef typename Graph::InEdgeIt InEdgeIt;
   1.143 -      typedef typename Graph::OutEdgeIt OutEdgeIt;
   1.144 -  
   1.145 -      Node n,m;
   1.146 -      n=G.addNode();
   1.147 -      m=G.addNode();
   1.148 -      SymEdge e;
   1.149 -      e = G.addEdge(n,m); 
   1.150 -  
   1.151 -      //  G.clear();
   1.152 -    }
   1.153 -
   1.154 -  template<class Graph> void checkCompileSymGraphEraseSymEdge(Graph &G) 
   1.155 -    {
   1.156 -      typename Graph::SymEdge n;
   1.157 -      G.erase(n);
   1.158 -    }
   1.159 -
   1.160 -  template<class Graph> void checkCompileErasableSymGraph(Graph &G) 
   1.161 -    {
   1.162 -      checkCompileSymGraph(G);
   1.163 -      lemon::concept::checkCompileGraphEraseNode(G);
   1.164 -      checkCompileSymGraphEraseSymEdge(G);
   1.165 -    }
   1.166 -
   1.167 -  template<class Graph> void checkGraphSymEdgeList(Graph &G, int nn)
   1.168 -    {
   1.169 -      typedef typename Graph::SymEdgeIt SymEdgeIt;
   1.170 -
   1.171 -      SymEdgeIt e(G);
   1.172 -      for(int i=0;i<nn;i++) {
   1.173 -	check(e!=INVALID,"Wrong SymEdge list linking.");
   1.174 -	++e;
   1.175 -      }
   1.176 -      check(e==INVALID,"Wrong SymEdge list linking.");
   1.177 -    }
   1.178 -
   1.179 -  ///\file
   1.180 -  ///\todo Check target(), source() as well;
   1.181 -
   1.182 -  
   1.183 -} //namespace lemon
   1.184 -
   1.185 -
   1.186 -#endif