COIN-OR::LEMON - Graph Library

Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • test/suurballe_test.cc

    r858 r623  
    2424#include <lemon/suurballe.h>
    2525#include <lemon/concepts/digraph.h>
    26 #include <lemon/concepts/heap.h>
    2726
    2827#include "test_tools.h"
     
    8382  typedef concepts::ReadMap<Arc, VType> LengthMap;
    8483 
    85   typedef Suurballe<Digraph, LengthMap> ST;
    86   typedef Suurballe<Digraph, LengthMap>
    87     ::SetFlowMap<ST::FlowMap>
    88     ::SetPotentialMap<ST::PotentialMap>
    89     ::SetPath<SimplePath<Digraph> >
    90     ::SetHeap<concepts::Heap<VType, Digraph::NodeMap<int> > >
    91     ::Create SuurballeType;
     84  typedef Suurballe<Digraph, LengthMap> SuurballeType;
    9285
    9386  Digraph g;
     
    109102  k = suurb_test.run(n, n, k);
    110103  suurb_test.init(n);
    111   suurb_test.fullInit(n);
    112   suurb_test.start(n);
    113   suurb_test.start(n, k);
    114104  k = suurb_test.findFlow(n);
    115105  k = suurb_test.findFlow(n, k);
     
    206196    run();
    207197
    208   // Check run()
     198  // Find 2 paths
    209199  {
    210200    Suurballe<ListDigraph> suurballe(digraph, length);
    211    
    212     // Find 2 paths
    213201    check(suurballe.run(s, t) == 2, "Wrong number of paths");
    214202    check(checkFlow(digraph, suurballe.flowMap(), s, t, 2),
     
    220208    for (int i = 0; i < suurballe.pathNum(); ++i)
    221209      check(checkPath(digraph, suurballe.path(i), s, t), "Wrong path");
    222    
    223     // Find 3 paths
     210  }
     211
     212  // Find 3 paths
     213  {
     214    Suurballe<ListDigraph> suurballe(digraph, length);
    224215    check(suurballe.run(s, t, 3) == 3, "Wrong number of paths");
    225216    check(checkFlow(digraph, suurballe.flowMap(), s, t, 3),
     
    231222    for (int i = 0; i < suurballe.pathNum(); ++i)
    232223      check(checkPath(digraph, suurballe.path(i), s, t), "Wrong path");
    233    
    234     // Find 5 paths (only 3 can be found)
     224  }
     225
     226  // Find 5 paths (only 3 can be found)
     227  {
     228    Suurballe<ListDigraph> suurballe(digraph, length);
    235229    check(suurballe.run(s, t, 5) == 3, "Wrong number of paths");
    236230    check(checkFlow(digraph, suurballe.flowMap(), s, t, 3),
     
    243237      check(checkPath(digraph, suurballe.path(i), s, t), "Wrong path");
    244238  }
    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   }
    263239
    264240  return 0;
Note: See TracChangeset for help on using the changeset viewer.