test/dijkstra_test.cc
changeset 599 f63e87b9748e
parent 440 88ed40ad0d4f
child 877 141f9c0db4a3
child 1007 7e368d9b67f7
     1.1 --- a/test/dijkstra_test.cc	Sat Apr 18 21:54:30 2009 +0200
     1.2 +++ b/test/dijkstra_test.cc	Tue Apr 21 10:34:49 2009 +0100
     1.3 @@ -60,48 +60,94 @@
     1.4    typedef Digraph::Arc Arc;
     1.5  
     1.6    Digraph G;
     1.7 -  Node s, t;
     1.8 +  Node s, t, n;
     1.9    Arc e;
    1.10    VType l;
    1.11 +  int i;
    1.12    bool b;
    1.13    DType::DistMap d(G);
    1.14    DType::PredMap p(G);
    1.15    LengthMap length;
    1.16    Path<Digraph> pp;
    1.17 +  concepts::ReadMap<Node,bool> nm;
    1.18  
    1.19    {
    1.20      DType dijkstra_test(G,length);
    1.21 +    const DType& const_dijkstra_test = dijkstra_test;
    1.22  
    1.23      dijkstra_test.run(s);
    1.24      dijkstra_test.run(s,t);
    1.25  
    1.26 +    dijkstra_test.init();
    1.27 +    dijkstra_test.addSource(s);
    1.28 +    dijkstra_test.addSource(s, 1);
    1.29 +    n = dijkstra_test.processNextNode();
    1.30 +    n = const_dijkstra_test.nextNode();
    1.31 +    b = const_dijkstra_test.emptyQueue();
    1.32 +    i = const_dijkstra_test.queueSize();
    1.33 +    
    1.34 +    dijkstra_test.start();
    1.35 +    dijkstra_test.start(t);
    1.36 +    dijkstra_test.start(nm);
    1.37 +
    1.38 +    l  = const_dijkstra_test.dist(t);
    1.39 +    e  = const_dijkstra_test.predArc(t);
    1.40 +    s  = const_dijkstra_test.predNode(t);
    1.41 +    b  = const_dijkstra_test.reached(t);
    1.42 +    b  = const_dijkstra_test.processed(t);
    1.43 +    d  = const_dijkstra_test.distMap();
    1.44 +    p  = const_dijkstra_test.predMap();
    1.45 +    pp = const_dijkstra_test.path(t);
    1.46 +    l  = const_dijkstra_test.currentDist(t);
    1.47 +  }
    1.48 +  {
    1.49 +    DType
    1.50 +      ::SetPredMap<concepts::ReadWriteMap<Node,Arc> >
    1.51 +      ::SetDistMap<concepts::ReadWriteMap<Node,VType> >
    1.52 +      ::SetStandardProcessedMap
    1.53 +      ::SetProcessedMap<concepts::WriteMap<Node,bool> >
    1.54 +      ::SetOperationTraits<DijkstraDefaultOperationTraits<VType> >
    1.55 +      ::SetHeap<BinHeap<VType, concepts::ReadWriteMap<Node,int> > >
    1.56 +      ::SetStandardHeap<BinHeap<VType, concepts::ReadWriteMap<Node,int> > >
    1.57 +      ::SetHeap<BinHeap<VType, concepts::ReadWriteMap<Node,int> >, 
    1.58 +                concepts::ReadWriteMap<Node,int> >
    1.59 +      ::Create dijkstra_test(G,length);
    1.60 +
    1.61 +    LengthMap length_map;
    1.62 +    concepts::ReadWriteMap<Node,Arc> pred_map;
    1.63 +    concepts::ReadWriteMap<Node,VType> dist_map;
    1.64 +    concepts::WriteMap<Node,bool> processed_map;
    1.65 +    concepts::ReadWriteMap<Node,int> heap_cross_ref;
    1.66 +    BinHeap<VType, concepts::ReadWriteMap<Node,int> > heap(heap_cross_ref);
    1.67 +    
    1.68 +    dijkstra_test
    1.69 +      .lengthMap(length_map)
    1.70 +      .predMap(pred_map)
    1.71 +      .distMap(dist_map)
    1.72 +      .processedMap(processed_map)
    1.73 +      .heap(heap, heap_cross_ref);
    1.74 +
    1.75 +    dijkstra_test.run(s);
    1.76 +    dijkstra_test.run(s,t);
    1.77 +
    1.78 +    dijkstra_test.addSource(s);
    1.79 +    dijkstra_test.addSource(s, 1);
    1.80 +    n = dijkstra_test.processNextNode();
    1.81 +    n = dijkstra_test.nextNode();
    1.82 +    b = dijkstra_test.emptyQueue();
    1.83 +    i = dijkstra_test.queueSize();
    1.84 +    
    1.85 +    dijkstra_test.start();
    1.86 +    dijkstra_test.start(t);
    1.87 +    dijkstra_test.start(nm);
    1.88 +
    1.89      l  = dijkstra_test.dist(t);
    1.90      e  = dijkstra_test.predArc(t);
    1.91      s  = dijkstra_test.predNode(t);
    1.92      b  = dijkstra_test.reached(t);
    1.93 -    d  = dijkstra_test.distMap();
    1.94 -    p  = dijkstra_test.predMap();
    1.95 +    b  = dijkstra_test.processed(t);
    1.96      pp = dijkstra_test.path(t);
    1.97 -  }
    1.98 -  {
    1.99 -    DType
   1.100 -      ::SetPredMap<concepts::ReadWriteMap<Node,Arc> >
   1.101 -      ::SetDistMap<concepts::ReadWriteMap<Node,VType> >
   1.102 -      ::SetProcessedMap<concepts::WriteMap<Node,bool> >
   1.103 -      ::SetStandardProcessedMap
   1.104 -      ::SetOperationTraits<DijkstraDefaultOperationTraits<VType> >
   1.105 -      ::SetHeap<BinHeap<VType, concepts::ReadWriteMap<Node,int> > >
   1.106 -      ::SetStandardHeap<BinHeap<VType, concepts::ReadWriteMap<Node,int> > >
   1.107 -      ::Create dijkstra_test(G,length);
   1.108 -
   1.109 -    dijkstra_test.run(s);
   1.110 -    dijkstra_test.run(s,t);
   1.111 -
   1.112 -    l  = dijkstra_test.dist(t);
   1.113 -    e  = dijkstra_test.predArc(t);
   1.114 -    s  = dijkstra_test.predNode(t);
   1.115 -    b  = dijkstra_test.reached(t);
   1.116 -    pp = dijkstra_test.path(t);
   1.117 +    l  = dijkstra_test.currentDist(t);
   1.118    }
   1.119  
   1.120  }