test/digraph_test.cc
changeset 1266 70b199792735
parent 1157 761fe0846f49
child 1259 8b2d4e5d96e4
equal deleted inserted replaced
20:3efeca29aaa2 23:b0370d40ff97
    58   checkGraphConArcList(G, 1);
    58   checkGraphConArcList(G, 1);
    59 
    59 
    60   Arc a2 = G.addArc(n2, n1),
    60   Arc a2 = G.addArc(n2, n1),
    61       a3 = G.addArc(n2, n3),
    61       a3 = G.addArc(n2, n3),
    62       a4 = G.addArc(n2, n3);
    62       a4 = G.addArc(n2, n3);
    63   ignore_unused_variable_warning(a2,a3,a4);
    63   ::lemon::ignore_unused_variable_warning(a2,a3,a4);
    64 
    64 
    65   checkGraphNodeList(G, 3);
    65   checkGraphNodeList(G, 3);
    66   checkGraphArcList(G, 4);
    66   checkGraphArcList(G, 4);
    67 
    67 
    68   checkGraphOutArcList(G, n1, 1);
    68   checkGraphOutArcList(G, n1, 1);
    87 
    87 
    88   Digraph G;
    88   Digraph G;
    89   Node n1 = G.addNode(), n2 = G.addNode(), n3 = G.addNode();
    89   Node n1 = G.addNode(), n2 = G.addNode(), n3 = G.addNode();
    90   Arc a1 = G.addArc(n1, n2), a2 = G.addArc(n2, n1),
    90   Arc a1 = G.addArc(n1, n2), a2 = G.addArc(n2, n1),
    91       a3 = G.addArc(n2, n3), a4 = G.addArc(n2, n3);
    91       a3 = G.addArc(n2, n3), a4 = G.addArc(n2, n3);
    92   ignore_unused_variable_warning(a1,a2,a3,a4);
    92   ::lemon::ignore_unused_variable_warning(a1,a2,a3,a4);
    93 
    93 
    94   Node n4 = G.split(n2);
    94   Node n4 = G.split(n2);
    95 
    95 
    96   check(G.target(OutArcIt(G, n2)) == n4 &&
    96   check(G.target(OutArcIt(G, n2)) == n4 &&
    97         G.source(InArcIt(G, n4)) == n2,
    97         G.source(InArcIt(G, n4)) == n2,
   121   Node n1 = G.addNode(), n2 = G.addNode(),
   121   Node n1 = G.addNode(), n2 = G.addNode(),
   122        n3 = G.addNode(), n4 = G.addNode();
   122        n3 = G.addNode(), n4 = G.addNode();
   123   Arc a1 = G.addArc(n1, n2), a2 = G.addArc(n4, n1),
   123   Arc a1 = G.addArc(n1, n2), a2 = G.addArc(n4, n1),
   124       a3 = G.addArc(n4, n3), a4 = G.addArc(n4, n3),
   124       a3 = G.addArc(n4, n3), a4 = G.addArc(n4, n3),
   125       a5 = G.addArc(n2, n4);
   125       a5 = G.addArc(n2, n4);
   126   ignore_unused_variable_warning(a1,a2,a3,a5);
   126   ::lemon::ignore_unused_variable_warning(a1,a2,a3,a5);
   127 
   127 
   128   checkGraphNodeList(G, 4);
   128   checkGraphNodeList(G, 4);
   129   checkGraphArcList(G, 5);
   129   checkGraphArcList(G, 5);
   130 
   130 
   131   // Check changeSource() and changeTarget()
   131   // Check changeSource() and changeTarget()
   201   Node n1 = G.addNode(), n2 = G.addNode(),
   201   Node n1 = G.addNode(), n2 = G.addNode(),
   202        n3 = G.addNode(), n4 = G.addNode();
   202        n3 = G.addNode(), n4 = G.addNode();
   203   Arc a1 = G.addArc(n1, n2), a2 = G.addArc(n4, n1),
   203   Arc a1 = G.addArc(n1, n2), a2 = G.addArc(n4, n1),
   204       a3 = G.addArc(n4, n3), a4 = G.addArc(n3, n1),
   204       a3 = G.addArc(n4, n3), a4 = G.addArc(n3, n1),
   205       a5 = G.addArc(n2, n4);
   205       a5 = G.addArc(n2, n4);
   206   ignore_unused_variable_warning(a2,a3,a4,a5);
   206   ::lemon::ignore_unused_variable_warning(a2,a3,a4,a5);
   207 
   207 
   208   // Check arc deletion
   208   // Check arc deletion
   209   G.erase(a1);
   209   G.erase(a1);
   210 
   210 
   211   checkGraphNodeList(G, 4);
   211   checkGraphNodeList(G, 4);
   249 
   249 
   250   Digraph G;
   250   Digraph G;
   251   Node n1 = G.addNode(), n2 = G.addNode(), n3 = G.addNode();
   251   Node n1 = G.addNode(), n2 = G.addNode(), n3 = G.addNode();
   252   Arc a1 = G.addArc(n1, n2), a2 = G.addArc(n2, n1),
   252   Arc a1 = G.addArc(n1, n2), a2 = G.addArc(n2, n1),
   253       a3 = G.addArc(n2, n3), a4 = G.addArc(n2, n3);
   253       a3 = G.addArc(n2, n3), a4 = G.addArc(n2, n3);
   254   ignore_unused_variable_warning(a1,a2,a3,a4);
   254   ::lemon::ignore_unused_variable_warning(a1,a2,a3,a4);
   255 
   255 
   256   typename Digraph::Snapshot snapshot(G);
   256   typename Digraph::Snapshot snapshot(G);
   257 
   257 
   258   Node n = G.addNode();
   258   Node n = G.addNode();
   259   G.addArc(n3, n);
   259   G.addArc(n3, n);
   338     n3 = g.addNode();
   338     n3 = g.addNode();
   339 
   339 
   340   Arc
   340   Arc
   341     e1 = g.addArc(n1, n2),
   341     e1 = g.addArc(n1, n2),
   342     e2 = g.addArc(n2, n3);
   342     e2 = g.addArc(n2, n3);
   343   ignore_unused_variable_warning(e2);
   343   ::lemon::ignore_unused_variable_warning(e2);
   344 
   344 
   345   check(g.valid(n1), "Wrong validity check");
   345   check(g.valid(n1), "Wrong validity check");
   346   check(g.valid(e1), "Wrong validity check");
   346   check(g.valid(e1), "Wrong validity check");
   347 
   347 
   348   check(!g.valid(g.nodeFromId(-1)), "Wrong validity check");
   348   check(!g.valid(g.nodeFromId(-1)), "Wrong validity check");