test/sym_graph_test.cc
changeset 1435 8e85e6bbefdf
parent 1359 1581f961cfaa
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/test/sym_graph_test.cc	Mon May 23 04:48:14 2005 +0000
     1.3 @@ -0,0 +1,98 @@
     1.4 +/* -*- C++ -*-
     1.5 + * test/sym_graph_test.cc - 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 +
    1.20 +#include<iostream>
    1.21 +
    1.22 +#include<lemon/concept/sym_graph.h>
    1.23 +
    1.24 +#include<lemon/list_graph.h>
    1.25 +#include<lemon/smart_graph.h>
    1.26 +#include<lemon/full_graph.h>
    1.27 +
    1.28 +#include"test_tools.h"
    1.29 +#include"graph_test.h"
    1.30 +#include"sym_graph_test.h"
    1.31 +
    1.32 +/**
    1.33 +\file
    1.34 +This test makes consistency checks of list graph structures.
    1.35 +
    1.36 +G.addNode(), G.addEdge(), G.source(), G.target()
    1.37 +
    1.38 +\todo Checks for empty graphs and isolated points.
    1.39 +conversion.
    1.40 +*/
    1.41 +
    1.42 +using namespace lemon;
    1.43 +
    1.44 +template<class Graph> void checkPetersen(Graph &G)
    1.45 +{
    1.46 +  typedef typename Graph::NodeIt NodeIt;
    1.47 +
    1.48 +
    1.49 +  checkGraphNodeList(G,10);
    1.50 +  checkGraphEdgeList(G,30);
    1.51 +  checkGraphSymEdgeList(G,15);
    1.52 +
    1.53 +  for(NodeIt n(G);n!=INVALID;++n) {
    1.54 +    checkGraphInEdgeList(G,n,3);
    1.55 +    checkGraphOutEdgeList(G,n,3);
    1.56 +  }  
    1.57 +}
    1.58 +
    1.59 +//Compile Graph
    1.60 +template void lemon::checkCompileStaticSymGraph<concept::StaticSymGraph>
    1.61 +(concept::StaticSymGraph &);
    1.62 +
    1.63 +template void lemon::checkCompileSymGraph<concept::ExtendableSymGraph>
    1.64 +(concept::ExtendableSymGraph &);
    1.65 +
    1.66 +template void lemon::checkCompileErasableSymGraph<concept::ErasableSymGraph>
    1.67 +(concept::ErasableSymGraph &);
    1.68 +
    1.69 +
    1.70 +//Compile SymSmartGraph
    1.71 +template void lemon::checkCompileSymGraph<SymSmartGraph>(SymSmartGraph &);
    1.72 +template
    1.73 +void lemon::concept::checkCompileGraphFindEdge<SymSmartGraph>(SymSmartGraph &);
    1.74 +
    1.75 +//Compile SymListGraph
    1.76 +template void lemon::checkCompileSymGraph<SymListGraph>(SymListGraph &);
    1.77 +template void lemon::checkCompileErasableSymGraph<SymListGraph>(SymListGraph &);
    1.78 +template
    1.79 +void lemon::concept::checkCompileGraphFindEdge<SymListGraph>(SymListGraph &);
    1.80 +
    1.81 +int main() 
    1.82 +{
    1.83 +  {
    1.84 +    SymSmartGraph G;
    1.85 +    addSymPetersen(G);
    1.86 +    checkPetersen(G);
    1.87 +  }
    1.88 +  {
    1.89 +    SymListGraph G;
    1.90 +    addSymPetersen(G);
    1.91 +    checkPetersen(G);
    1.92 +  }
    1.93 +
    1.94 +  ///\file
    1.95 +  ///\todo map tests.
    1.96 +  ///\todo copy constr tests.
    1.97 +
    1.98 +  std::cout << __FILE__ ": All tests passed.\n";
    1.99 +
   1.100 +  return 0;
   1.101 +}