COIN-OR::LEMON - Graph Library

Changeset 858:9f6ed854d409 in lemon-main


Ignore:
Timestamp:
03/02/10 10:27:47 (15 years ago)
Author:
Peter Kovacs <kpeter@…>
Branch:
default
Phase:
public
Message:

Also test fullInit() in suurballe_test (#181, #323)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • test/suurballe_test.cc

    r857 r858  
    206206    run();
    207207
    208   // Find 2 paths
     208  // Check run()
    209209  {
    210210    Suurballe<ListDigraph> suurballe(digraph, length);
     211   
     212    // Find 2 paths
    211213    check(suurballe.run(s, t) == 2, "Wrong number of paths");
    212214    check(checkFlow(digraph, suurballe.flowMap(), s, t, 2),
     
    218220    for (int i = 0; i < suurballe.pathNum(); ++i)
    219221      check(checkPath(digraph, suurballe.path(i), s, t), "Wrong path");
    220   }
    221 
    222   // Find 3 paths
    223   {
    224     Suurballe<ListDigraph> suurballe(digraph, length);
     222   
     223    // Find 3 paths
    225224    check(suurballe.run(s, t, 3) == 3, "Wrong number of paths");
    226225    check(checkFlow(digraph, suurballe.flowMap(), s, t, 3),
     
    232231    for (int i = 0; i < suurballe.pathNum(); ++i)
    233232      check(checkPath(digraph, suurballe.path(i), s, t), "Wrong path");
    234   }
    235 
    236   // Find 5 paths (only 3 can be found)
    237   {
    238     Suurballe<ListDigraph> suurballe(digraph, length);
     233   
     234    // Find 5 paths (only 3 can be found)
    239235    check(suurballe.run(s, t, 5) == 3, "Wrong number of paths");
    240236    check(checkFlow(digraph, suurballe.flowMap(), s, t, 3),
     
    247243      check(checkPath(digraph, suurballe.path(i), s, t), "Wrong path");
    248244  }
     245 
     246  // Check fullInit() + start()
     247  {
     248    Suurballe<ListDigraph> suurballe(digraph, length);
     249    suurballe.fullInit(s);
     250   
     251    // Find 2 paths
     252    check(suurballe.start(t) == 2, "Wrong number of paths");
     253    check(suurballe.totalLength() == 510, "The flow is not optimal");
     254
     255    // Find 3 paths
     256    check(suurballe.start(t, 3) == 3, "Wrong number of paths");
     257    check(suurballe.totalLength() == 1040, "The flow is not optimal");
     258
     259    // Find 5 paths (only 3 can be found)
     260    check(suurballe.start(t, 5) == 3, "Wrong number of paths");
     261    check(suurballe.totalLength() == 1040, "The flow is not optimal");
     262  }
    249263
    250264  return 0;
Note: See TracChangeset for help on using the changeset viewer.