test/bfs_test.cc
changeset 209 765619b7cbb2
parent 171 02f4d5d9bfd7
child 222 f9a18c21dba8
     1.1 --- a/test/bfs_test.cc	Sun Jul 13 16:46:56 2008 +0100
     1.2 +++ b/test/bfs_test.cc	Sun Jul 13 19:51:02 2008 +0100
     1.3 @@ -1,6 +1,6 @@
     1.4 -/* -*- C++ -*-
     1.5 +/* -*- mode: C++; indent-tabs-mode: nil; -*-
     1.6   *
     1.7 - * This file is a part of LEMON, a generic C++ optimization library
     1.8 + * This file is a part of LEMON, a generic C++ optimization library.
     1.9   *
    1.10   * Copyright (C) 2003-2008
    1.11   * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
    1.12 @@ -27,11 +27,11 @@
    1.13  
    1.14  using namespace lemon;
    1.15  
    1.16 -void checkBfsCompile() 
    1.17 +void checkBfsCompile()
    1.18  {
    1.19    typedef concepts::Digraph Digraph;
    1.20    typedef Bfs<Digraph> BType;
    1.21 -  
    1.22 +
    1.23    Digraph G;
    1.24    Digraph::Node n;
    1.25    Digraph::Arc e;
    1.26 @@ -40,11 +40,11 @@
    1.27    BType::DistMap d(G);
    1.28    BType::PredMap p(G);
    1.29    //  BType::PredNodeMap pn(G);
    1.30 -  
    1.31 +
    1.32    BType bfs_test(G);
    1.33 -  
    1.34 +
    1.35    bfs_test.run(n);
    1.36 -  
    1.37 +
    1.38    l  = bfs_test.dist(n);
    1.39    e  = bfs_test.predArc(n);
    1.40    n  = bfs_test.predNode(n);
    1.41 @@ -56,13 +56,13 @@
    1.42    Path<Digraph> pp = bfs_test.path(n);
    1.43  }
    1.44  
    1.45 -void checkBfsFunctionCompile() 
    1.46 +void checkBfsFunctionCompile()
    1.47  {
    1.48    typedef int VType;
    1.49    typedef concepts::Digraph Digraph;
    1.50    typedef Digraph::Arc Arc;
    1.51    typedef Digraph::Node Node;
    1.52 -   
    1.53 +
    1.54    Digraph g;
    1.55    bfs(g,Node()).run();
    1.56    bfs(g).source(Node()).run();
    1.57 @@ -81,13 +81,13 @@
    1.58    Digraph G;
    1.59    Node s, t;
    1.60    PetStruct<Digraph> ps = addPetersen(G, 5);
    1.61 -   
    1.62 +
    1.63    s=ps.outer[2];
    1.64    t=ps.inner[0];
    1.65 -  
    1.66 +
    1.67    Bfs<Digraph> bfs_test(G);
    1.68    bfs_test.run(s);
    1.69 -  
    1.70 +
    1.71    check(bfs_test.dist(t)==3,"Bfs found a wrong path." << bfs_test.dist(t));
    1.72  
    1.73    Path<Digraph> p = bfs_test.path(t);
    1.74 @@ -95,14 +95,14 @@
    1.75    check(checkPath(G, p),"path() found a wrong path.");
    1.76    check(pathSource(G, p) == s,"path() found a wrong path.");
    1.77    check(pathTarget(G, p) == t,"path() found a wrong path.");
    1.78 -  
    1.79 +
    1.80  
    1.81    for(ArcIt e(G); e==INVALID; ++e) {
    1.82      Node u=G.source(e);
    1.83      Node v=G.target(e);
    1.84      check( !bfs_test.reached(u) ||
    1.85 -	   (bfs_test.dist(v) > bfs_test.dist(u)+1),
    1.86 -	   "Wrong output.");
    1.87 +           (bfs_test.dist(v) > bfs_test.dist(u)+1),
    1.88 +           "Wrong output.");
    1.89    }
    1.90  
    1.91    for(NodeIt v(G); v==INVALID; ++v) {
    1.92 @@ -112,9 +112,9 @@
    1.93        Node u=G.source(e);
    1.94        check(u==bfs_test.predNode(v),"Wrong tree.");
    1.95        check(bfs_test.dist(v) - bfs_test.dist(u) == 1,
    1.96 -	    "Wrong distance. Difference: " 
    1.97 -	    << std::abs(bfs_test.dist(v) - bfs_test.dist(u) 
    1.98 -			- 1));
    1.99 +            "Wrong distance. Difference: "
   1.100 +            << std::abs(bfs_test.dist(v) - bfs_test.dist(u)
   1.101 +                        - 1));
   1.102      }
   1.103    }
   1.104  }