1.1 --- a/test/dfs_test.cc Sun Jun 15 22:03:33 2008 +0200
1.2 +++ b/test/dfs_test.cc Sun Jun 15 22:05:23 2008 +0200
1.3 @@ -16,32 +16,25 @@
1.4 *
1.5 */
1.6
1.7 -#include "test_tools.h"
1.8 -// #include <lemon/smart_graph.h>
1.9 +#include <lemon/concepts/digraph.h>
1.10 +#include <lemon/smart_graph.h>
1.11 #include <lemon/list_graph.h>
1.12 #include <lemon/dfs.h>
1.13 #include <lemon/path.h>
1.14 -#include <lemon/concepts/digraph.h>
1.15 +
1.16 +#include "graph_test.h"
1.17 +#include "test_tools.h"
1.18
1.19 using namespace lemon;
1.20
1.21 -const int PET_SIZE =5;
1.22 -
1.23 -
1.24 -void check_Dfs_SmartDigraph_Compile()
1.25 +void checkDfsCompile()
1.26 {
1.27 typedef concepts::Digraph Digraph;
1.28 -
1.29 - typedef Digraph::Arc Arc;
1.30 - typedef Digraph::Node Node;
1.31 - typedef Digraph::ArcIt ArcIt;
1.32 - typedef Digraph::NodeIt NodeIt;
1.33 -
1.34 typedef Dfs<Digraph> DType;
1.35
1.36 Digraph G;
1.37 - Node n;
1.38 - Arc e;
1.39 + Digraph::Node n;
1.40 + Digraph::Arc e;
1.41 int l;
1.42 bool b;
1.43 DType::DistMap d(G);
1.44 @@ -63,17 +56,12 @@
1.45 Path<Digraph> pp = dfs_test.path(n);
1.46 }
1.47
1.48 -
1.49 -void check_Dfs_Function_Compile()
1.50 +void checkDfsFunctionCompile()
1.51 {
1.52 typedef int VType;
1.53 typedef concepts::Digraph Digraph;
1.54 -
1.55 typedef Digraph::Arc Arc;
1.56 typedef Digraph::Node Node;
1.57 - typedef Digraph::ArcIt ArcIt;
1.58 - typedef Digraph::NodeIt NodeIt;
1.59 - typedef concepts::ReadMap<Arc,VType> LengthMap;
1.60
1.61 Digraph g;
1.62 dfs(g,Node()).run();
1.63 @@ -83,25 +71,16 @@
1.64 .distMap(concepts::WriteMap<Node,VType>())
1.65 .reachedMap(concepts::ReadWriteMap<Node,bool>())
1.66 .processedMap(concepts::WriteMap<Node,bool>())
1.67 - .run(Node());
1.68 -
1.69 + .run(Node());
1.70 }
1.71
1.72 -int main()
1.73 -{
1.74 -
1.75 - // typedef SmartDigraph Digraph;
1.76 - typedef ListDigraph Digraph;
1.77 -
1.78 - typedef Digraph::Arc Arc;
1.79 - typedef Digraph::Node Node;
1.80 - typedef Digraph::ArcIt ArcIt;
1.81 - typedef Digraph::NodeIt NodeIt;
1.82 - typedef Digraph::ArcMap<int> LengthMap;
1.83 +template <class Digraph>
1.84 +void checkDfs() {
1.85 + TEMPLATE_DIGRAPH_TYPEDEFS(Digraph);
1.86
1.87 Digraph G;
1.88 Node s, t;
1.89 - PetStruct<Digraph> ps = addPetersen(G,PET_SIZE);
1.90 + PetStruct<Digraph> ps = addPetersen(G, 5);
1.91
1.92 s=ps.outer[2];
1.93 t=ps.inner[0];
1.94 @@ -110,7 +89,7 @@
1.95 dfs_test.run(s);
1.96
1.97 Path<Digraph> p = dfs_test.path(t);
1.98 - check(p.length()==dfs_test.dist(t),"path() found a wrong path.");
1.99 + check(p.length() == dfs_test.dist(t),"path() found a wrong path.");
1.100 check(checkPath(G, p),"path() found a wrong path.");
1.101 check(pathSource(G, p) == s,"path() found a wrong path.");
1.102 check(pathTarget(G, p) == t,"path() found a wrong path.");
1.103 @@ -128,3 +107,9 @@
1.104 }
1.105 }
1.106
1.107 +int main()
1.108 +{
1.109 + checkDfs<ListDigraph>();
1.110 + checkDfs<SmartDigraph>();
1.111 + return 0;
1.112 +}