# HG changeset patch # User Peter Kovacs # Date 2010-03-02 10:27:47 # Node ID 9f6ed854d409ff2889796d735f1c824eda8d538a # Parent abb95d48e89efff4b62c44364faa0b68a13c96ad Also test fullInit() in suurballe_test (#181, #323) 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 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 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 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 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; }