[Lemon-commits] Peter Kovacs: Also test fullInit() in suurballe_...

Lemon HG hg at lemon.cs.elte.hu
Wed Mar 3 18:22:59 CET 2010


details:   http://lemon.cs.elte.hu/hg/lemon/rev/9f6ed854d409
changeset: 932:9f6ed854d409
user:      Peter Kovacs <kpeter [at] inf.elte.hu>
date:      Tue Mar 02 10:27:47 2010 +0100
description:
	Also test fullInit() in suurballe_test (#181, #323)

diffstat:

 test/suurballe_test.cc |  36 +++++++++++++++++++++++++-----------
 1 files changed, 25 insertions(+), 11 deletions(-)

diffs (69 lines):

diff --git a/test/suurballe_test.cc b/test/suurballe_test.cc
--- a/test/suurballe_test.cc
+++ b/test/suurballe_test.cc
@@ -205,9 +205,11 @@
     node("target", t).
     run();
 
-  // Find 2 paths
+  // Check run()
   {
     Suurballe<ListDigraph> suurballe(digraph, length);
+    
+    // Find 2 paths
     check(suurballe.run(s, t) == 2, "Wrong number of paths");
     check(checkFlow(digraph, suurballe.flowMap(), s, t, 2),
           "The flow is not feasible");
@@ -217,11 +219,8 @@
           "Wrong potentials");
     for (int i = 0; i < suurballe.pathNum(); ++i)
       check(checkPath(digraph, suurballe.path(i), s, t), "Wrong path");
-  }
-
-  // Find 3 paths
-  {
-    Suurballe<ListDigraph> suurballe(digraph, length);
+   
+    // Find 3 paths
     check(suurballe.run(s, t, 3) == 3, "Wrong number of paths");
     check(checkFlow(digraph, suurballe.flowMap(), s, t, 3),
           "The flow is not feasible");
@@ -231,11 +230,8 @@
           "Wrong potentials");
     for (int i = 0; i < suurballe.pathNum(); ++i)
       check(checkPath(digraph, suurballe.path(i), s, t), "Wrong path");
-  }
-
-  // Find 5 paths (only 3 can be found)
-  {
-    Suurballe<ListDigraph> suurballe(digraph, length);
+    
+    // Find 5 paths (only 3 can be found)
     check(suurballe.run(s, t, 5) == 3, "Wrong number of paths");
     check(checkFlow(digraph, suurballe.flowMap(), s, t, 3),
           "The flow is not feasible");
@@ -246,6 +242,24 @@
     for (int i = 0; i < suurballe.pathNum(); ++i)
       check(checkPath(digraph, suurballe.path(i), s, t), "Wrong path");
   }
+  
+  // Check fullInit() + start()
+  {
+    Suurballe<ListDigraph> suurballe(digraph, length);
+    suurballe.fullInit(s);
+    
+    // Find 2 paths
+    check(suurballe.start(t) == 2, "Wrong number of paths");
+    check(suurballe.totalLength() == 510, "The flow is not optimal");
+
+    // Find 3 paths
+    check(suurballe.start(t, 3) == 3, "Wrong number of paths");
+    check(suurballe.totalLength() == 1040, "The flow is not optimal");
+
+    // Find 5 paths (only 3 can be found)
+    check(suurballe.start(t, 5) == 3, "Wrong number of paths");
+    check(suurballe.totalLength() == 1040, "The flow is not optimal");
+  }
 
   return 0;
 }



More information about the Lemon-commits mailing list