src/test/suurballe_test.cc
changeset 941 186aa53d2802
parent 921 818510fa3d99
child 1164 80bb73097736
     1.1 --- a/src/test/suurballe_test.cc	Thu Oct 07 17:21:27 2004 +0000
     1.2 +++ b/src/test/suurballe_test.cc	Fri Oct 08 13:07:51 2004 +0000
     1.3 @@ -20,21 +20,19 @@
     1.4  //#include <path.h>
     1.5  #include "test_tools.h"
     1.6  
     1.7 -using namespace std;
     1.8  using namespace lemon;
     1.9  
    1.10  
    1.11 -
    1.12  bool passed = true;
    1.13  
    1.14  
    1.15  int main()
    1.16  {
    1.17 +  typedef ListGraph Graph;
    1.18 +  typedef Graph::Node Node;
    1.19 +  typedef Graph::Edge Edge;
    1.20  
    1.21 -  typedef ListGraph::Node Node;
    1.22 -  typedef ListGraph::Edge Edge;
    1.23 -
    1.24 -  ListGraph graph;
    1.25 +  Graph graph;
    1.26  
    1.27    //Ahuja könyv példája
    1.28  
    1.29 @@ -56,7 +54,7 @@
    1.30    Edge v5_t=graph.addEdge(v5, t);
    1.31    
    1.32  
    1.33 -  ListGraph::EdgeMap<int> length(graph);
    1.34 +  Graph::EdgeMap<int> length(graph);
    1.35  
    1.36    length.set(s_v1, 6);
    1.37    length.set(v1_v2, 4);
    1.38 @@ -71,29 +69,29 @@
    1.39  
    1.40    
    1.41    int k=3;
    1.42 -  Suurballe< ListGraph, ListGraph::EdgeMap<int> >
    1.43 -    surb_test(graph, length);
    1.44 +  Suurballe< Graph, Graph::EdgeMap<int> >
    1.45 +    surb_test(graph, length, s, t);
    1.46  
    1.47 -  check(  surb_test.run(s,t,k) == 2 && surb_test.totalLength() == 46,
    1.48 +  check(  surb_test.run(k) == 2 && surb_test.totalLength() == 46,
    1.49  	  "Two paths, total length should be 46");
    1.50  
    1.51    check(  surb_test.checkComplementarySlackness(),
    1.52  	  "Complementary slackness conditions are not met.");
    1.53  
    1.54 -  //  typedef DirPath<ListGraph> DPath;
    1.55 +  //  typedef DirPath<Graph> DPath;
    1.56    //  DPath P(graph);
    1.57  
    1.58    /*
    1.59    surb_test.getPath(P,0);
    1.60    check(P.length() == 4, "First path should contain 4 edges.");  
    1.61 -  cout<<P.length()<<endl;
    1.62 +  std::cout<<P.length()<<std::endl;
    1.63    surb_test.getPath(P,1);
    1.64    check(P.length() == 3, "Second path: 3 edges.");
    1.65 -  cout<<P.length()<<endl;
    1.66 +  std::cout<<P.length()<<std::endl;
    1.67    */  
    1.68  
    1.69    k=1;
    1.70 -  check(  surb_test.run(s,t,k) == 1 && surb_test.totalLength() == 19,
    1.71 +  check(  surb_test.run(k) == 1 && surb_test.totalLength() == 19,
    1.72  	  "One path, total length should be 19");
    1.73  
    1.74    check(  surb_test.checkComplementarySlackness(),
    1.75 @@ -102,8 +100,8 @@
    1.76    //  surb_test.getPath(P,0);
    1.77    //  check(P.length() == 4, "First path should contain 4 edges.");  
    1.78  
    1.79 -  cout << (passed ? "All tests passed." : "Some of the tests failed!!!")
    1.80 -       << endl;
    1.81 +  std::cout << (passed ? "All tests passed." : "Some of the tests failed!!!")
    1.82 +	    << std::endl;
    1.83  
    1.84    return passed ? 0 : 1;
    1.85