Changeset 938:70e2886211d5 in lemon-0.x

Ignore:
Timestamp:
10/05/04 11:41:05 (16 years ago)
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@1266
Message:

Many of ckeckCompileXYZ()'s are now in the corresponding skeleton headers.
(Tests for Symmetric Graphs are still to be moved)

Location:
src
Files:
7 edited

Unmodified
Removed
• src/lemon/skeletons/graph.h

 r921 /// like @ref ListGraph or /// @ref SmartGraph will just refer to this structure. /// /// \todo A pages describing the concept of concept description would /// be nice. class StaticGraph { }; struct DummyType { int value; DummyType() {} DummyType(int p) : value(p) {} DummyType& operator=(int p) { value = p; return *this;} }; ///\brief Checks whether \c G meets the ///\ref lemon::skeleton::StaticGraph "StaticGraph" concept template void checkCompileStaticGraph(Graph &G) { typedef typename Graph::Node Node; typedef typename Graph::NodeIt NodeIt; typedef typename Graph::Edge Edge; typedef typename Graph::EdgeIt EdgeIt; typedef typename Graph::InEdgeIt InEdgeIt; typedef typename Graph::OutEdgeIt OutEdgeIt; { Node i; Node j(i); Node k(INVALID); i=j; bool b; b=true; b=(i==INVALID); b=(i!=INVALID); b=(i==j); b=(i!=j); b=(iNodeIt conversion NodeIt ni(G,n); } { Edge i; Edge j(i); Edge k(INVALID); i=j; bool b; b=true; b=(i==INVALID); b=(i!=INVALID); b=(i==j); b=(i!=j); b=(iEdgeIt conversion EdgeIt ei(G,e); } { Node n; InEdgeIt i; InEdgeIt j(i); InEdgeIt k(INVALID); InEdgeIt l(G,n); i=j; j=G.first(i,n); j=++i; bool b; b=true; b=(i==INVALID); b=(i!=INVALID); Edge e(i); e=i; b=(i==j); b=(i!=j); b=(iInEdgeIt conversion InEdgeIt ei(G,e); } { Node n; OutEdgeIt i; OutEdgeIt j(i); OutEdgeIt k(INVALID); OutEdgeIt l(G,n); i=j; j=G.first(i,n); j=++i; bool b; b=true; b=(i==INVALID); b=(i!=INVALID); Edge e(i); e=i; b=(i==j); b=(i!=j); b=(iOutEdgeIt conversion OutEdgeIt ei(G,e); } { Node n,m; n=m=INVALID; Edge e; e=INVALID; n=G.tail(e); n=G.head(e); } // id tests { Node n; int i=G.id(n); i=i; } { Edge e; int i=G.id(e); i=i; } //NodeMap tests { Node k; typename Graph::template NodeMap m(G); //Const map typename Graph::template NodeMap const &cm = m; //Inicialize with default value typename Graph::template NodeMap mdef(G,12); //Copy typename Graph::template NodeMap mm(cm); //Copy from another type typename Graph::template NodeMap dm(cm); //Copy to more complex type typename Graph::template NodeMap em(cm); int v; v=m[k]; m[k]=v; m.set(k,v); v=cm[k]; m=cm; dm=cm; //Copy from another type em=cm; //Copy to more complex type { //Check the typedef's typename Graph::template NodeMap::ValueType val; val=1; typename Graph::template NodeMap::KeyType key; key = typename Graph::NodeIt(G); } } { //bool NodeMap Node k; typename Graph::template NodeMap m(G); typename Graph::template NodeMap const &cm = m;  //Const map //Inicialize with default value typename Graph::template NodeMap mdef(G,12); typename Graph::template NodeMap mm(cm);   //Copy typename Graph::template NodeMap dm(cm); //Copy from another type bool v; v=m[k]; m[k]=v; m.set(k,v); v=cm[k]; m=cm; dm=cm; //Copy from another type m=dm; //Copy to another type { //Check the typedef's typename Graph::template NodeMap::ValueType val; val=true; typename Graph::template NodeMap::KeyType key; key= typename Graph::NodeIt(G); } } //EdgeMap tests { Edge k; typename Graph::template EdgeMap m(G); typename Graph::template EdgeMap const &cm = m;  //Const map //Inicialize with default value typename Graph::template EdgeMap mdef(G,12); typename Graph::template EdgeMap mm(cm);   //Copy typename Graph::template EdgeMap dm(cm);//Copy from another type int v; v=m[k]; m[k]=v; m.set(k,v); v=cm[k]; m=cm; dm=cm; //Copy from another type { //Check the typedef's typename Graph::template EdgeMap::ValueType val; val=1; typename Graph::template EdgeMap::KeyType key; key= typename Graph::EdgeIt(G); } } { //bool EdgeMap Edge k; typename Graph::template EdgeMap m(G); typename Graph::template EdgeMap const &cm = m;  //Const map //Inicialize with default value typename Graph::template EdgeMap mdef(G,12); typename Graph::template EdgeMap mm(cm);   //Copy typename Graph::template EdgeMap dm(cm); //Copy from another type bool v; v=m[k]; m[k]=v; m.set(k,v); v=cm[k]; m=cm; dm=cm; //Copy from another type m=dm; //Copy to another type { //Check the typedef's typename Graph::template EdgeMap::ValueType val; val=true; typename Graph::template EdgeMap::KeyType key; key= typename Graph::EdgeIt(G); } } } /// An empty non-static graph class. /// This class provides everything that \ref StaticGraph /// with additional functionality which enables to build a }; ///\brief Checks whether \c G meets the ///\ref lemon::skeleton::ExtendableGraph "ExtendableGraph" concept template void checkCompileExtendableGraph(Graph &G) { checkCompileStaticGraph(G); typedef typename Graph::Node Node; typedef typename Graph::NodeIt NodeIt; typedef typename Graph::Edge Edge; typedef typename Graph::EdgeIt EdgeIt; typedef typename Graph::InEdgeIt InEdgeIt; typedef typename Graph::OutEdgeIt OutEdgeIt; Node n,m; n=G.addNode(); m=G.addNode(); Edge e; e=G.addEdge(n,m); //  G.clear(); } /// An empty erasable graph class. void erase(Edge e) { } }; template void checkCompileGraphEraseEdge(Graph &G) { typename Graph::Edge e; G.erase(e); } template void checkCompileGraphEraseNode(Graph &G) { typename Graph::Node n; G.erase(n); } ///\brief Checks whether \c G meets the ///\ref lemon::skeleton::EresableGraph "EresableGraph" concept template void checkCompileErasableGraph(Graph &G) { checkCompileExtendableGraph(G); checkCompileGraphEraseNode(G); checkCompileGraphEraseEdge(G); } ///Checks whether a graph has findEdge() member function. ///\todo findEdge() might be a global function. /// template void checkCompileGraphFindEdge(Graph &G) { typedef typename Graph::NodeIt Node; typedef typename Graph::NodeIt NodeIt; G.findEdge(NodeIt(G),++NodeIt(G),G.findEdge(NodeIt(G),++NodeIt(G))); G.findEdge(Node(),Node(),G.findEdge(Node(),Node())); } // @} } //namespace skeleton
• src/test/Makefile.am

 r937 EXTRA_DIST = preflow_graph.dim #input file for preflow_test.cc noinst_HEADERS = test_tools.h graph_test.h noinst_HEADERS = test_tools.h graph_test.h sym_graph_test.h check_PROGRAMS = \
• src/test/graph_test.cc

 r937 //Compile Graph template void lemon::checkCompileStaticGraph template void lemon::skeleton::checkCompileStaticGraph (skeleton::StaticGraph &); template void lemon::checkCompileGraph template void lemon::skeleton::checkCompileExtendableGraph (skeleton::ExtendableGraph &); template void lemon::checkCompileErasableGraph template void lemon::skeleton::checkCompileErasableGraph (skeleton::ErasableGraph &); //Compile SmartGraph template void lemon::checkCompileGraph(SmartGraph &); template void lemon::checkCompileGraphFindEdge(SmartGraph &); template void lemon::skeleton::checkCompileExtendableGraph(SmartGraph &); template void lemon::skeleton::checkCompileGraphFindEdge(SmartGraph &); //Compile SymSmartGraph //Compile ListGraph template void lemon::checkCompileGraph(ListGraph &); template void lemon::checkCompileErasableGraph(ListGraph &); template void lemon::checkCompileGraphFindEdge(ListGraph &); template void lemon::skeleton::checkCompileExtendableGraph(ListGraph &); template void lemon::skeleton::checkCompileErasableGraph(ListGraph &); template void lemon::skeleton::checkCompileGraphFindEdge(ListGraph &); //Compile FullGraph template void lemon::checkCompileStaticGraph(FullGraph &); template void lemon::checkCompileGraphFindEdge(FullGraph &); template void lemon::skeleton::checkCompileStaticGraph(FullGraph &); template void lemon::skeleton::checkCompileGraphFindEdge(FullGraph &); //Compile EdgeSet template void lemon::checkCompileGraph > template void lemon::skeleton::checkCompileExtendableGraph > (EdgeSet &); template void lemon::checkCompileGraphEraseEdge > template void lemon::skeleton::checkCompileGraphEraseEdge > (EdgeSet &); template void lemon::checkCompileGraphFindEdge > template void lemon::skeleton::checkCompileGraphFindEdge > (EdgeSet &); //Compile EdgeSet template void lemon::checkCompileGraph >(EdgeSet &); template void lemon::checkCompileGraphEraseEdge > template void lemon::skeleton::checkCompileExtendableGraph > (EdgeSet &); template void lemon::checkCompileGraphFindEdge > template void lemon::skeleton::checkCompileGraphEraseEdge > (EdgeSet &); template void lemon::skeleton::checkCompileGraphFindEdge > (EdgeSet &);
• src/test/graph_test.h

 r937 //! \brief Some utility to  test graph classes. namespace lemon { struct DummyType { int value; DummyType() {} DummyType(int p) : value(p) {} DummyType& operator=(int p) { value = p; return *this;} }; template void checkCompileStaticGraph(Graph &G) { typedef typename Graph::Node Node; typedef typename Graph::NodeIt NodeIt; typedef typename Graph::Edge Edge; typedef typename Graph::EdgeIt EdgeIt; typedef typename Graph::InEdgeIt InEdgeIt; typedef typename Graph::OutEdgeIt OutEdgeIt; { Node i; Node j(i); Node k(INVALID); i=j; bool b; b=true; b=(i==INVALID); b=(i!=INVALID); b=(i==j); b=(i!=j); b=(iNodeIt conversion NodeIt ni(G,n); } { Edge i; Edge j(i); Edge k(INVALID); i=j; bool b; b=true; b=(i==INVALID); b=(i!=INVALID); b=(i==j); b=(i!=j); b=(iEdgeIt conversion EdgeIt ei(G,e); } { Node n; InEdgeIt i; InEdgeIt j(i); InEdgeIt k(INVALID); InEdgeIt l(G,n); i=j; j=G.first(i,n); j=++i; bool b; b=true; b=(i==INVALID); b=(i!=INVALID); Edge e(i); e=i; b=(i==j); b=(i!=j); b=(iInEdgeIt conversion InEdgeIt ei(G,e); } { Node n; OutEdgeIt i; OutEdgeIt j(i); OutEdgeIt k(INVALID); OutEdgeIt l(G,n); i=j; j=G.first(i,n); j=++i; bool b; b=true; b=(i==INVALID); b=(i!=INVALID); Edge e(i); e=i; b=(i==j); b=(i!=j); b=(iOutEdgeIt conversion OutEdgeIt ei(G,e); } { Node n,m; n=m=INVALID; Edge e; e=INVALID; n=G.tail(e); n=G.head(e); } // id tests { Node n; int i=G.id(n); i=i; } { Edge e; int i=G.id(e); i=i; } //NodeMap tests { Node k; typename Graph::template NodeMap m(G); //Const map typename Graph::template NodeMap const &cm = m; //Inicialize with default value typename Graph::template NodeMap mdef(G,12); //Copy typename Graph::template NodeMap mm(cm); //Copy from another type typename Graph::template NodeMap dm(cm); //Copy to more complex type typename Graph::template NodeMap em(cm); int v; v=m[k]; m[k]=v; m.set(k,v); v=cm[k]; m=cm; dm=cm; //Copy from another type em=cm; //Copy to more complex type { //Check the typedef's typename Graph::template NodeMap::ValueType val; val=1; typename Graph::template NodeMap::KeyType key; key = typename Graph::NodeIt(G); } } { //bool NodeMap Node k; typename Graph::template NodeMap m(G); typename Graph::template NodeMap const &cm = m;  //Const map //Inicialize with default value typename Graph::template NodeMap mdef(G,12); typename Graph::template NodeMap mm(cm);   //Copy typename Graph::template NodeMap dm(cm); //Copy from another type bool v; v=m[k]; m[k]=v; m.set(k,v); v=cm[k]; m=cm; dm=cm; //Copy from another type m=dm; //Copy to another type { //Check the typedef's typename Graph::template NodeMap::ValueType val; val=true; typename Graph::template NodeMap::KeyType key; key= typename Graph::NodeIt(G); } } //EdgeMap tests { Edge k; typename Graph::template EdgeMap m(G); typename Graph::template EdgeMap const &cm = m;  //Const map //Inicialize with default value typename Graph::template EdgeMap mdef(G,12); typename Graph::template EdgeMap mm(cm);   //Copy typename Graph::template EdgeMap dm(cm); //Copy from another type int v; v=m[k]; m[k]=v; m.set(k,v); v=cm[k]; m=cm; dm=cm; //Copy from another type { //Check the typedef's typename Graph::template EdgeMap::ValueType val; val=1; typename Graph::template EdgeMap::KeyType key; key= typename Graph::EdgeIt(G); } } { //bool EdgeMap Edge k; typename Graph::template EdgeMap m(G); typename Graph::template EdgeMap const &cm = m;  //Const map //Inicialize with default value typename Graph::template EdgeMap mdef(G,12); typename Graph::template EdgeMap mm(cm);   //Copy typename Graph::template EdgeMap dm(cm); //Copy from another type bool v; v=m[k]; m[k]=v; m.set(k,v); v=cm[k]; m=cm; dm=cm; //Copy from another type m=dm; //Copy to another type { //Check the typedef's typename Graph::template EdgeMap::ValueType val; val=true; typename Graph::template EdgeMap::KeyType key; key= typename Graph::EdgeIt(G); } } } template void checkCompileGraph(Graph &G) { checkCompileStaticGraph(G); typedef typename Graph::Node Node; typedef typename Graph::NodeIt NodeIt; typedef typename Graph::Edge Edge; typedef typename Graph::EdgeIt EdgeIt; typedef typename Graph::InEdgeIt InEdgeIt; typedef typename Graph::OutEdgeIt OutEdgeIt; Node n,m; n=G.addNode(); m=G.addNode(); Edge e; e=G.addEdge(n,m); //  G.clear(); } template void checkCompileGraphEraseEdge(Graph &G) { typename Graph::Edge e; G.erase(e); } template void checkCompileGraphEraseNode(Graph &G) { typename Graph::Node n; G.erase(n); } template void checkCompileErasableGraph(Graph &G) { checkCompileGraph(G); checkCompileGraphEraseNode(G); checkCompileGraphEraseEdge(G); } template void checkCompileGraphFindEdge(Graph &G) { typedef typename Graph::NodeIt Node; typedef typename Graph::NodeIt NodeIt; G.findEdge(NodeIt(G),++NodeIt(G),G.findEdge(NodeIt(G),++NodeIt(G))); G.findEdge(Node(),Node(),G.findEdge(Node(),Node())); } template void checkGraphNodeList(Graph &G, int nn)
• src/test/graph_wrapper_test.cc

 r933 //Compile GraphWrapper typedef GraphWrapper GW; template void checkCompileStaticGraph(GW &); template void lemon::skeleton::checkCompileStaticGraph(GW &); //Compile RevGraphWrapper typedef RevGraphWrapper RevGW; template void checkCompileStaticGraph(RevGW &); template void lemon::skeleton::checkCompileStaticGraph(RevGW &); //Compile SubGraphWrapper typedef SubGraphWrapper, Graph::EdgeMap > SubGW; template void checkCompileStaticGraph(SubGW &); template void lemon::skeleton::checkCompileStaticGraph(SubGW &); //Compile NodeSubGraphWrapper typedef NodeSubGraphWrapper > NodeSubGW; template void checkCompileStaticGraph(NodeSubGW &); template void lemon::skeleton::checkCompileStaticGraph(NodeSubGW &); //Compile EdgeSubGraphWrapper typedef EdgeSubGraphWrapper > EdgeSubGW; template void checkCompileStaticGraph(EdgeSubGW &); template void lemon::skeleton::checkCompileStaticGraph(EdgeSubGW &); //Compile UndirGraphWrapper typedef SubBidirGraphWrapper, Graph::EdgeMap > SubBDGW; template void checkCompileStaticGraph(SubBDGW &); template void lemon::skeleton::checkCompileStaticGraph(SubBDGW &); //Compile BidirGraphWrapper typedef BidirGraphWrapper BidirGW; template void checkCompileStaticGraph(BidirGW &); template void lemon::skeleton::checkCompileStaticGraph(BidirGW &); //Compile BidirGraph typedef BidirGraph BidirG; template void checkCompileStaticGraph(BidirG &); template void lemon::skeleton::checkCompileStaticGraph(BidirG &); //Compile ResGraphWrapper typedef ResGraphWrapper, Graph::EdgeMap > ResGW; template void checkCompileStaticGraph(ResGW &); template void lemon::skeleton::checkCompileStaticGraph(ResGW &); //Compile ErasingFirstGraphWrapper typedef ErasingFirstGraphWrapper > ErasingFirstGW; template void checkCompileStaticGraph(ErasingFirstGW &); template void lemon::skeleton::checkCompileStaticGraph(ErasingFirstGW &);
• src/test/sym_graph_test.cc

 r937 //Compile SymSmartGraph template void lemon::checkCompileSymGraph(SymSmartGraph &); template void lemon::checkCompileGraphFindEdge(SymSmartGraph &); template void lemon::skeleton::checkCompileGraphFindEdge(SymSmartGraph &); //Compile SymListGraph template void lemon::checkCompileSymGraph(SymListGraph &); template void lemon::checkCompileErasableSymGraph(SymListGraph &); template void lemon::checkCompileGraphFindEdge(SymListGraph &); template void lemon::skeleton::checkCompileGraphFindEdge(SymListGraph &); int main()
• src/test/sym_graph_test.h

 r937 //! \brief Some utility to test symmetric graph classes. namespace lemon { /// \e /// \todo This should go to lemon/skeleton/symgraph.h /// template void checkCompileStaticSymGraph(Graph &G) { typedef typename Graph::OutEdgeIt OutEdgeIt; checkCompileStaticGraph(G); lemon::skeleton::checkCompileStaticGraph(G); { { checkCompileSymGraph(G); checkCompileGraphEraseNode(G); lemon::skeleton::checkCompileGraphEraseNode(G); checkCompileSymGraphEraseSymEdge(G); }
Note: See TracChangeset for help on using the changeset viewer.