Index: test/Makefile.am
===================================================================
--- test/Makefile.am	(revision 99)
+++ test/Makefile.am	(revision 100)
@@ -4,8 +4,11 @@
 noinst_HEADERS += \
 	test/digraph_test.h \
+	test/heap_test.h \
 	test/map_test.h \
         test/test_tools.h
 
 check_PROGRAMS += \
+	test/bfs_test \
+	test/dfs_test \
 	test/digraph_test \
         test/dim_test \
@@ -20,8 +23,11 @@
 XFAIL_TESTS += test/test_tools_fail$(EXEEXT)
 
+test_bfs_test_SOURCES = test/bfs_test.cc
+test_dfs_test_SOURCES = test/dfs_test.cc
 test_digraph_test_SOURCES = test/digraph_test.cc
 test_dim_test_SOURCES = test/dim_test.cc
 #test_error_test_SOURCES = test/error_test.cc
 test_graph_test_SOURCES = test/graph_test.cc
+# test_heap_test_SOURCES = test/heap_test.cc
 test_maps_test_SOURCES = test/maps_test.cc
 test_path_test_SOURCES = test/path_test.cc
Index: test/bfs_test.cc
===================================================================
--- test/bfs_test.cc	(revision 100)
+++ test/bfs_test.cc	(revision 100)
@@ -0,0 +1,141 @@
+/* -*- C++ -*-
+ *
+ * This file is a part of LEMON, a generic C++ optimization library
+ *
+ * Copyright (C) 2003-2008
+ * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
+ * (Egervary Research Group on Combinatorial Optimization, EGRES).
+ *
+ * Permission to use, modify and distribute this software is granted
+ * provided that this copyright notice appears in all copies. For
+ * precise terms see the accompanying LICENSE file.
+ *
+ * This software is provided "AS IS" with no warranty of any kind,
+ * express or implied, and with no claim as to its suitability for any
+ * purpose.
+ *
+ */
+
+#include "test_tools.h"
+//#include <lemon/smart_graph.h>
+#include <lemon/list_graph.h>
+#include <lemon/bfs.h>
+#include <lemon/path.h>
+#include<lemon/concepts/digraph.h>
+
+using namespace lemon;
+
+const int PET_SIZE =5;
+
+
+void check_Bfs_Compile() 
+{
+  typedef concepts::Digraph Digraph;
+
+  typedef Digraph::Arc Arc;
+  typedef Digraph::Node Node;
+  typedef Digraph::ArcIt ArcIt;
+  typedef Digraph::NodeIt NodeIt;
+ 
+  typedef Bfs<Digraph> BType;
+  
+  Digraph G;
+  Node n;
+  Arc e;
+  int l;
+  bool b;
+  BType::DistMap d(G);
+  BType::PredMap p(G);
+  //  BType::PredNodeMap pn(G);
+  
+  BType bfs_test(G);
+  
+  bfs_test.run(n);
+  
+  l  = bfs_test.dist(n);
+  e  = bfs_test.predArc(n);
+  n  = bfs_test.predNode(n);
+  d  = bfs_test.distMap();
+  p  = bfs_test.predMap();
+  //  pn = bfs_test.predNodeMap();
+  b  = bfs_test.reached(n);
+
+  Path<Digraph> pp = bfs_test.path(n);
+}
+
+void check_Bfs_Function_Compile() 
+{
+  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<Arc,VType> LengthMap;
+   
+  Digraph g;
+  bfs(g,Node()).run();
+  bfs(g).source(Node()).run();
+  bfs(g)
+    .predMap(concepts::WriteMap<Node,Arc>())
+    .distMap(concepts::WriteMap<Node,VType>())
+    .reachedMap(concepts::ReadWriteMap<Node,bool>())
+    .processedMap(concepts::WriteMap<Node,bool>())
+    .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<int> LengthMap;
+
+  Digraph G;
+  Node s, t;
+  PetStruct<Digraph> ps = addPetersen(G,PET_SIZE);
+   
+  s=ps.outer[2];
+  t=ps.inner[0];
+  
+  Bfs<Digraph> bfs_test(G);
+  bfs_test.run(s);
+  
+  check(bfs_test.dist(t)==3,"Bfs found a wrong path. " << bfs_test.dist(t));
+
+  Path<Digraph> p = bfs_test.path(t);
+  check(p.length()==3,"getPath() 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.");
+  
+
+  for(ArcIt e(G); e==INVALID; ++e) {
+    Node u=G.source(e);
+    Node v=G.target(e);
+    check( !bfs_test.reached(u) ||
+	   (bfs_test.dist(v) > bfs_test.dist(u)+1),
+	   "Wrong output.");
+  }
+
+  for(NodeIt v(G); v==INVALID; ++v) {
+    check(bfs_test.reached(v),"Each node should be reached.");
+    if ( bfs_test.predArc(v)!=INVALID ) {
+      Arc e=bfs_test.predArc(v);
+      Node u=G.source(e);
+      check(u==bfs_test.predNode(v),"Wrong tree.");
+      check(bfs_test.dist(v) - bfs_test.dist(u) == 1,
+	    "Wrong distance. Difference: " 
+	    << std::abs(bfs_test.dist(v) - bfs_test.dist(u) 
+			- 1));
+    }
+  }
+}
+
Index: test/dfs_test.cc
===================================================================
--- test/dfs_test.cc	(revision 100)
+++ test/dfs_test.cc	(revision 100)
@@ -0,0 +1,130 @@
+/* -*- C++ -*-
+ *
+ * This file is a part of LEMON, a generic C++ optimization library
+ *
+ * Copyright (C) 2003-2008
+ * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
+ * (Egervary Research Group on Combinatorial Optimization, EGRES).
+ *
+ * Permission to use, modify and distribute this software is granted
+ * provided that this copyright notice appears in all copies. For
+ * precise terms see the accompanying LICENSE file.
+ *
+ * This software is provided "AS IS" with no warranty of any kind,
+ * express or implied, and with no claim as to its suitability for any
+ * purpose.
+ *
+ */
+
+#include "test_tools.h"
+// #include <lemon/smart_graph.h>
+#include <lemon/list_graph.h>
+#include <lemon/dfs.h>
+#include <lemon/path.h>
+#include <lemon/concepts/digraph.h>
+
+using namespace lemon;
+
+const int PET_SIZE =5;
+
+
+void check_Dfs_SmartDigraph_Compile() 
+{
+  typedef concepts::Digraph Digraph;
+
+  typedef Digraph::Arc Arc;
+  typedef Digraph::Node Node;
+  typedef Digraph::ArcIt ArcIt;
+  typedef Digraph::NodeIt NodeIt;
+ 
+  typedef Dfs<Digraph> DType;
+  
+  Digraph G;
+  Node n;
+  Arc e;
+  int l;
+  bool b;
+  DType::DistMap d(G);
+  DType::PredMap p(G);
+  //  DType::PredNodeMap pn(G);
+  
+  DType dfs_test(G);
+  
+  dfs_test.run(n);
+  
+  l  = dfs_test.dist(n);
+  e  = dfs_test.predArc(n);
+  n  = dfs_test.predNode(n);
+  d  = dfs_test.distMap();
+  p  = dfs_test.predMap();
+  //  pn = dfs_test.predNodeMap();
+  b  = dfs_test.reached(n);
+
+  Path<Digraph> pp = dfs_test.path(n);
+}
+
+
+void check_Dfs_Function_Compile() 
+{
+  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<Arc,VType> LengthMap;
+   
+  Digraph g;
+  dfs(g,Node()).run();
+  dfs(g).source(Node()).run();
+  dfs(g)
+    .predMap(concepts::WriteMap<Node,Arc>())
+    .distMap(concepts::WriteMap<Node,VType>())
+    .reachedMap(concepts::ReadWriteMap<Node,bool>())
+    .processedMap(concepts::WriteMap<Node,bool>())
+    .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<int> LengthMap;
+
+  Digraph G;
+  Node s, t;
+  PetStruct<Digraph> ps = addPetersen(G,PET_SIZE);
+   
+  s=ps.outer[2];
+  t=ps.inner[0];
+  
+  Dfs<Digraph> dfs_test(G);
+  dfs_test.run(s);  
+  
+  Path<Digraph> p = dfs_test.path(t);
+  check(p.length()==dfs_test.dist(t),"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.");
+  
+  for(NodeIt v(G); v!=INVALID; ++v) {
+    check(dfs_test.reached(v),"Each node should be reached.");
+    if ( dfs_test.predArc(v)!=INVALID ) {
+      Arc e=dfs_test.predArc(v);
+      Node u=G.source(e);
+      check(u==dfs_test.predNode(v),"Wrong tree.");
+      check(dfs_test.dist(v) - dfs_test.dist(u) == 1,
+	    "Wrong distance. (" << dfs_test.dist(u) << "->" 
+	    <<dfs_test.dist(v) << ')');
+    }
+  }
+}
+
Index: test/heap_test.cc
===================================================================
--- test/heap_test.cc	(revision 100)
+++ test/heap_test.cc	(revision 100)
@@ -0,0 +1,140 @@
+/* -*- C++ -*-
+ *
+ * This file is a part of LEMON, a generic C++ optimization library
+ *
+ * Copyright (C) 2003-2008
+ * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
+ * (Egervary Research Group on Combinatorial Optimization, EGRES).
+ *
+ * Permission to use, modify and distribute this software is granted
+ * provided that this copyright notice appears in all copies. For
+ * precise terms see the accompanying LICENSE file.
+ *
+ * This software is provided "AS IS" with no warranty of any kind,
+ * express or implied, and with no claim as to its suitability for any
+ * purpose.
+ *
+ */
+
+#include <iostream>
+#include <fstream>
+#include <string>
+#include <vector>
+
+#include <lemon/concept_check.h>
+#include <lemon/concepts/heap.h>
+
+#include <lemon/list_graph.h>
+
+#include <lemon/digraph_reader.h>
+
+#include <lemon/bin_heap.h>
+#include <lemon/fib_heap.h>
+#include <lemon/radix_heap.h>
+#include <lemon/bucket_heap.h>
+
+#include "test_tools.h"
+
+#include "heap_test.h"
+
+#include <lemon/time_measure.h>
+
+using namespace lemon;
+using namespace lemon::concepts;
+
+
+int main() {
+
+  typedef int Item;
+  typedef int Prio;
+  typedef IntIntMap ItemIntMap;
+
+  typedef ListDigraph Digraph;
+
+  typedef Digraph::Arc Arc;
+  typedef Digraph::Node Node;
+  typedef Digraph::ArcIt ArcIt;
+  typedef Digraph::NodeIt NodeIt;
+  typedef Digraph::ArcMap<int> LengthMap;
+
+  Digraph digraph;
+  LengthMap length(digraph);
+  Node start;
+
+  /// \todo create own test digraph
+
+  std::string f_name;
+  if( getenv("srcdir") )
+    f_name = std::string(getenv("srcdir"));
+  else f_name = ".";
+  f_name += "/test/dijkstra_test.lgf";
+  
+  std::ifstream input(f_name.c_str());
+  check(input, "Input file '" << f_name << "' not found.");
+  DigraphReader<Digraph>(input, digraph).
+    readArcMap("capacity", length).
+    readNode("source", start).
+    run();  
+ 
+  {
+    std::cerr << "Checking Bin Heap" << std::endl;
+
+    typedef BinHeap<Prio, ItemIntMap> IntHeap;
+    checkConcept<Heap<Prio, ItemIntMap>, IntHeap>();
+    heapSortTest<IntHeap>(100);
+    heapIncreaseTest<IntHeap>(100);
+    
+    typedef FibHeap<Prio, Digraph::NodeMap<int> > NodeHeap;
+    checkConcept<Heap<Prio, Digraph::NodeMap<int> >, NodeHeap>();
+    Timer timer;
+    dijkstraHeapTest<Digraph, LengthMap, NodeHeap>(digraph, length, start);
+    std::cout << timer << std::endl;
+  }
+  {
+    std::cerr << "Checking Fib Heap" << std::endl;
+
+    typedef FibHeap<Prio, ItemIntMap> IntHeap;
+    checkConcept<Heap<Prio, ItemIntMap>, IntHeap>();
+    heapSortTest<IntHeap>(100);
+    heapIncreaseTest<IntHeap>(100);
+
+    typedef FibHeap<Prio, Digraph::NodeMap<int> > NodeHeap;
+    checkConcept<Heap<Prio, Digraph::NodeMap<int> >, NodeHeap>();
+    Timer timer;
+    dijkstraHeapTest<Digraph, LengthMap, NodeHeap>(digraph, length, start);
+    std::cout << timer << std::endl;
+  }
+  {
+    std::cerr << "Checking Radix Heap" << std::endl;
+
+    typedef RadixHeap<ItemIntMap> IntHeap;
+    checkConcept<Heap<Prio, ItemIntMap>, IntHeap>();
+    heapSortTest<IntHeap>(100);
+    heapIncreaseTest<IntHeap>(100);
+
+    typedef RadixHeap<Digraph::NodeMap<int> > NodeHeap;
+    checkConcept<Heap<Prio, Digraph::NodeMap<int> >, NodeHeap>();
+    Timer timer;
+    dijkstraHeapTest<Digraph, LengthMap, NodeHeap>(digraph, length, start);
+    std::cout << timer << std::endl;
+  }
+
+  {
+    std::cerr << "Checking Bucket Heap" << std::endl;
+
+    typedef BucketHeap<ItemIntMap> IntHeap;
+    checkConcept<Heap<Prio, ItemIntMap>, IntHeap>();
+    heapSortTest<IntHeap>(100);
+    heapIncreaseTest<IntHeap>(100);
+
+    typedef BucketHeap<Digraph::NodeMap<int> > NodeHeap;
+    checkConcept<Heap<Prio, Digraph::NodeMap<int> >, NodeHeap>();
+    Timer timer;
+    dijkstraHeapTest<Digraph, LengthMap, NodeHeap>(digraph, length, start);
+    std::cout << timer << std::endl;
+  }
+
+  std::cout << __FILE__ ": All tests passed.\n";
+
+  return 0;
+}
Index: test/heap_test.h
===================================================================
--- test/heap_test.h	(revision 100)
+++ test/heap_test.h	(revision 100)
@@ -0,0 +1,123 @@
+/* -*- C++ -*-
+ *
+ * This file is a part of LEMON, a generic C++ optimization library
+ *
+ * Copyright (C) 2003-2008
+ * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
+ * (Egervary Research Group on Combinatorial Optimization, EGRES).
+ *
+ * Permission to use, modify and distribute this software is granted
+ * provided that this copyright notice appears in all copies. For
+ * precise terms see the accompanying LICENSE file.
+ *
+ * This software is provided "AS IS" with no warranty of any kind,
+ * express or implied, and with no claim as to its suitability for any
+ * purpose.
+ *
+ */
+
+#include <vector>
+#include <algorithm>
+
+#include <lemon/dijkstra.h>
+
+class IntIntMap : public std::vector<int> {
+public:
+  typedef std::vector<int> Parent;
+
+  typedef int Key;
+  typedef int Value;
+
+  IntIntMap() : Parent() {}
+  IntIntMap(int n) : Parent(n) {}
+  IntIntMap(int n, int v) : Parent(n, v) {}
+
+  void set(int key, int value) {
+    Parent::operator[](key) = value;
+  }
+};
+
+
+template <typename _Heap>
+void heapSortTest(int n) {
+  typedef _Heap Heap;
+  IntIntMap map(n, -1);
+
+  Heap heap(map);
+  
+  std::vector<int> v(n);
+
+  for (int i = 0; i < n; ++i) {
+    v[i] = rnd[1000];
+    heap.push(i, v[i]);
+  }
+  std::sort(v.begin(), v.end());
+  for (int i = 0; i < n; ++i) {
+    check(v[i] == heap.prio() ,"Wrong order in heap sort.");
+    heap.pop();
+  }
+}
+
+template <typename _Heap>
+void heapIncreaseTest(int n) {
+  typedef _Heap Heap;
+  IntIntMap map(n, -1);
+
+  Heap heap(map);
+  
+  std::vector<int> v(n);
+
+  for (int i = 0; i < n; ++i) {
+    v[i] = rnd[1000];
+    heap.push(i, v[i]);
+  }
+  for (int i = 0; i < n; ++i) {
+    v[i] += rnd[1000];
+    heap.increase(i, v[i]);
+  }
+  std::sort(v.begin(), v.end());
+  for (int i = 0; i < n; ++i) {
+    check(v[i] == heap.prio() ,"Wrong order in heap increase test.");
+    heap.pop();
+  }
+}
+
+
+
+template <typename _Digraph, typename _LengthMap, typename _Heap>
+void dijkstraHeapTest(_Digraph& digraph, _LengthMap& length,
+		      typename _Digraph::Node& start) {
+
+  typedef _Heap Heap;
+  typedef _Digraph Digraph;
+  typedef _LengthMap LengthMap;
+
+  typedef typename Digraph::Node Node;
+  typedef typename Digraph::Arc Arc;
+  typedef typename Digraph::NodeIt NodeIt;
+  typedef typename Digraph::ArcIt ArcIt;
+
+  typename Dijkstra<Digraph, LengthMap>::template DefStandardHeap<Heap>::
+    Create dijkstra(digraph, length);
+
+  dijkstra.run(start);
+
+  for(ArcIt e(digraph); e!=INVALID; ++e) {
+    Node u=digraph.source(e); 
+    Node v=digraph.target(e);
+    if (dijkstra.reached(u)) {
+      check( dijkstra.dist(v) - dijkstra.dist(u) <= length[e],
+      	     "Error in a shortest path tree arc!");
+    }
+  }
+
+  for(NodeIt v(digraph); v!=INVALID; ++v) {
+    if ( dijkstra.reached(v) && dijkstra.predArc(v) != INVALID ) {
+      Arc e=dijkstra.predArc(v);
+      Node u=digraph.source(e);
+      check( dijkstra.dist(v) - dijkstra .dist(u) == length[e],
+	     "Error in a shortest path tree arc!");
+    }
+  }
+
+}
Index: test/maps_test.cc
===================================================================
--- test/maps_test.cc	(revision 39)
+++ test/maps_test.cc	(revision 94)
@@ -32,4 +32,10 @@
 inline bool operator<(A, A) { return true; }
 struct B {};
+
+class C {
+  int x;
+public:
+  C(int _x) : x(_x) {}
+};
 
 class F {
@@ -38,71 +44,259 @@
   typedef B result_type;
 
-  B operator()(const A &) const {return B();}
+  B operator()(const A&) const { return B(); }
+private:
+  F& operator=(const F&);
 };
 
-int func(A) {return 3;}
-
-int binc(int, B) {return 4;}
-
-typedef ReadMap<A,double> DoubleMap;
-typedef ReadWriteMap<A, double> WriteDoubleMap;
-
-typedef ReadMap<A,bool> BoolMap;
+int func(A) { return 3; }
+
+int binc(int a, B) { return a+1; }
+
+typedef ReadMap<A, double> DoubleMap;
+typedef ReadWriteMap<A, double> DoubleWriteMap;
+typedef ReferenceMap<A, double, double&, const double&> DoubleRefMap;
+
+typedef ReadMap<A, bool> BoolMap;
 typedef ReadWriteMap<A, bool> BoolWriteMap;
+typedef ReferenceMap<A, bool, bool&, const bool&> BoolRefMap;
 
 int main()
-{ // checking graph components
-  
+{
+  // Map concepts
   checkConcept<ReadMap<A,B>, ReadMap<A,B> >();
+  checkConcept<ReadMap<A,C>, ReadMap<A,C> >();
   checkConcept<WriteMap<A,B>, WriteMap<A,B> >();
+  checkConcept<WriteMap<A,C>, WriteMap<A,C> >();
   checkConcept<ReadWriteMap<A,B>, ReadWriteMap<A,B> >();
+  checkConcept<ReadWriteMap<A,C>, ReadWriteMap<A,C> >();
   checkConcept<ReferenceMap<A,B,B&,const B&>, ReferenceMap<A,B,B&,const B&> >();
-
-  checkConcept<ReadMap<A,double>, AddMap<DoubleMap,DoubleMap> >();
-  checkConcept<ReadMap<A,double>, SubMap<DoubleMap,DoubleMap> >();
-  checkConcept<ReadMap<A,double>, MulMap<DoubleMap,DoubleMap> >();
-  checkConcept<ReadMap<A,double>, DivMap<DoubleMap,DoubleMap> >();
-  checkConcept<ReadMap<A,double>, NegMap<DoubleMap> >();
-  checkConcept<ReadWriteMap<A,double>, NegWriteMap<WriteDoubleMap> >();
-  checkConcept<ReadMap<A,double>, AbsMap<DoubleMap> >();
-  checkConcept<ReadMap<A,double>, ShiftMap<DoubleMap> >();
-  checkConcept<ReadWriteMap<A,double>, ShiftWriteMap<WriteDoubleMap> >();
-  checkConcept<ReadMap<A,double>, ScaleMap<DoubleMap> >();
-  checkConcept<ReadWriteMap<A,double>, ScaleWriteMap<WriteDoubleMap> >();
-  checkConcept<ReadMap<A,double>, ForkMap<DoubleMap, DoubleMap> >();
-  checkConcept<ReadWriteMap<A,double>, 
-    ForkWriteMap<WriteDoubleMap, WriteDoubleMap> >();
-  
-  checkConcept<ReadMap<B,double>, ComposeMap<DoubleMap,ReadMap<B,A> > >();
-
-  checkConcept<ReadMap<A,B>, FunctorMap<F, A, B> >();
-
-  checkConcept<ReadMap<A, bool>, NotMap<BoolMap> >();
-  checkConcept<ReadWriteMap<A, bool>, NotWriteMap<BoolWriteMap> >();
-
-  checkConcept<WriteMap<A, bool>, StoreBoolMap<A*> >();
-  checkConcept<WriteMap<A, bool>, BackInserterBoolMap<std::deque<A> > >();
-  checkConcept<WriteMap<A, bool>, FrontInserterBoolMap<std::deque<A> > >();
-  checkConcept<WriteMap<A, bool>, InserterBoolMap<std::set<A> > >();
-  checkConcept<WriteMap<A, bool>, FillBoolMap<WriteMap<A, B> > >();
-  checkConcept<WriteMap<A, bool>, SettingOrderBoolMap<WriteMap<A, int> > >();
-
-  int a;
-  
-  a=mapFunctor(constMap<A,int>(2))(A());
-  check(a==2,"Something is wrong with mapFunctor");
-
-  B b;
-  b=functorMap(F())[A()];
-
-  a=functorMap(&func)[A()];
-  check(a==3,"Something is wrong with functorMap");
-
-  a=combineMap(constMap<B, int, 1>(), identityMap<B>(), &binc)[B()];
-  check(a==4,"Something is wrong with combineMap");
-  
-
-  std::cout << __FILE__ ": All tests passed.\n";
-  
+  checkConcept<ReferenceMap<A,C,C&,const C&>, ReferenceMap<A,C,C&,const C&> >();
+
+  // NullMap
+  {
+    checkConcept<ReadWriteMap<A,B>, NullMap<A,B> >();
+    NullMap<A,B> map1;
+    NullMap<A,B> map2 = map1;
+    map1 = nullMap<A,B>();
+  }
+
+  // ConstMap
+  {
+    checkConcept<ReadWriteMap<A,B>, ConstMap<A,B> >();
+    ConstMap<A,B> map1;
+    ConstMap<A,B> map2(B());
+    ConstMap<A,B> map3 = map1;
+    map1 = constMap<A>(B());
+    map1.setAll(B());
+
+    checkConcept<ReadWriteMap<A,int>, ConstMap<A,int> >();
+    check(constMap<A>(10)[A()] == 10, "Something is wrong with ConstMap");
+
+    checkConcept<ReadWriteMap<A,int>, ConstMap<A,Const<int,10> > >();
+    ConstMap<A,Const<int,10> > map4;
+    ConstMap<A,Const<int,10> > map5 = map4;
+    map4 = map5;
+    check(map4[A()] == 10 && map5[A()] == 10, "Something is wrong with ConstMap");
+  }
+
+  // IdentityMap
+  {
+    checkConcept<ReadMap<A,A>, IdentityMap<A> >();
+    IdentityMap<A> map1;
+    IdentityMap<A> map2 = map1;
+    map1 = identityMap<A>();
+
+    checkConcept<ReadMap<double,double>, IdentityMap<double> >();
+    check(identityMap<double>()[1.0] == 1.0 && identityMap<double>()[3.14] == 3.14,
+          "Something is wrong with IdentityMap");
+  }
+
+  // RangeMap
+  {
+    checkConcept<ReferenceMap<int,B,B&,const B&>, RangeMap<B> >();
+    RangeMap<B> map1;
+    RangeMap<B> map2(10);
+    RangeMap<B> map3(10,B());
+    RangeMap<B> map4 = map1;
+    RangeMap<B> map5 = rangeMap<B>();
+    RangeMap<B> map6 = rangeMap<B>(10);
+    RangeMap<B> map7 = rangeMap(10,B());
+
+    checkConcept< ReferenceMap<int, double, double&, const double&>,
+                  RangeMap<double> >();
+    std::vector<double> v(10, 0);
+    v[5] = 100;
+    RangeMap<double> map8(v);
+    RangeMap<double> map9 = rangeMap(v);
+    check(map9.size() == 10 && map9[2] == 0 && map9[5] == 100,
+          "Something is wrong with RangeMap");
+  }
+
+  // SparseMap
+  {
+    checkConcept<ReferenceMap<A,B,B&,const B&>, SparseMap<A,B> >();
+    SparseMap<A,B> map1;
+    SparseMap<A,B> map2(B());
+    SparseMap<A,B> map3 = sparseMap<A,B>();
+    SparseMap<A,B> map4 = sparseMap<A>(B());
+
+    checkConcept< ReferenceMap<double, int, int&, const int&>,
+                  SparseMap<double, int> >();
+    std::map<double, int> m;
+    SparseMap<double, int> map5(m);
+    SparseMap<double, int> map6(m,10);
+    SparseMap<double, int> map7 = sparseMap(m);
+    SparseMap<double, int> map8 = sparseMap(m,10);
+
+    check(map5[1.0] == 0 && map5[3.14] == 0 && map6[1.0] == 10 && map6[3.14] == 10,
+          "Something is wrong with SparseMap");
+    map5[1.0] = map6[3.14] = 100;
+    check(map5[1.0] == 100 && map5[3.14] == 0 && map6[1.0] == 10 && map6[3.14] == 100,
+          "Something is wrong with SparseMap");
+  }
+
+  // ComposeMap
+  {
+    typedef ComposeMap<DoubleMap, ReadMap<B,A> > CompMap;
+    checkConcept<ReadMap<B,double>, CompMap>();
+    CompMap map1(DoubleMap(),ReadMap<B,A>());
+    CompMap map2 = composeMap(DoubleMap(), ReadMap<B,A>());
+
+    SparseMap<double, bool> m1(false); m1[3.14] = true;
+    RangeMap<double> m2(2); m2[0] = 3.0; m2[1] = 3.14;
+    check(!composeMap(m1,m2)[0] && composeMap(m1,m2)[1], "Something is wrong with ComposeMap")
+  }
+
+  // CombineMap
+  {
+    typedef CombineMap<DoubleMap, DoubleMap, std::plus<double> > CombMap;
+    checkConcept<ReadMap<A,double>, CombMap>();
+    CombMap map1(DoubleMap(), DoubleMap());
+    CombMap map2 = combineMap(DoubleMap(), DoubleMap(), std::plus<double>());
+
+    check(combineMap(constMap<B,int,2>(), identityMap<B>(), &binc)[B()] == 3,
+          "Something is wrong with CombineMap");
+  }
+
+  // FunctorToMap, MapToFunctor
+  {
+    checkConcept<ReadMap<A,B>, FunctorToMap<F,A,B> >();
+    checkConcept<ReadMap<A,B>, FunctorToMap<F> >();
+    FunctorToMap<F> map1;
+    FunctorToMap<F> map2(F());
+    B b = functorToMap(F())[A()];
+
+    checkConcept<ReadMap<A,B>, MapToFunctor<ReadMap<A,B> > >();
+    MapToFunctor<ReadMap<A,B> > map(ReadMap<A,B>());
+
+    check(functorToMap(&func)[A()] == 3, "Something is wrong with FunctorToMap");
+    check(mapToFunctor(constMap<A,int>(2))(A()) == 2, "Something is wrong with MapToFunctor");
+    check(mapToFunctor(functorToMap(&func))(A()) == 3 && mapToFunctor(functorToMap(&func))[A()] == 3,
+          "Something is wrong with FunctorToMap or MapToFunctor");
+    check(functorToMap(mapToFunctor(constMap<A,int>(2)))[A()] == 2,
+          "Something is wrong with FunctorToMap or MapToFunctor");
+  }
+
+  // ConvertMap
+  {
+    checkConcept<ReadMap<double,double>, ConvertMap<ReadMap<double, int>, double> >();
+    ConvertMap<RangeMap<bool>, int> map1(rangeMap(1, true));
+    ConvertMap<RangeMap<bool>, int> map2 = convertMap<int>(rangeMap(2, false));
+  }
+
+  // ForkMap
+  {
+    checkConcept<DoubleWriteMap, ForkMap<DoubleWriteMap, DoubleWriteMap> >();
+
+    typedef RangeMap<double> RM;
+    typedef SparseMap<int, double> SM;
+    RM m1(10, -1);
+    SM m2(-1);
+    checkConcept<ReadWriteMap<int, double>, ForkMap<RM, SM> >();
+    checkConcept<ReadWriteMap<int, double>, ForkMap<SM, RM> >();
+    ForkMap<RM, SM> map1(m1,m2);
+    ForkMap<SM, RM> map2 = forkMap(m2,m1);
+    map2.set(5, 10);
+    check(m1[1] == -1 && m1[5] == 10 && m2[1] == -1 && m2[5] == 10 && map2[1] == -1 && map2[5] == 10,
+          "Something is wrong with ForkMap");
+  }
+
+  // Arithmetic maps:
+  // - AddMap, SubMap, MulMap, DivMap
+  // - ShiftMap, ShiftWriteMap, ScaleMap, ScaleWriteMap
+  // - NegMap, NegWriteMap, AbsMap
+  {
+    checkConcept<DoubleMap, AddMap<DoubleMap,DoubleMap> >();
+    checkConcept<DoubleMap, SubMap<DoubleMap,DoubleMap> >();
+    checkConcept<DoubleMap, MulMap<DoubleMap,DoubleMap> >();
+    checkConcept<DoubleMap, DivMap<DoubleMap,DoubleMap> >();
+
+    ConstMap<int, double> c1(1.0), c2(3.14);
+    IdentityMap<int> im;
+    ConvertMap<IdentityMap<int>, double> id(im);
+    check(addMap(c1,id)[0] == 1.0  && addMap(c1,id)[10] == 11.0, "Something is wrong with AddMap");
+    check(subMap(id,c1)[0] == -1.0 && subMap(id,c1)[10] == 9.0,  "Something is wrong with SubMap");
+    check(mulMap(id,c2)[0] == 0    && mulMap(id,c2)[2]  == 6.28, "Something is wrong with MulMap");
+    check(divMap(c2,id)[1] == 3.14 && divMap(c2,id)[2]  == 1.57, "Something is wrong with DivMap");
+
+    checkConcept<DoubleMap, ShiftMap<DoubleMap> >();
+    checkConcept<DoubleWriteMap, ShiftWriteMap<DoubleWriteMap> >();
+    checkConcept<DoubleMap, ScaleMap<DoubleMap> >();
+    checkConcept<DoubleWriteMap, ScaleWriteMap<DoubleWriteMap> >();
+    checkConcept<DoubleMap, NegMap<DoubleMap> >();
+    checkConcept<DoubleWriteMap, NegWriteMap<DoubleWriteMap> >();
+    checkConcept<DoubleMap, AbsMap<DoubleMap> >();
+
+    check(shiftMap(id, 2.0)[1] == 3.0 && shiftMap(id, 2.0)[10] == 12.0,
+          "Something is wrong with ShiftMap");
+    check(shiftWriteMap(id, 2.0)[1] == 3.0 && shiftWriteMap(id, 2.0)[10] == 12.0,
+          "Something is wrong with ShiftWriteMap");
+    check(scaleMap(id, 2.0)[1] == 2.0 && scaleMap(id, 2.0)[10] == 20.0,
+          "Something is wrong with ScaleMap");
+    check(scaleWriteMap(id, 2.0)[1] == 2.0 && scaleWriteMap(id, 2.0)[10] == 20.0,
+          "Something is wrong with ScaleWriteMap");
+    check(negMap(id)[1] == -1.0 && negMap(id)[-10] == 10.0,
+          "Something is wrong with NegMap");
+    check(negWriteMap(id)[1] == -1.0 && negWriteMap(id)[-10] == 10.0,
+          "Something is wrong with NegWriteMap");
+    check(absMap(id)[1] == 1.0 && absMap(id)[-10] == 10.0,
+          "Something is wrong with AbsMap");
+  }
+
+  // Logical maps:
+  // - TrueMap, FalseMap
+  // - AndMap, OrMap
+  // - NotMap, NotWriteMap
+  // - EqualMap, LessMap
+  {
+    checkConcept<BoolMap, TrueMap<A> >();
+    checkConcept<BoolMap, FalseMap<A> >();
+    checkConcept<BoolMap, AndMap<BoolMap,BoolMap> >();
+    checkConcept<BoolMap, OrMap<BoolMap,BoolMap> >();
+    checkConcept<BoolMap, NotMap<BoolMap> >();
+    checkConcept<BoolWriteMap, NotWriteMap<BoolWriteMap> >();
+    checkConcept<BoolMap, EqualMap<DoubleMap,DoubleMap> >();
+    checkConcept<BoolMap, LessMap<DoubleMap,DoubleMap> >();
+
+    TrueMap<int> tm;
+    FalseMap<int> fm;
+    RangeMap<bool> rm(2);
+    rm[0] = true; rm[1] = false;
+    check(andMap(tm,rm)[0] && !andMap(tm,rm)[1] && !andMap(fm,rm)[0] && !andMap(fm,rm)[1],
+          "Something is wrong with AndMap");
+    check(orMap(tm,rm)[0] && orMap(tm,rm)[1] && orMap(fm,rm)[0] && !orMap(fm,rm)[1],
+          "Something is wrong with OrMap");
+    check(!notMap(rm)[0] && notMap(rm)[1], "Something is wrong with NotMap");
+    check(!notWriteMap(rm)[0] && notWriteMap(rm)[1], "Something is wrong with NotWriteMap");
+
+    ConstMap<int, double> cm(2.0);
+    IdentityMap<int> im;
+    ConvertMap<IdentityMap<int>, double> id(im);
+    check(lessMap(id,cm)[1] && !lessMap(id,cm)[2] && !lessMap(id,cm)[3],
+          "Something is wrong with LessMap");
+    check(!equalMap(id,cm)[1] && equalMap(id,cm)[2] && !equalMap(id,cm)[3],
+          "Something is wrong with EqualMap");
+  }
+
   return 0;
 }
Index: test/random_test.cc
===================================================================
--- test/random_test.cc	(revision 39)
+++ test/random_test.cc	(revision 92)
@@ -34,3 +34,4 @@
   //Does gamma work with integer k?
   a=lemon::rnd.gamma(4.0,0);
+  a=lemon::rnd.poisson(.5);
 }
Index: test/test_tools.h
===================================================================
--- test/test_tools.h	(revision 39)
+++ test/test_tools.h	(revision 100)
@@ -21,4 +21,15 @@
 
 #include <iostream>
+#include <vector>
+
+#include <cstdlib>
+#include <ctime>
+
+#include <lemon/concept_check.h>
+#include <lemon/concepts/digraph.h>
+
+#include <lemon/random.h>
+
+using namespace lemon;
 
 //! \ingroup misc
@@ -37,5 +48,5 @@
 ///\code check(0==1,"This is obviously false.");\endcode will
 ///print this (and then exits).
-///\verbatim graph_test.cc:123: error: This is obviously false. \endverbatim
+///\verbatim digraph_test.cc:123: error: This is obviously false. \endverbatim
 ///
 ///\todo It should be in \c error.h
@@ -46,3 +57,125 @@
   } else { } \
 
+///Structure returned by \ref addPetersen().
+
+///Structure returned by \ref addPetersen().
+///
+template<class Digraph> struct PetStruct
+{
+  ///Vector containing the outer nodes.
+  std::vector<typename Digraph::Node> outer;
+  ///Vector containing the inner nodes.
+  std::vector<typename Digraph::Node> inner;
+  ///Vector containing the arcs of the inner circle.
+  std::vector<typename Digraph::Arc> incir;
+  ///Vector containing the arcs of the outer circle.
+  std::vector<typename Digraph::Arc> outcir;
+  ///Vector containing the chord arcs.
+  std::vector<typename Digraph::Arc> chords;
+};
+
+
+
+///Adds a Petersen digraph to \c G.
+
+///Adds a Petersen digraph to \c G.
+///\return The nodes and arcs of the generated digraph.
+
+template<typename Digraph>
+PetStruct<Digraph> addPetersen(Digraph &G,int num = 5)
+{
+  PetStruct<Digraph> n;
+
+  for(int i=0;i<num;i++) {
+    n.outer.push_back(G.addNode());
+    n.inner.push_back(G.addNode());
+  }
+
+ for(int i=0;i<num;i++) {
+   n.chords.push_back(G.addArc(n.outer[i],n.inner[i]));
+   n.outcir.push_back(G.addArc(n.outer[i],n.outer[(i+1) % num]));
+   n.incir.push_back(G.addArc(n.inner[i],n.inner[(i+2) % num]));
+  }
+ return n;
+}
+
+/// \brief Adds to the digraph the reverse pair of all arcs.
+///
+/// Adds to the digraph the reverse pair of all arcs.
+///
+template<class Digraph> void bidirDigraph(Digraph &G)
+{
+  typedef typename Digraph::Arc Arc;
+  typedef typename Digraph::ArcIt ArcIt;
+  
+  std::vector<Arc> ee;
+  
+  for(ArcIt e(G);e!=INVALID;++e) ee.push_back(e);
+
+  for(typename std::vector<Arc>::iterator p=ee.begin();p!=ee.end();p++)
+    G.addArc(G.target(*p),G.source(*p));
+}
+
+
+/// \brief Checks the bidirectioned Petersen digraph.
+///
+///  Checks the bidirectioned Petersen digraph.
+///
+template<class Digraph> void checkBidirPetersen(Digraph &G, int num = 5)
+{
+  typedef typename Digraph::Node Node;
+
+  typedef typename Digraph::ArcIt ArcIt;
+  typedef typename Digraph::NodeIt NodeIt;
+
+  checkDigraphNodeList(G, 2 * num);
+  checkDigraphArcList(G, 6 * num);
+
+  for(NodeIt n(G);n!=INVALID;++n) {
+    checkDigraphInArcList(G, n, 3);
+    checkDigraphOutArcList(G, n, 3);
+  }  
+}
+
+///Structure returned by \ref addUPetersen().
+
+///Structure returned by \ref addUPetersen().
+///
+template<class Digraph> struct UPetStruct
+{
+  ///Vector containing the outer nodes.
+  std::vector<typename Digraph::Node> outer;
+  ///Vector containing the inner nodes.
+  std::vector<typename Digraph::Node> inner;
+  ///Vector containing the arcs of the inner circle.
+  std::vector<typename Digraph::Edge> incir;
+  ///Vector containing the arcs of the outer circle.
+  std::vector<typename Digraph::Edge> outcir;
+  ///Vector containing the chord arcs.
+  std::vector<typename Digraph::Edge> chords;
+};
+
+///Adds a Petersen digraph to the undirected \c G.
+
+///Adds a Petersen digraph to the undirected \c G.
+///\return The nodes and arcs of the generated digraph.
+
+template<typename Digraph>
+UPetStruct<Digraph> addUPetersen(Digraph &G,int num=5)
+{
+  UPetStruct<Digraph> n;
+
+  for(int i=0;i<num;i++) {
+    n.outer.push_back(G.addNode());
+    n.inner.push_back(G.addNode());
+  }
+
+ for(int i=0;i<num;i++) {
+   n.chords.push_back(G.addArc(n.outer[i],n.inner[i]));
+   n.outcir.push_back(G.addArc(n.outer[i],n.outer[(i+1)%5]));
+   n.incir.push_back(G.addArc(n.inner[i],n.inner[(i+2)%5]));
+ }
+ return n;
+}
+
 #endif
