diff -r 91fb4372688f -r 02f4d5d9bfd7 test/bfs_test.cc --- a/test/bfs_test.cc Sun Jun 15 22:03:33 2008 +0200 +++ b/test/bfs_test.cc Sun Jun 15 22:05:23 2008 +0200 @@ -16,32 +16,25 @@ * */ -#include "test_tools.h" -//#include +#include +#include #include #include #include -#include + +#include "graph_test.h" +#include "test_tools.h" using namespace lemon; -const int PET_SIZE =5; - - -void check_Bfs_Compile() +void checkBfsCompile() { typedef concepts::Digraph Digraph; - - typedef Digraph::Arc Arc; - typedef Digraph::Node Node; - typedef Digraph::ArcIt ArcIt; - typedef Digraph::NodeIt NodeIt; - typedef Bfs BType; Digraph G; - Node n; - Arc e; + Digraph::Node n; + Digraph::Arc e; int l; bool b; BType::DistMap d(G); @@ -63,16 +56,12 @@ Path pp = bfs_test.path(n); } -void check_Bfs_Function_Compile() +void checkBfsFunctionCompile() { typedef int VType; typedef concepts::Digraph Digraph; - typedef Digraph::Arc Arc; typedef Digraph::Node Node; - typedef Digraph::ArcIt ArcIt; - typedef Digraph::NodeIt NodeIt; - typedef concepts::ReadMap LengthMap; Digraph g; bfs(g,Node()).run(); @@ -83,24 +72,15 @@ .reachedMap(concepts::ReadWriteMap()) .processedMap(concepts::WriteMap()) .run(Node()); - } -int main() -{ - - // typedef SmartDigraph Digraph; - typedef ListDigraph Digraph; - - typedef Digraph::Arc Arc; - typedef Digraph::Node Node; - typedef Digraph::ArcIt ArcIt; - typedef Digraph::NodeIt NodeIt; - typedef Digraph::ArcMap LengthMap; +template +void checkBfs() { + TEMPLATE_DIGRAPH_TYPEDEFS(Digraph); Digraph G; Node s, t; - PetStruct ps = addPetersen(G,PET_SIZE); + PetStruct ps = addPetersen(G, 5); s=ps.outer[2]; t=ps.inner[0]; @@ -108,10 +88,10 @@ Bfs bfs_test(G); bfs_test.run(s); - check(bfs_test.dist(t)==3,"Bfs found a wrong path. " << bfs_test.dist(t)); + check(bfs_test.dist(t)==3,"Bfs found a wrong path." << bfs_test.dist(t)); Path p = bfs_test.path(t); - check(p.length()==3,"getPath() found a wrong path."); + check(p.length()==3,"path() found a wrong path."); check(checkPath(G, p),"path() found a wrong path."); check(pathSource(G, p) == s,"path() found a wrong path."); check(pathTarget(G, p) == t,"path() found a wrong path."); @@ -139,3 +119,9 @@ } } +int main() +{ + checkBfs(); + checkBfs(); + return 0; +}