functor->map and map->functor converters added.
     2  * src/test/suurballe_test.cc - Part of LEMON, a generic C++ optimization library
 
     4  * Copyright (C) 2004 Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
 
     5  * (Egervary Combinatorial Optimization Research Group, EGRES).
 
     7  * Permission to use, modify and distribute this software is granted
 
     8  * provided that this copyright notice appears in all copies. For
 
     9  * precise terms see the accompanying LICENSE file.
 
    11  * This software is provided "AS IS" with no warranty of any kind,
 
    12  * express or implied, and with no claim as to its suitability for any
 
    18 #include <lemon/list_graph.h>
 
    19 #include <lemon/suurballe.h>
 
    21 #include "test_tools.h"
 
    23 using namespace lemon;
 
    31   typedef ListGraph Graph;
 
    32   typedef Graph::Node Node;
 
    33   typedef Graph::Edge Edge;
 
    39   Node s=graph.addNode();
 
    40   Node v1=graph.addNode();  
 
    41   Node v2=graph.addNode();
 
    42   Node v3=graph.addNode();
 
    43   Node v4=graph.addNode();
 
    44   Node v5=graph.addNode();
 
    45   Node t=graph.addNode();
 
    47   Edge s_v1=graph.addEdge(s, v1);
 
    48   Edge v1_v2=graph.addEdge(v1, v2);
 
    49   Edge s_v3=graph.addEdge(s, v3);
 
    50   Edge v2_v4=graph.addEdge(v2, v4);
 
    51   Edge v2_v5=graph.addEdge(v2, v5);
 
    52   Edge v3_v5=graph.addEdge(v3, v5);
 
    53   Edge v4_t=graph.addEdge(v4, t);
 
    54   Edge v5_t=graph.addEdge(v5, t);
 
    57   Graph::EdgeMap<int> length(graph);
 
    68   std::cout << "Minlengthpaths algorithm test..." << std::endl;
 
    72   Suurballe< Graph, Graph::EdgeMap<int> >
 
    73     surb_test(graph, length, s, t);
 
    75   check(  surb_test.run(k) == 2 && surb_test.totalLength() == 46,
 
    76 	  "Two paths, total length should be 46");
 
    78   check(  surb_test.checkComplementarySlackness(),
 
    79 	  "Complementary slackness conditions are not met.");
 
    81   //  typedef DirPath<Graph> DPath;
 
    85   surb_test.getPath(P,0);
 
    86   check(P.length() == 4, "First path should contain 4 edges.");  
 
    87   std::cout<<P.length()<<std::endl;
 
    88   surb_test.getPath(P,1);
 
    89   check(P.length() == 3, "Second path: 3 edges.");
 
    90   std::cout<<P.length()<<std::endl;
 
    94   check(  surb_test.run(k) == 1 && surb_test.totalLength() == 19,
 
    95 	  "One path, total length should be 19");
 
    97   check(  surb_test.checkComplementarySlackness(),
 
    98 	  "Complementary slackness conditions are not met.");
 
   100   //  surb_test.getPath(P,0);
 
   101   //  check(P.length() == 4, "First path should contain 4 edges.");  
 
   103   std::cout << (passed ? "All tests passed." : "Some of the tests failed!!!")
 
   106   return passed ? 0 : 1;