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

 1 edited
Legend:
 Unmodified
 Added
 Removed

test/dfs_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 checkDfsCompile() 30 void checkDfsCompile() 31 31 { 32 32 typedef concepts::Digraph Digraph; 33 33 typedef Dfs<Digraph> DType; 34 34 35 35 Digraph G; 36 36 Digraph::Node n; … … 41 41 DType::PredMap p(G); 42 42 // DType::PredNodeMap pn(G); 43 43 44 44 DType dfs_test(G); 45 45 46 46 dfs_test.run(n); 47 47 48 48 l = dfs_test.dist(n); 49 49 e = dfs_test.predArc(n); … … 57 57 } 58 58 59 void checkDfsFunctionCompile() 59 void checkDfsFunctionCompile() 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 dfs(g,Node()).run(); … … 72 72 .reachedMap(concepts::ReadWriteMap<Node,bool>()) 73 73 .processedMap(concepts::WriteMap<Node,bool>()) 74 .run(Node()); 74 .run(Node()); 75 75 } 76 76 … … 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 Dfs<Digraph> dfs_test(G); 89 dfs_test.run(s); 90 89 dfs_test.run(s); 90 91 91 Path<Digraph> p = dfs_test.path(t); 92 92 check(p.length() == dfs_test.dist(t),"path() found a wrong path."); … … 94 94 check(pathSource(G, p) == s,"path() found a wrong path."); 95 95 check(pathTarget(G, p) == t,"path() found a wrong path."); 96 96 97 97 for(NodeIt v(G); v!=INVALID; ++v) { 98 98 check(dfs_test.reached(v),"Each node should be reached."); … … 102 102 check(u==dfs_test.predNode(v),"Wrong tree."); 103 103 check(dfs_test.dist(v)  dfs_test.dist(u) == 1, 104 "Wrong distance. (" << dfs_test.dist(u) << ">" 105 104 "Wrong distance. (" << dfs_test.dist(u) << ">" 105 <<dfs_test.dist(v) << ')'); 106 106 } 107 107 }
Note: See TracChangeset
for help on using the changeset viewer.