2  * test/graph_test.cc - Part of LEMON, a generic C++ optimization library
 
     4  * Copyright (C) 2005 Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
 
     5  * (Egervary Research Group on Combinatorial Optimization, EGRES).
 
     7  * Permission to use, modify and distribute this software is granted
 
     8  * provided that this copyright notice appears in all copies. For
 
     9  * precise terms see the accompanying LICENSE file.
 
    11  * This software is provided "AS IS" with no warranty of any kind,
 
    12  * express or implied, and with no claim as to its suitability for any
 
    18 #include<lemon/smart_graph.h>
 
    19 #include<lemon/concept/graph.h>
 
    20 #include<lemon/concept/maps.h>
 
    21 #include<lemon/list_graph_base.h>
 
    22 #include<lemon/full_graph.h>
 
    24 #include"test_tools.h"
 
    25 #include"graph_test.h"
 
    29 This test makes consistency checks of list graph structures.
 
    31 G.addNode(), G.addEdge(), G.source(), G.target()
 
    33 \todo Checks for empty graphs and isolated points.
 
    37 using namespace lemon;
 
    39 template<class Graph> void bidirPetersen(Graph &G)
 
    41   typedef typename Graph::Edge Edge;
 
    42   typedef typename Graph::EdgeIt EdgeIt;
 
    44   checkGraphEdgeList(G,15);
 
    48   for(EdgeIt e(G);e!=INVALID;++e) ee.push_back(e);
 
    50   for(typename std::vector<Edge>::iterator p=ee.begin();p!=ee.end();p++)
 
    51     G.addEdge(G.target(*p),G.source(*p));
 
    54 template<class Graph> void checkPetersen(Graph &G)
 
    56   typedef typename Graph::Node Node;
 
    58   typedef typename Graph::EdgeIt EdgeIt;
 
    59   typedef typename Graph::NodeIt NodeIt;
 
    61   checkGraphNodeList(G,10);
 
    62   checkGraphEdgeList(G,30);
 
    64   for(NodeIt n(G);n!=INVALID;++n) {
 
    65     checkGraphInEdgeList(G,n,3);
 
    66     checkGraphOutEdgeList(G,n,3);
 
    71 template void lemon::concept::checkCompileStaticGraph<concept::StaticGraph>
 
    72 (concept::StaticGraph &);
 
    75 void lemon::concept::checkCompileExtendableGraph<concept::ExtendableGraph>
 
    76 (concept::ExtendableGraph &);
 
    79 void lemon::concept::checkCompileErasableGraph<concept::ErasableGraph>
 
    80 (concept::ErasableGraph &);
 
    84 void lemon::concept::checkCompileExtendableGraph<SmartGraph>(SmartGraph &);
 
    86 void lemon::concept::checkCompileGraphFindEdge<SmartGraph>(SmartGraph &);
 
    88 //Compile SymSmartGraph
 
    89 //template void hugo::checkCompileGraph<SymSmartGraph>(SymSmartGraph &);
 
    90 //template void hugo::checkCompileGraphFindEdge<SymSmartGraph>(SymSmartGraph &);
 
    94 void lemon::concept::checkCompileExtendableGraph<ListGraph>(ListGraph &);
 
    96 void lemon::concept::checkCompileErasableGraph<ListGraph>(ListGraph &);
 
    98 void lemon::concept::checkCompileGraphFindEdge<ListGraph>(ListGraph &);
 
   101 //Compile SymListGraph
 
   102 //template void hugo::checkCompileGraph<SymListGraph>(SymListGraph &);
 
   103 //template void hugo::checkCompileErasableGraph<SymListGraph>(SymListGraph &);
 
   104 //template void hugo::checkCompileGraphFindEdge<SymListGraph>(SymListGraph &);
 
   107 template void lemon::concept::checkCompileStaticGraph<FullGraph>(FullGraph &);
 
   109 void lemon::concept::checkCompileGraphFindEdge<FullGraph>(FullGraph &);
 
   139   ///\todo copy constr tests.
 
   143   // FIXME: These shouldn't be here.
 
   144   using namespace concept;
 
   145   function_requires< ReadMapConcept< ReadMap<int,int> > >();
 
   146   function_requires< WriteMapConcept< WriteMap<int,int> > >();
 
   147   function_requires< ReadWriteMapConcept< ReadWriteMap<int,int> > >();
 
   148   function_requires< ReferenceMapConcept< ReferenceMap<int,int> > >();
 
   151   std::cout << __FILE__ ": All tests passed.\n";