Changeset 983:8b2d4e5d96e4 in lemon-1.2 for test/digraph_test.cc
- Timestamp:
- 08/07/13 06:55:05 (11 years ago)
- Branch:
- default
- Parents:
- 971:a26b90a17c81 (diff), 982:3e711ee55d31 (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
r965 r983 65 65 a3 = G.addArc(n2, n3), 66 66 a4 = G.addArc(n2, n3); 67 ignore_unused_variable_warning(a2,a3,a4);67 ::lemon::ignore_unused_variable_warning(a2,a3,a4); 68 68 69 69 checkGraphNodeList(G, 3); … … 94 94 Arc a1 = G.addArc(n1, n2), a2 = G.addArc(n2, n1), 95 95 a3 = G.addArc(n2, n3), a4 = G.addArc(n2, n3); 96 ignore_unused_variable_warning(a1,a2,a3,a4);96 ::lemon::ignore_unused_variable_warning(a1,a2,a3,a4); 97 97 98 98 Node n4 = G.split(n2); … … 128 128 a3 = G.addArc(n4, n3), a4 = G.addArc(n4, n3), 129 129 a5 = G.addArc(n2, n4); 130 ignore_unused_variable_warning(a1,a2,a3,a5);130 ::lemon::ignore_unused_variable_warning(a1,a2,a3,a5); 131 131 132 132 checkGraphNodeList(G, 4); … … 208 208 a3 = G.addArc(n4, n3), a4 = G.addArc(n3, n1), 209 209 a5 = G.addArc(n2, n4); 210 ignore_unused_variable_warning(a2,a3,a4,a5);210 ::lemon::ignore_unused_variable_warning(a2,a3,a4,a5); 211 211 212 212 // Check arc deletion … … 256 256 Arc a1 = G.addArc(n1, n2), a2 = G.addArc(n2, n1), 257 257 a3 = G.addArc(n2, n3), a4 = G.addArc(n2, n3); 258 ignore_unused_variable_warning(a1,a2,a3,a4);258 ::lemon::ignore_unused_variable_warning(a1,a2,a3,a4); 259 259 260 260 typename Digraph::Snapshot snapshot(G); … … 357 357 e1 = g.addArc(n1, n2), 358 358 e2 = g.addArc(n2, n3); 359 ignore_unused_variable_warning(e2);359 ::lemon::ignore_unused_variable_warning(e2); 360 360 361 361 check(g.valid(n1), "Wrong validity check"); -
test/digraph_test.cc
r982 r983 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-20 095 * Copyright (C) 2003-2010 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 ignore_unused_variable_warning(a2,a3,a4); 446 447 digraphCopy(g, G).nodeRef(nref).run(); 448 449 checkGraphNodeList(G, 3); 450 checkGraphArcList(G, 4); 451 452 checkGraphOutArcList(G, nref[n1], 1); 453 checkGraphOutArcList(G, nref[n2], 3); 454 checkGraphOutArcList(G, nref[n3], 0); 455 456 checkGraphInArcList(G, nref[n1], 1); 457 checkGraphInArcList(G, nref[n2], 1); 458 checkGraphInArcList(G, nref[n3], 2); 459 460 checkGraphConArcList(G, 4); 461 462 std::vector<std::pair<int,int> > arcs; 463 arcs.push_back(std::make_pair(0,1)); 464 arcs.push_back(std::make_pair(0,2)); 465 arcs.push_back(std::make_pair(1,3)); 466 arcs.push_back(std::make_pair(1,2)); 467 arcs.push_back(std::make_pair(3,0)); 468 arcs.push_back(std::make_pair(3,3)); 469 arcs.push_back(std::make_pair(4,2)); 470 arcs.push_back(std::make_pair(4,3)); 471 arcs.push_back(std::make_pair(4,1)); 472 473 G.build(6, arcs.begin(), arcs.end()); 474 475 checkGraphNodeList(G, 6); 476 checkGraphArcList(G, 9); 477 478 checkGraphOutArcList(G, G.node(0), 2); 479 checkGraphOutArcList(G, G.node(1), 2); 480 checkGraphOutArcList(G, G.node(2), 0); 481 checkGraphOutArcList(G, G.node(3), 2); 482 checkGraphOutArcList(G, G.node(4), 3); 483 checkGraphOutArcList(G, G.node(5), 0); 484 485 checkGraphInArcList(G, G.node(0), 1); 486 checkGraphInArcList(G, G.node(1), 2); 487 checkGraphInArcList(G, G.node(2), 3); 488 checkGraphInArcList(G, G.node(3), 3); 489 checkGraphInArcList(G, G.node(4), 0); 490 checkGraphInArcList(G, G.node(5), 0); 491 492 checkGraphConArcList(G, 9); 493 494 checkNodeIds(G); 495 checkArcIds(G); 496 checkGraphNodeMap(G); 497 checkGraphArcMap(G); 498 499 int n = G.nodeNum(); 500 int m = G.arcNum(); 501 check(G.index(G.node(n-1)) == n-1, "Wrong index."); 502 check(G.index(G.arc(m-1)) == m-1, "Wrong index."); 503 } 504 381 505 void checkFullDigraph(int num) { 382 506 typedef FullDigraph Digraph; 383 507 DIGRAPH_TYPEDEFS(Digraph); 508 384 509 Digraph G(num); 510 check(G.nodeNum() == num && G.arcNum() == num * num, "Wrong size"); 511 512 G.resize(num); 513 check(G.nodeNum() == num && G.arcNum() == num * num, "Wrong size"); 385 514 386 515 checkGraphNodeList(G, num); … … 426 555 checkDigraphValidity<SmartDigraph>(); 427 556 } 557 { // Checking StaticDigraph 558 checkStaticDigraph(); 559 } 428 560 { // Checking FullDigraph 429 561 checkFullDigraph(8);
Note: See TracChangeset
for help on using the changeset viewer.