Changeset 780:580af8cf2f6a in lemon1.2 for test/digraph_test.cc
 Timestamp:
 11/05/09 10:23:16 (10 years ago)
 Branch:
 default
 Parents:
 779:c160bf9f18ef (diff), 772:f964a00b9068 (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
r740 r780 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 … … 329 330 checkConcept<ClearableDigraphComponent<>, SmartDigraph>(); 330 331 } 332 { // Checking StaticDigraph 333 checkConcept<Digraph, StaticDigraph>(); 334 checkConcept<ClearableDigraphComponent<>, StaticDigraph>(); 335 } 331 336 { // Checking FullDigraph 332 337 checkConcept<Digraph, FullDigraph>(); … … 382 387 check(!g.valid(g.nodeFromId(1)), "Wrong validity check"); 383 388 check(!g.valid(g.arcFromId(1)), "Wrong validity check"); 389 } 390 391 void checkStaticDigraph() { 392 SmartDigraph g; 393 SmartDigraph::NodeMap<StaticDigraph::Node> nref(g); 394 SmartDigraph::ArcMap<StaticDigraph::Arc> aref(g); 395 396 StaticDigraph G; 397 398 checkGraphNodeList(G, 0); 399 checkGraphArcList(G, 0); 400 401 G.build(g, nref, aref); 402 403 checkGraphNodeList(G, 0); 404 checkGraphArcList(G, 0); 405 406 SmartDigraph::Node 407 n1 = g.addNode(), 408 n2 = g.addNode(), 409 n3 = g.addNode(); 410 411 G.build(g, nref, aref); 412 413 checkGraphNodeList(G, 3); 414 checkGraphArcList(G, 0); 415 416 SmartDigraph::Arc a1 = g.addArc(n1, n2); 417 418 G.build(g, nref, aref); 419 420 check(G.source(aref[a1]) == nref[n1] && G.target(aref[a1]) == nref[n2], 421 "Wrong arc or wrong references"); 422 checkGraphNodeList(G, 3); 423 checkGraphArcList(G, 1); 424 425 checkGraphOutArcList(G, nref[n1], 1); 426 checkGraphOutArcList(G, nref[n2], 0); 427 checkGraphOutArcList(G, nref[n3], 0); 428 429 checkGraphInArcList(G, nref[n1], 0); 430 checkGraphInArcList(G, nref[n2], 1); 431 checkGraphInArcList(G, nref[n3], 0); 432 433 checkGraphConArcList(G, 1); 434 435 SmartDigraph::Arc 436 a2 = g.addArc(n2, n1), 437 a3 = g.addArc(n2, n3), 438 a4 = g.addArc(n2, n3); 439 440 digraphCopy(g, G).nodeRef(nref).run(); 441 442 checkGraphNodeList(G, 3); 443 checkGraphArcList(G, 4); 444 445 checkGraphOutArcList(G, nref[n1], 1); 446 checkGraphOutArcList(G, nref[n2], 3); 447 checkGraphOutArcList(G, nref[n3], 0); 448 449 checkGraphInArcList(G, nref[n1], 1); 450 checkGraphInArcList(G, nref[n2], 1); 451 checkGraphInArcList(G, nref[n3], 2); 452 453 checkGraphConArcList(G, 4); 454 455 std::vector<std::pair<int,int> > arcs; 456 arcs.push_back(std::make_pair(0,1)); 457 arcs.push_back(std::make_pair(0,2)); 458 arcs.push_back(std::make_pair(1,3)); 459 arcs.push_back(std::make_pair(1,2)); 460 arcs.push_back(std::make_pair(3,0)); 461 arcs.push_back(std::make_pair(3,3)); 462 arcs.push_back(std::make_pair(4,2)); 463 arcs.push_back(std::make_pair(4,3)); 464 arcs.push_back(std::make_pair(4,1)); 465 466 G.build(6, arcs.begin(), arcs.end()); 467 468 checkGraphNodeList(G, 6); 469 checkGraphArcList(G, 9); 470 471 checkGraphOutArcList(G, G.node(0), 2); 472 checkGraphOutArcList(G, G.node(1), 2); 473 checkGraphOutArcList(G, G.node(2), 0); 474 checkGraphOutArcList(G, G.node(3), 2); 475 checkGraphOutArcList(G, G.node(4), 3); 476 checkGraphOutArcList(G, G.node(5), 0); 477 478 checkGraphInArcList(G, G.node(0), 1); 479 checkGraphInArcList(G, G.node(1), 2); 480 checkGraphInArcList(G, G.node(2), 3); 481 checkGraphInArcList(G, G.node(3), 3); 482 checkGraphInArcList(G, G.node(4), 0); 483 checkGraphInArcList(G, G.node(5), 0); 484 485 checkGraphConArcList(G, 9); 486 487 checkNodeIds(G); 488 checkArcIds(G); 489 checkGraphNodeMap(G); 490 checkGraphArcMap(G); 491 492 int n = G.nodeNum(); 493 int m = G.arcNum(); 494 check(G.index(G.node(n1)) == n1, "Wrong index."); 495 check(G.index(G.arc(m1)) == m1, "Wrong index."); 384 496 } 385 497 … … 436 548 checkDigraphValidity<SmartDigraph>(); 437 549 } 550 { // Checking StaticDigraph 551 checkStaticDigraph(); 552 } 438 553 { // Checking FullDigraph 439 554 checkFullDigraph(8); 
test/digraph_test.cc
r777 r780 37 37 checkGraphArcList(G, 0); 38 38 39 G.reserveNode(3); 40 G.reserveArc(4); 41 39 42 Node 40 43 n1 = G.addNode(), … … 281 284 G.addNode(); 282 285 snapshot.save(G); 286 287 G.addArc(G.addNode(), G.addNode()); 288 289 snapshot.restore(); 290 snapshot.save(G); 291 292 checkGraphNodeList(G, 4); 293 checkGraphArcList(G, 4); 283 294 284 295 G.addArc(G.addNode(), G.addNode()); … … 488 499 typedef FullDigraph Digraph; 489 500 DIGRAPH_TYPEDEFS(Digraph); 501 490 502 Digraph G(num); 503 check(G.nodeNum() == num && G.arcNum() == num * num, "Wrong size"); 504 505 G.resize(num); 506 check(G.nodeNum() == num && G.arcNum() == num * num, "Wrong size"); 491 507 492 508 checkGraphNodeList(G, num);
Note: See TracChangeset
for help on using the changeset viewer.