src/test/sym_graph_test.cc
changeset 909 6a22e0dfd453
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/test/sym_graph_test.cc	Sun Sep 26 21:43:38 2004 +0000
     1.3 @@ -0,0 +1,96 @@
     1.4 +/* -*- C++ -*-
     1.5 + * src/test/sym_graph_test.cc - Part of HUGOlib, a generic C++ optimization library
     1.6 + *
     1.7 + * Copyright (C) 2004 Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
     1.8 + * (Egervary Combinatorial Optimization Research Group, 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<hugo/skeletons/sym_graph.h>
    1.23 +
    1.24 +#include<hugo/list_graph.h>
    1.25 +#include<hugo/smart_graph.h>
    1.26 +#include<hugo/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.tail(), G.head()
    1.37 +
    1.38 +\todo Checks for empty graphs and isolated points.
    1.39 +conversion.
    1.40 +*/
    1.41 +
    1.42 +using namespace hugo;
    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 hugo::checkCompileStaticSymGraph<skeleton::StaticSymGraph>
    1.61 +(skeleton::StaticSymGraph &);
    1.62 +
    1.63 +template void hugo::checkCompileSymGraph<skeleton::ExtendableSymGraph>
    1.64 +(skeleton::ExtendableSymGraph &);
    1.65 +
    1.66 +template void hugo::checkCompileErasableSymGraph<skeleton::ErasableSymGraph>
    1.67 +(skeleton::ErasableSymGraph &);
    1.68 +
    1.69 +
    1.70 +//Compile SymSmartGraph
    1.71 +template void hugo::checkCompileSymGraph<SymSmartGraph>(SymSmartGraph &);
    1.72 +template void hugo::checkCompileGraphFindEdge<SymSmartGraph>(SymSmartGraph &);
    1.73 +
    1.74 +//Compile SymListGraph
    1.75 +template void hugo::checkCompileSymGraph<SymListGraph>(SymListGraph &);
    1.76 +template void hugo::checkCompileErasableSymGraph<SymListGraph>(SymListGraph &);
    1.77 +template void hugo::checkCompileGraphFindEdge<SymListGraph>(SymListGraph &);
    1.78 +
    1.79 +int main() 
    1.80 +{
    1.81 +  {
    1.82 +    SymSmartGraph G;
    1.83 +    addSymPetersen(G);
    1.84 +    checkPetersen(G);
    1.85 +  }
    1.86 +  {
    1.87 +    SymListGraph G;
    1.88 +    addSymPetersen(G);
    1.89 +    checkPetersen(G);
    1.90 +  }
    1.91 +
    1.92 +  ///\file
    1.93 +  ///\todo map tests.
    1.94 +  ///\todo copy constr tests.
    1.95 +
    1.96 +  std::cout << __FILE__ ": All tests passed.\n";
    1.97 +
    1.98 +  return 0;
    1.99 +}