EdgeMap and NodeMap creation is done, at last. Bach 4ever.
2 * test/sym_graph_test.h - 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
16 #ifndef LEMON_TEST_SYM_GRAPH_TEST_H
17 #define LEMON_TEST_SYM_GRAPH_TEST_H
20 #include "graph_test.h"
21 #include "test_tools.h"
25 //! \brief Some utility to test symmetric graph classes.
30 /// \todo This should go to lemon/concept/symgraph.h
32 template<class Graph> void checkCompileStaticSymGraph(Graph &G)
34 typedef typename Graph::Node Node;
35 typedef typename Graph::NodeIt NodeIt;
36 typedef typename Graph::SymEdge SymEdge;
37 typedef typename Graph::SymEdgeIt SymEdgeIt;
38 typedef typename Graph::Edge Edge;
39 typedef typename Graph::EdgeIt EdgeIt;
40 typedef typename Graph::InEdgeIt InEdgeIt;
41 typedef typename Graph::OutEdgeIt OutEdgeIt;
43 lemon::concept::checkCompileStaticGraph(G);
46 SymEdge i; SymEdge j(i); SymEdge k(INVALID);
49 b=(i==INVALID); b=(i!=INVALID);
50 b=(i==j); b=(i!=j); b=(i<j);
56 SymEdgeIt i; SymEdgeIt j(i); SymEdgeIt k(INVALID); SymEdgeIt l(G);
61 b=(i==INVALID); b=(i!=INVALID);
64 b=(i==j); b=(i!=j); b=(i<j);
65 //SymEdge ->SymEdgeIt conversion
80 { SymEdge n; int i=G.id(n); i=i; }
84 typename Graph::template SymEdgeMap<int> m(G);
85 typename Graph::template SymEdgeMap<int> const &cm = m; //Const map
86 //Inicialize with default value
87 typename Graph::template SymEdgeMap<int> mdef(G,12);
88 typename Graph::template SymEdgeMap<int> mm(cm); //Copy
89 typename Graph::template SymEdgeMap<double> dm(cm); //Copy from another type
91 v=m[k]; m[k]=v; m.set(k,v);
95 dm=cm; //Copy from another type
98 typename Graph::template SymEdgeMap<int>::Value val;
100 typename Graph::template SymEdgeMap<int>::Key key;
101 key = typename Graph::SymEdgeIt(G);
106 typename Graph::template SymEdgeMap<bool> m(G);
107 typename Graph::template SymEdgeMap<bool> const &cm = m; //Const map
108 //Inicialize with default value
109 typename Graph::template SymEdgeMap<bool> mdef(G,12);
110 typename Graph::template SymEdgeMap<bool> mm(cm); //Copy
111 typename Graph::template SymEdgeMap<int> dm(cm); //Copy from another type
113 v=m[k]; m[k]=v; m.set(k,v);
117 dm=cm; //Copy from another type
118 m=dm; //Copy to another type
120 //Check the typedef's
121 typename Graph::template SymEdgeMap<bool>::Value val;
123 typename Graph::template SymEdgeMap<bool>::Key key;
124 key= typename Graph::SymEdgeIt(G);
129 template<class Graph> void checkCompileSymGraph(Graph &G)
131 checkCompileStaticSymGraph(G);
133 typedef typename Graph::Node Node;
134 typedef typename Graph::NodeIt NodeIt;
135 typedef typename Graph::SymEdge SymEdge;
136 typedef typename Graph::SymEdgeIt SymEdgeIt;
137 typedef typename Graph::Edge Edge;
138 typedef typename Graph::EdgeIt EdgeIt;
139 typedef typename Graph::InEdgeIt InEdgeIt;
140 typedef typename Graph::OutEdgeIt OutEdgeIt;
151 template<class Graph> void checkCompileSymGraphEraseSymEdge(Graph &G)
153 typename Graph::SymEdge n;
157 template<class Graph> void checkCompileErasableSymGraph(Graph &G)
159 checkCompileSymGraph(G);
160 lemon::concept::checkCompileGraphEraseNode(G);
161 checkCompileSymGraphEraseSymEdge(G);
164 template<class Graph> void checkGraphSymEdgeList(Graph &G, int nn)
166 typedef typename Graph::SymEdgeIt SymEdgeIt;
169 for(int i=0;i<nn;i++) {
170 check(e!=INVALID,"Wrong SymEdge list linking.");
173 check(e==INVALID,"Wrong SymEdge list linking.");
177 ///\todo Check target(), source() as well;