Changeset 228:b6732e0d38c5 in lemon for test/graph_test.cc
 Timestamp:
 07/21/08 16:30:28 (15 years ago)
 Branch:
 default
 Children:
 229:aebc0161f6e5, 230:af4e8ba94294
 Phase:
 public
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

test/graph_test.cc
r209 r228 25 25 #include "test_tools.h" 26 26 #include "graph_test.h" 27 #include "graph_maps_test.h"28 27 29 28 using namespace lemon; 30 29 using namespace lemon::concepts; 31 30 32 void check_concepts() { 31 template <class Graph> 32 void checkGraph() { 33 TEMPLATE_GRAPH_TYPEDEFS(Graph); 34 35 Graph G; 36 checkGraphNodeList(G, 0); 37 checkGraphEdgeList(G, 0); 38 39 Node 40 n1 = G.addNode(), 41 n2 = G.addNode(), 42 n3 = G.addNode(); 43 checkGraphNodeList(G, 3); 44 checkGraphEdgeList(G, 0); 45 46 Edge e1 = G.addEdge(n1, n2); 47 check((G.u(e1) == n1 && G.v(e1) == n2)  (G.u(e1) == n2 && G.v(e1) == n1), 48 "Wrong edge"); 49 checkGraphNodeList(G, 3); 50 checkGraphArcList(G, 2); 51 checkGraphEdgeList(G, 1); 52 53 checkGraphOutArcList(G, n1, 1); 54 checkGraphOutArcList(G, n2, 1); 55 checkGraphOutArcList(G, n3, 0); 56 57 checkGraphInArcList(G, n1, 1); 58 checkGraphInArcList(G, n2, 1); 59 checkGraphInArcList(G, n3, 0); 60 61 checkGraphIncEdgeList(G, n1, 1); 62 checkGraphIncEdgeList(G, n2, 1); 63 checkGraphIncEdgeList(G, n3, 0); 64 65 checkGraphConArcList(G, 2); 66 checkGraphConEdgeList(G, 1); 67 68 Edge e2 = G.addEdge(n2, n1), e3 = G.addEdge(n2, n3); 69 checkGraphNodeList(G, 3); 70 checkGraphArcList(G, 6); 71 checkGraphEdgeList(G, 3); 72 73 checkGraphOutArcList(G, n1, 2); 74 checkGraphOutArcList(G, n2, 3); 75 checkGraphOutArcList(G, n3, 1); 76 77 checkGraphInArcList(G, n1, 2); 78 checkGraphInArcList(G, n2, 3); 79 checkGraphInArcList(G, n3, 1); 80 81 checkGraphIncEdgeList(G, n1, 2); 82 checkGraphIncEdgeList(G, n2, 3); 83 checkGraphIncEdgeList(G, n3, 1); 84 85 checkGraphConArcList(G, 6); 86 checkGraphConEdgeList(G, 3); 87 88 checkArcDirections(G); 89 90 checkNodeIds(G); 91 checkArcIds(G); 92 checkEdgeIds(G); 93 checkGraphNodeMap(G); 94 checkGraphArcMap(G); 95 checkGraphEdgeMap(G); 96 } 97 98 void checkConcepts() { 33 99 { // Checking graph components 34 100 checkConcept<BaseGraphComponent, BaseGraphComponent >(); … … 52 118 checkConcept<ClearableGraphComponent<>, ListGraph>(); 53 119 checkConcept<ErasableGraphComponent<>, ListGraph>(); 54 checkGraphIterators<ListGraph>();55 120 } 56 121 { // Checking SmartGraph … … 59 124 checkConcept<ExtendableGraphComponent<>, SmartGraph>(); 60 125 checkConcept<ClearableGraphComponent<>, SmartGraph>(); 61 checkGraphIterators<SmartGraph>();62 126 } 63 127 // { // Checking FullGraph … … 72 136 73 137 template <typename Graph> 74 void check _graph_validity() {138 void checkGraphValidity() { 75 139 TEMPLATE_GRAPH_TYPEDEFS(Graph); 76 140 Graph g; … … 95 159 96 160 template <typename Graph> 97 void check _graph_validity_erase() {161 void checkGraphValidityErase() { 98 162 TEMPLATE_GRAPH_TYPEDEFS(Graph); 99 163 Graph g; … … 169 233 // } 170 234 171 void check _graphs() {235 void checkGraphs() { 172 236 { // Checking ListGraph 173 237 checkGraph<ListGraph>(); 174 checkGraphNodeMap<ListGraph>(); 175 checkGraphEdgeMap<ListGraph>(); 176 177 check_graph_validity_erase<ListGraph>(); 238 checkGraphValidityErase<ListGraph>(); 178 239 } 179 240 { // Checking SmartGraph 180 241 checkGraph<SmartGraph>(); 181 checkGraphNodeMap<SmartGraph>(); 182 checkGraphEdgeMap<SmartGraph>(); 183 184 check_graph_validity<SmartGraph>(); 242 checkGraphValidity<SmartGraph>(); 185 243 } 186 244 // { // Checking FullGraph … … 198 256 199 257 int main() { 200 check _concepts();201 check _graphs();258 checkConcepts(); 259 checkGraphs(); 202 260 return 0; 203 261 }
Note: See TracChangeset
for help on using the changeset viewer.