diff -r c85f53572941 -r 075de3c84e1f test/preflow_test.cc --- a/test/preflow_test.cc Wed Sep 22 09:26:01 2010 +0200 +++ b/test/preflow_test.cc Mon Feb 28 09:50:33 2011 +0100 @@ -151,6 +151,30 @@ return true; } +void initFlowTest() +{ + DIGRAPH_TYPEDEFS(SmartDigraph); + + SmartDigraph g; + SmartDigraph::ArcMap cap(g),iflow(g); + Node s=g.addNode(); Node t=g.addNode(); + Node n1=g.addNode(); Node n2=g.addNode(); + Arc a; + a=g.addArc(s,n1); cap[a]=20; iflow[a]=20; + a=g.addArc(n1,n2); cap[a]=10; iflow[a]=0; + a=g.addArc(n2,t); cap[a]=20; iflow[a]=0; + + Preflow pre(g,cap,s,t); + pre.init(iflow); + pre.startFirstPhase(); + check(pre.flowValue() == 10, "The incorrect max flow value."); + check(pre.minCut(s), "Wrong min cut (Node s)."); + check(pre.minCut(n1), "Wrong min cut (Node n1)."); + check(!pre.minCut(n2), "Wrong min cut (Node n2)."); + check(!pre.minCut(t), "Wrong min cut (Node t)."); +} + + int main() { typedef SmartDigraph Digraph; @@ -241,5 +265,7 @@ check(preflow_test.flowValue() == min_cut_value, "The max flow value or the three min cut values are incorrect."); + initFlowTest(); + return 0; }