Changeset 209:765619b7cbb2 in lemon for test/bfs_test.cc
 Timestamp:
 07/13/08 20:51:02 (15 years ago)
 Branch:
 default
 Phase:
 public
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

test/bfs_test.cc
r171 r209 1 /* * C++*1 /* * mode: C++; indenttabsmode: nil; * 2 2 * 3 * This file is a part of LEMON, a generic C++ optimization library 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 5 * Copyright (C) 20032008 … … 28 28 using namespace lemon; 29 29 30 void checkBfsCompile() 30 void checkBfsCompile() 31 31 { 32 32 typedef concepts::Digraph Digraph; 33 33 typedef Bfs<Digraph> BType; 34 34 35 35 Digraph G; 36 36 Digraph::Node n; … … 41 41 BType::PredMap p(G); 42 42 // BType::PredNodeMap pn(G); 43 43 44 44 BType bfs_test(G); 45 45 46 46 bfs_test.run(n); 47 47 48 48 l = bfs_test.dist(n); 49 49 e = bfs_test.predArc(n); … … 57 57 } 58 58 59 void checkBfsFunctionCompile() 59 void checkBfsFunctionCompile() 60 60 { 61 61 typedef int VType; … … 63 63 typedef Digraph::Arc Arc; 64 64 typedef Digraph::Node Node; 65 65 66 66 Digraph g; 67 67 bfs(g,Node()).run(); … … 82 82 Node s, t; 83 83 PetStruct<Digraph> ps = addPetersen(G, 5); 84 84 85 85 s=ps.outer[2]; 86 86 t=ps.inner[0]; 87 87 88 88 Bfs<Digraph> bfs_test(G); 89 89 bfs_test.run(s); 90 90 91 91 check(bfs_test.dist(t)==3,"Bfs found a wrong path." << bfs_test.dist(t)); 92 92 … … 96 96 check(pathSource(G, p) == s,"path() found a wrong path."); 97 97 check(pathTarget(G, p) == t,"path() found a wrong path."); 98 98 99 99 100 100 for(ArcIt e(G); e==INVALID; ++e) { … … 102 102 Node v=G.target(e); 103 103 check( !bfs_test.reached(u)  104 105 104 (bfs_test.dist(v) > bfs_test.dist(u)+1), 105 "Wrong output."); 106 106 } 107 107 … … 113 113 check(u==bfs_test.predNode(v),"Wrong tree."); 114 114 check(bfs_test.dist(v)  bfs_test.dist(u) == 1, 115 "Wrong distance. Difference: " 116 << std::abs(bfs_test.dist(v)  bfs_test.dist(u) 117 115 "Wrong distance. Difference: " 116 << std::abs(bfs_test.dist(v)  bfs_test.dist(u) 117  1)); 118 118 } 119 119 }
Note: See TracChangeset
for help on using the changeset viewer.