test/digraph_test.cc
changeset 802 0e30f63d45d0
parent 440 88ed40ad0d4f
child 807 3e711ee55d31
equal deleted inserted replaced
11:4b543baddeba 12:3efeca29aaa2
    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 
    64 
    64   checkGraphNodeList(G, 3);
    65   checkGraphNodeList(G, 3);
    65   checkGraphArcList(G, 4);
    66   checkGraphArcList(G, 4);
    66 
    67 
    67   checkGraphOutArcList(G, n1, 1);
    68   checkGraphOutArcList(G, n1, 1);
    86 
    87 
    87   Digraph G;
    88   Digraph G;
    88   Node n1 = G.addNode(), n2 = G.addNode(), n3 = G.addNode();
    89   Node n1 = G.addNode(), n2 = G.addNode(), n3 = G.addNode();
    89   Arc a1 = G.addArc(n1, n2), a2 = G.addArc(n2, n1),
    90   Arc a1 = G.addArc(n1, n2), a2 = G.addArc(n2, n1),
    90       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);
    91 
    93 
    92   Node n4 = G.split(n2);
    94   Node n4 = G.split(n2);
    93 
    95 
    94   check(G.target(OutArcIt(G, n2)) == n4 &&
    96   check(G.target(OutArcIt(G, n2)) == n4 &&
    95         G.source(InArcIt(G, n4)) == n2,
    97         G.source(InArcIt(G, n4)) == n2,
   119   Node n1 = G.addNode(), n2 = G.addNode(),
   121   Node n1 = G.addNode(), n2 = G.addNode(),
   120        n3 = G.addNode(), n4 = G.addNode();
   122        n3 = G.addNode(), n4 = G.addNode();
   121   Arc a1 = G.addArc(n1, n2), a2 = G.addArc(n4, n1),
   123   Arc a1 = G.addArc(n1, n2), a2 = G.addArc(n4, n1),
   122       a3 = G.addArc(n4, n3), a4 = G.addArc(n4, n3),
   124       a3 = G.addArc(n4, n3), a4 = G.addArc(n4, n3),
   123       a5 = G.addArc(n2, n4);
   125       a5 = G.addArc(n2, n4);
       
   126   ignore_unused_variable_warning(a1,a2,a3,a5);
   124 
   127 
   125   checkGraphNodeList(G, 4);
   128   checkGraphNodeList(G, 4);
   126   checkGraphArcList(G, 5);
   129   checkGraphArcList(G, 5);
   127 
   130 
   128   // Check changeSource() and changeTarget()
   131   // Check changeSource() and changeTarget()
   198   Node n1 = G.addNode(), n2 = G.addNode(),
   201   Node n1 = G.addNode(), n2 = G.addNode(),
   199        n3 = G.addNode(), n4 = G.addNode();
   202        n3 = G.addNode(), n4 = G.addNode();
   200   Arc a1 = G.addArc(n1, n2), a2 = G.addArc(n4, n1),
   203   Arc a1 = G.addArc(n1, n2), a2 = G.addArc(n4, n1),
   201       a3 = G.addArc(n4, n3), a4 = G.addArc(n3, n1),
   204       a3 = G.addArc(n4, n3), a4 = G.addArc(n3, n1),
   202       a5 = G.addArc(n2, n4);
   205       a5 = G.addArc(n2, n4);
       
   206   ignore_unused_variable_warning(a2,a3,a4,a5);
   203 
   207 
   204   // Check arc deletion
   208   // Check arc deletion
   205   G.erase(a1);
   209   G.erase(a1);
   206 
   210 
   207   checkGraphNodeList(G, 4);
   211   checkGraphNodeList(G, 4);
   245 
   249 
   246   Digraph G;
   250   Digraph G;
   247   Node n1 = G.addNode(), n2 = G.addNode(), n3 = G.addNode();
   251   Node n1 = G.addNode(), n2 = G.addNode(), n3 = G.addNode();
   248   Arc a1 = G.addArc(n1, n2), a2 = G.addArc(n2, n1),
   252   Arc a1 = G.addArc(n1, n2), a2 = G.addArc(n2, n1),
   249       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);
   250 
   255 
   251   typename Digraph::Snapshot snapshot(G);
   256   typename Digraph::Snapshot snapshot(G);
   252 
   257 
   253   Node n = G.addNode();
   258   Node n = G.addNode();
   254   G.addArc(n3, n);
   259   G.addArc(n3, n);
   333     n3 = g.addNode();
   338     n3 = g.addNode();
   334 
   339 
   335   Arc
   340   Arc
   336     e1 = g.addArc(n1, n2),
   341     e1 = g.addArc(n1, n2),
   337     e2 = g.addArc(n2, n3);
   342     e2 = g.addArc(n2, n3);
       
   343   ignore_unused_variable_warning(e2);
   338 
   344 
   339   check(g.valid(n1), "Wrong validity check");
   345   check(g.valid(n1), "Wrong validity check");
   340   check(g.valid(e1), "Wrong validity check");
   346   check(g.valid(e1), "Wrong validity check");
   341 
   347 
   342   check(!g.valid(g.nodeFromId(-1)), "Wrong validity check");
   348   check(!g.valid(g.nodeFromId(-1)), "Wrong validity check");