Changeset 964:7fdaa05a69a1 in lemon1.2 for test/digraph_test.cc
 Timestamp:
 09/13/12 11:56:19 (9 years ago)
 Branch:
 default
 Parents:
 961:4bb9e72e1a41 (diff), 963:761fe0846f49 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.  Phase:
 public
 Files:

 2 edited
Legend:
 Unmodified
 Added
 Removed

test/digraph_test.cc
r877 r964 65 65 a3 = G.addArc(n2, n3), 66 66 a4 = G.addArc(n2, n3); 67 ignore_unused_variable_warning(a2,a3,a4); 67 68 68 69 checkGraphNodeList(G, 3); … … 93 94 Arc a1 = G.addArc(n1, n2), a2 = G.addArc(n2, n1), 94 95 a3 = G.addArc(n2, n3), a4 = G.addArc(n2, n3); 96 ignore_unused_variable_warning(a1,a2,a3,a4); 95 97 96 98 Node n4 = G.split(n2); … … 126 128 a3 = G.addArc(n4, n3), a4 = G.addArc(n4, n3), 127 129 a5 = G.addArc(n2, n4); 130 ignore_unused_variable_warning(a1,a2,a3,a5); 128 131 129 132 checkGraphNodeList(G, 4); … … 205 208 a3 = G.addArc(n4, n3), a4 = G.addArc(n3, n1), 206 209 a5 = G.addArc(n2, n4); 210 ignore_unused_variable_warning(a2,a3,a4,a5); 207 211 208 212 // Check arc deletion … … 252 256 Arc a1 = G.addArc(n1, n2), a2 = G.addArc(n2, n1), 253 257 a3 = G.addArc(n2, n3), a4 = G.addArc(n2, n3); 258 ignore_unused_variable_warning(a1,a2,a3,a4); 254 259 255 260 typename Digraph::Snapshot snapshot(G); … … 352 357 e1 = g.addArc(n1, n2), 353 358 e2 = g.addArc(n2, n3); 359 ignore_unused_variable_warning(e2); 354 360 355 361 check(g.valid(n1), "Wrong validity check"); 
test/digraph_test.cc
r963 r964 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 200320 095 * Copyright (C) 20032010 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). … … 20 20 #include <lemon/list_graph.h> 21 21 #include <lemon/smart_graph.h> 22 #include <lemon/static_graph.h> 22 23 #include <lemon/full_graph.h> 23 24 … … 35 36 checkGraphNodeList(G, 0); 36 37 checkGraphArcList(G, 0); 38 39 G.reserveNode(3); 40 G.reserveArc(4); 37 41 38 42 Node … … 289 293 290 294 snapshot.restore(); 295 snapshot.save(G); 296 297 checkGraphNodeList(G, 4); 298 checkGraphArcList(G, 4); 299 300 G.addArc(G.addNode(), G.addNode()); 301 302 snapshot.restore(); 291 303 292 304 checkGraphNodeList(G, 4); … … 323 335 checkConcept<ClearableDigraphComponent<>, SmartDigraph>(); 324 336 } 337 { // Checking StaticDigraph 338 checkConcept<Digraph, StaticDigraph>(); 339 checkConcept<ClearableDigraphComponent<>, StaticDigraph>(); 340 } 325 341 { // Checking FullDigraph 326 342 checkConcept<Digraph, FullDigraph>(); … … 379 395 } 380 396 397 void checkStaticDigraph() { 398 SmartDigraph g; 399 SmartDigraph::NodeMap<StaticDigraph::Node> nref(g); 400 SmartDigraph::ArcMap<StaticDigraph::Arc> aref(g); 401 402 StaticDigraph G; 403 404 checkGraphNodeList(G, 0); 405 checkGraphArcList(G, 0); 406 407 G.build(g, nref, aref); 408 409 checkGraphNodeList(G, 0); 410 checkGraphArcList(G, 0); 411 412 SmartDigraph::Node 413 n1 = g.addNode(), 414 n2 = g.addNode(), 415 n3 = g.addNode(); 416 417 G.build(g, nref, aref); 418 419 checkGraphNodeList(G, 3); 420 checkGraphArcList(G, 0); 421 422 SmartDigraph::Arc a1 = g.addArc(n1, n2); 423 424 G.build(g, nref, aref); 425 426 check(G.source(aref[a1]) == nref[n1] && G.target(aref[a1]) == nref[n2], 427 "Wrong arc or wrong references"); 428 checkGraphNodeList(G, 3); 429 checkGraphArcList(G, 1); 430 431 checkGraphOutArcList(G, nref[n1], 1); 432 checkGraphOutArcList(G, nref[n2], 0); 433 checkGraphOutArcList(G, nref[n3], 0); 434 435 checkGraphInArcList(G, nref[n1], 0); 436 checkGraphInArcList(G, nref[n2], 1); 437 checkGraphInArcList(G, nref[n3], 0); 438 439 checkGraphConArcList(G, 1); 440 441 SmartDigraph::Arc 442 a2 = g.addArc(n2, n1), 443 a3 = g.addArc(n2, n3), 444 a4 = g.addArc(n2, n3); 445 446 digraphCopy(g, G).nodeRef(nref).run(); 447 448 checkGraphNodeList(G, 3); 449 checkGraphArcList(G, 4); 450 451 checkGraphOutArcList(G, nref[n1], 1); 452 checkGraphOutArcList(G, nref[n2], 3); 453 checkGraphOutArcList(G, nref[n3], 0); 454 455 checkGraphInArcList(G, nref[n1], 1); 456 checkGraphInArcList(G, nref[n2], 1); 457 checkGraphInArcList(G, nref[n3], 2); 458 459 checkGraphConArcList(G, 4); 460 461 std::vector<std::pair<int,int> > arcs; 462 arcs.push_back(std::make_pair(0,1)); 463 arcs.push_back(std::make_pair(0,2)); 464 arcs.push_back(std::make_pair(1,3)); 465 arcs.push_back(std::make_pair(1,2)); 466 arcs.push_back(std::make_pair(3,0)); 467 arcs.push_back(std::make_pair(3,3)); 468 arcs.push_back(std::make_pair(4,2)); 469 arcs.push_back(std::make_pair(4,3)); 470 arcs.push_back(std::make_pair(4,1)); 471 472 G.build(6, arcs.begin(), arcs.end()); 473 474 checkGraphNodeList(G, 6); 475 checkGraphArcList(G, 9); 476 477 checkGraphOutArcList(G, G.node(0), 2); 478 checkGraphOutArcList(G, G.node(1), 2); 479 checkGraphOutArcList(G, G.node(2), 0); 480 checkGraphOutArcList(G, G.node(3), 2); 481 checkGraphOutArcList(G, G.node(4), 3); 482 checkGraphOutArcList(G, G.node(5), 0); 483 484 checkGraphInArcList(G, G.node(0), 1); 485 checkGraphInArcList(G, G.node(1), 2); 486 checkGraphInArcList(G, G.node(2), 3); 487 checkGraphInArcList(G, G.node(3), 3); 488 checkGraphInArcList(G, G.node(4), 0); 489 checkGraphInArcList(G, G.node(5), 0); 490 491 checkGraphConArcList(G, 9); 492 493 checkNodeIds(G); 494 checkArcIds(G); 495 checkGraphNodeMap(G); 496 checkGraphArcMap(G); 497 498 int n = G.nodeNum(); 499 int m = G.arcNum(); 500 check(G.index(G.node(n1)) == n1, "Wrong index."); 501 check(G.index(G.arc(m1)) == m1, "Wrong index."); 502 } 503 381 504 void checkFullDigraph(int num) { 382 505 typedef FullDigraph Digraph; 383 506 DIGRAPH_TYPEDEFS(Digraph); 507 384 508 Digraph G(num); 509 check(G.nodeNum() == num && G.arcNum() == num * num, "Wrong size"); 510 511 G.resize(num); 512 check(G.nodeNum() == num && G.arcNum() == num * num, "Wrong size"); 385 513 386 514 checkGraphNodeList(G, num); … … 426 554 checkDigraphValidity<SmartDigraph>(); 427 555 } 556 { // Checking StaticDigraph 557 checkStaticDigraph(); 558 } 428 559 { // Checking FullDigraph 429 560 checkFullDigraph(8);
Note: See TracChangeset
for help on using the changeset viewer.