(none)
authormarci
Tue, 14 Sep 2004 10:23:26 +0000
changeset 85054d3c1599d08
parent 849 cc3867a7d380
child 851 209c9d53e195
(none)
src/test/graph_wrapper_test.cc
src/work/marci/graph_wrapper_test.cc
     1.1 --- a/src/test/graph_wrapper_test.cc	Tue Sep 14 10:09:24 2004 +0000
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,138 +0,0 @@
     1.4 -#include<iostream>
     1.5 -#include<hugo/smart_graph.h>
     1.6 -#include<hugo/skeletons/graph.h>
     1.7 -#include<hugo/list_graph.h>
     1.8 -#include<hugo/full_graph.h>
     1.9 -#include<hugo/graph_wrapper.h>
    1.10 -
    1.11 -#include"test_tools.h"
    1.12 -#include"graph_test.h"
    1.13 -
    1.14 -/**
    1.15 -\file
    1.16 -This test makes consistency checks of list graph structures.
    1.17 -
    1.18 -G.addNode(), G.addEdge(), G.tail(), G.head()
    1.19 -
    1.20 -\todo Checks for empty graphs and isolated points.
    1.21 -conversion.
    1.22 -*/
    1.23 -
    1.24 -using namespace hugo;
    1.25 -
    1.26 -template<class Graph> void bidirPetersen(Graph &G)
    1.27 -{
    1.28 -  typedef typename Graph::Edge Edge;
    1.29 -  typedef typename Graph::EdgeIt EdgeIt;
    1.30 -  
    1.31 -  checkGraphEdgeList(G,15);
    1.32 -  
    1.33 -  std::vector<Edge> ee;
    1.34 -  
    1.35 -  for(EdgeIt e(G);e!=INVALID;++e) ee.push_back(e);
    1.36 -
    1.37 -  for(typename std::vector<Edge>::iterator p=ee.begin();p!=ee.end();p++)
    1.38 -    G.addEdge(G.head(*p),G.tail(*p));
    1.39 -}
    1.40 -
    1.41 -template<class Graph> void checkPetersen(Graph &G)
    1.42 -{
    1.43 -  typedef typename Graph::Node Node;
    1.44 -
    1.45 -  typedef typename Graph::EdgeIt EdgeIt;
    1.46 -  typedef typename Graph::NodeIt NodeIt;
    1.47 -
    1.48 -  checkGraphNodeList(G,10);
    1.49 -  checkGraphEdgeList(G,30);
    1.50 -
    1.51 -  for(NodeIt n(G);n!=INVALID;++n) {
    1.52 -    checkGraphInEdgeList(G,n,3);
    1.53 -    checkGraphOutEdgeList(G,n,3);
    1.54 -    ++n;
    1.55 -  }  
    1.56 -}
    1.57 -
    1.58 -//Compile GraphSkeleton
    1.59 -template void checkCompileStaticGraph<skeleton::StaticGraphSkeleton>
    1.60 -(skeleton::StaticGraphSkeleton &);
    1.61 -
    1.62 -template void checkCompileGraph<skeleton::GraphSkeleton>
    1.63 -(skeleton::GraphSkeleton &);
    1.64 -
    1.65 -template void checkCompileErasableGraph<skeleton::ErasableGraphSkeleton>
    1.66 -(skeleton::ErasableGraphSkeleton &);
    1.67 -
    1.68 -//Compile SmartGraph
    1.69 -typedef SmartGraph Graph;
    1.70 -typedef GraphWrapper<Graph> GW;
    1.71 -template void checkCompileStaticGraph<GW>(GW &);
    1.72 -//template void checkCompileGraphFindEdge<SmartGraph>(SmartGraph &);
    1.73 -
    1.74 -//Compile SymSmartGraph
    1.75 -typedef RevGraphWrapper<Graph> RevGW;
    1.76 -template void checkCompileStaticGraph<RevGW>(RevGW &);
    1.77 -//template void checkCompileGraphFindEdge<SymSmartGraph>(SymSmartGraph &);
    1.78 -
    1.79 -// //Compile ListGraph
    1.80 -// template void checkCompileGraph<ListGraph>(ListGraph &);
    1.81 -// template void checkCompileErasableGraph<ListGraph>(ListGraph &);
    1.82 -// template void checkCompileGraphFindEdge<ListGraph>(ListGraph &);
    1.83 -
    1.84 -
    1.85 -// //Compile SymListGraph
    1.86 -// template void checkCompileGraph<SymListGraph>(SymListGraph &);
    1.87 -// template void checkCompileErasableGraph<SymListGraph>(SymListGraph &);
    1.88 -// template void checkCompileGraphFindEdge<SymListGraph>(SymListGraph &);
    1.89 -
    1.90 -// //Compile FullGraph
    1.91 -// template void checkCompileStaticGraph<FullGraph>(FullGraph &);
    1.92 -// template void checkCompileGraphFindEdge<FullGraph>(FullGraph &);
    1.93 -
    1.94 -// //Compile EdgeSet <ListGraph>
    1.95 -// template void checkCompileGraph<EdgeSet <ListGraph> >(EdgeSet <ListGraph> &);
    1.96 -// template void checkCompileGraphEraseEdge<EdgeSet <ListGraph> >
    1.97 -// (EdgeSet <ListGraph> &);
    1.98 -// template void checkCompileGraphFindEdge<EdgeSet <ListGraph> >
    1.99 -// (EdgeSet <ListGraph> &);
   1.100 -
   1.101 -// //Compile EdgeSet <NodeSet>
   1.102 -// template void checkCompileGraph<EdgeSet <NodeSet> >(EdgeSet <NodeSet> &);
   1.103 -// template void checkCompileGraphEraseEdge<EdgeSet <NodeSet> >
   1.104 -// (EdgeSet <NodeSet> &);
   1.105 -// template void checkCompileGraphFindEdge<EdgeSet <NodeSet> >
   1.106 -// (EdgeSet <NodeSet> &);
   1.107 -
   1.108 -
   1.109 -int main() 
   1.110 -{
   1.111 - //  {
   1.112 -//     SmartGraph G;
   1.113 -//     addPetersen(G);
   1.114 -//     bidirPetersen(G);
   1.115 -//     checkPetersen(G);
   1.116 -//   }
   1.117 -//   {
   1.118 -//     ListGraph G;
   1.119 -//     addPetersen(G);
   1.120 -//     bidirPetersen(G);
   1.121 -//     checkPetersen(G);
   1.122 -//   }
   1.123 -//   {
   1.124 -//     SymSmartGraph G;
   1.125 -//     addPetersen(G);
   1.126 -//     checkPetersen(G);
   1.127 -//   }
   1.128 -//   {
   1.129 -//     SymListGraph G;
   1.130 -//     addPetersen(G);
   1.131 -//     checkPetersen(G);
   1.132 -//   }
   1.133 -
   1.134 -  ///\file
   1.135 -  ///\todo map tests.
   1.136 -  ///\todo copy constr tests.
   1.137 -
   1.138 -  std::cout << __FILE__ ": All tests passed.\n";
   1.139 -
   1.140 -  return 0;
   1.141 -}
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/src/work/marci/graph_wrapper_test.cc	Tue Sep 14 10:23:26 2004 +0000
     2.3 @@ -0,0 +1,138 @@
     2.4 +#include<iostream>
     2.5 +#include<hugo/smart_graph.h>
     2.6 +#include<hugo/skeletons/graph.h>
     2.7 +#include<hugo/list_graph.h>
     2.8 +#include<hugo/full_graph.h>
     2.9 +#include<hugo/graph_wrapper.h>
    2.10 +
    2.11 +#include"test_tools.h"
    2.12 +#include"graph_test.h"
    2.13 +
    2.14 +/**
    2.15 +\file
    2.16 +This test makes consistency checks of list graph structures.
    2.17 +
    2.18 +G.addNode(), G.addEdge(), G.tail(), G.head()
    2.19 +
    2.20 +\todo Checks for empty graphs and isolated points.
    2.21 +conversion.
    2.22 +*/
    2.23 +
    2.24 +using namespace hugo;
    2.25 +
    2.26 +template<class Graph> void bidirPetersen(Graph &G)
    2.27 +{
    2.28 +  typedef typename Graph::Edge Edge;
    2.29 +  typedef typename Graph::EdgeIt EdgeIt;
    2.30 +  
    2.31 +  checkGraphEdgeList(G,15);
    2.32 +  
    2.33 +  std::vector<Edge> ee;
    2.34 +  
    2.35 +  for(EdgeIt e(G);e!=INVALID;++e) ee.push_back(e);
    2.36 +
    2.37 +  for(typename std::vector<Edge>::iterator p=ee.begin();p!=ee.end();p++)
    2.38 +    G.addEdge(G.head(*p),G.tail(*p));
    2.39 +}
    2.40 +
    2.41 +template<class Graph> void checkPetersen(Graph &G)
    2.42 +{
    2.43 +  typedef typename Graph::Node Node;
    2.44 +
    2.45 +  typedef typename Graph::EdgeIt EdgeIt;
    2.46 +  typedef typename Graph::NodeIt NodeIt;
    2.47 +
    2.48 +  checkGraphNodeList(G,10);
    2.49 +  checkGraphEdgeList(G,30);
    2.50 +
    2.51 +  for(NodeIt n(G);n!=INVALID;++n) {
    2.52 +    checkGraphInEdgeList(G,n,3);
    2.53 +    checkGraphOutEdgeList(G,n,3);
    2.54 +    ++n;
    2.55 +  }  
    2.56 +}
    2.57 +
    2.58 +//Compile GraphSkeleton
    2.59 +template void checkCompileStaticGraph<skeleton::StaticGraphSkeleton>
    2.60 +(skeleton::StaticGraphSkeleton &);
    2.61 +
    2.62 +template void checkCompileGraph<skeleton::GraphSkeleton>
    2.63 +(skeleton::GraphSkeleton &);
    2.64 +
    2.65 +template void checkCompileErasableGraph<skeleton::ErasableGraphSkeleton>
    2.66 +(skeleton::ErasableGraphSkeleton &);
    2.67 +
    2.68 +//Compile SmartGraph
    2.69 +typedef SmartGraph Graph;
    2.70 +typedef GraphWrapper<Graph> GW;
    2.71 +template void checkCompileStaticGraph<GW>(GW &);
    2.72 +//template void checkCompileGraphFindEdge<SmartGraph>(SmartGraph &);
    2.73 +
    2.74 +//Compile SymSmartGraph
    2.75 +typedef RevGraphWrapper<Graph> RevGW;
    2.76 +template void checkCompileStaticGraph<RevGW>(RevGW &);
    2.77 +//template void checkCompileGraphFindEdge<SymSmartGraph>(SymSmartGraph &);
    2.78 +
    2.79 +// //Compile ListGraph
    2.80 +// template void checkCompileGraph<ListGraph>(ListGraph &);
    2.81 +// template void checkCompileErasableGraph<ListGraph>(ListGraph &);
    2.82 +// template void checkCompileGraphFindEdge<ListGraph>(ListGraph &);
    2.83 +
    2.84 +
    2.85 +// //Compile SymListGraph
    2.86 +// template void checkCompileGraph<SymListGraph>(SymListGraph &);
    2.87 +// template void checkCompileErasableGraph<SymListGraph>(SymListGraph &);
    2.88 +// template void checkCompileGraphFindEdge<SymListGraph>(SymListGraph &);
    2.89 +
    2.90 +// //Compile FullGraph
    2.91 +// template void checkCompileStaticGraph<FullGraph>(FullGraph &);
    2.92 +// template void checkCompileGraphFindEdge<FullGraph>(FullGraph &);
    2.93 +
    2.94 +// //Compile EdgeSet <ListGraph>
    2.95 +// template void checkCompileGraph<EdgeSet <ListGraph> >(EdgeSet <ListGraph> &);
    2.96 +// template void checkCompileGraphEraseEdge<EdgeSet <ListGraph> >
    2.97 +// (EdgeSet <ListGraph> &);
    2.98 +// template void checkCompileGraphFindEdge<EdgeSet <ListGraph> >
    2.99 +// (EdgeSet <ListGraph> &);
   2.100 +
   2.101 +// //Compile EdgeSet <NodeSet>
   2.102 +// template void checkCompileGraph<EdgeSet <NodeSet> >(EdgeSet <NodeSet> &);
   2.103 +// template void checkCompileGraphEraseEdge<EdgeSet <NodeSet> >
   2.104 +// (EdgeSet <NodeSet> &);
   2.105 +// template void checkCompileGraphFindEdge<EdgeSet <NodeSet> >
   2.106 +// (EdgeSet <NodeSet> &);
   2.107 +
   2.108 +
   2.109 +int main() 
   2.110 +{
   2.111 + //  {
   2.112 +//     SmartGraph G;
   2.113 +//     addPetersen(G);
   2.114 +//     bidirPetersen(G);
   2.115 +//     checkPetersen(G);
   2.116 +//   }
   2.117 +//   {
   2.118 +//     ListGraph G;
   2.119 +//     addPetersen(G);
   2.120 +//     bidirPetersen(G);
   2.121 +//     checkPetersen(G);
   2.122 +//   }
   2.123 +//   {
   2.124 +//     SymSmartGraph G;
   2.125 +//     addPetersen(G);
   2.126 +//     checkPetersen(G);
   2.127 +//   }
   2.128 +//   {
   2.129 +//     SymListGraph G;
   2.130 +//     addPetersen(G);
   2.131 +//     checkPetersen(G);
   2.132 +//   }
   2.133 +
   2.134 +  ///\file
   2.135 +  ///\todo map tests.
   2.136 +  ///\todo copy constr tests.
   2.137 +
   2.138 +  std::cout << __FILE__ ": All tests passed.\n";
   2.139 +
   2.140 +  return 0;
   2.141 +}