test/dijkstra_test.cc
changeset 637 4faa0c763906
parent 440 88ed40ad0d4f
child 877 141f9c0db4a3
child 1007 7e368d9b67f7
equal deleted inserted replaced
10:272e79ddc6f5 11:eb3a50d37db8
    58   typedef Dijkstra<Digraph, LengthMap> DType;
    58   typedef Dijkstra<Digraph, LengthMap> DType;
    59   typedef Digraph::Node Node;
    59   typedef Digraph::Node Node;
    60   typedef Digraph::Arc Arc;
    60   typedef Digraph::Arc Arc;
    61 
    61 
    62   Digraph G;
    62   Digraph G;
    63   Node s, t;
    63   Node s, t, n;
    64   Arc e;
    64   Arc e;
    65   VType l;
    65   VType l;
       
    66   int i;
    66   bool b;
    67   bool b;
    67   DType::DistMap d(G);
    68   DType::DistMap d(G);
    68   DType::PredMap p(G);
    69   DType::PredMap p(G);
    69   LengthMap length;
    70   LengthMap length;
    70   Path<Digraph> pp;
    71   Path<Digraph> pp;
       
    72   concepts::ReadMap<Node,bool> nm;
    71 
    73 
    72   {
    74   {
    73     DType dijkstra_test(G,length);
    75     DType dijkstra_test(G,length);
       
    76     const DType& const_dijkstra_test = dijkstra_test;
    74 
    77 
    75     dijkstra_test.run(s);
    78     dijkstra_test.run(s);
    76     dijkstra_test.run(s,t);
    79     dijkstra_test.run(s,t);
       
    80 
       
    81     dijkstra_test.init();
       
    82     dijkstra_test.addSource(s);
       
    83     dijkstra_test.addSource(s, 1);
       
    84     n = dijkstra_test.processNextNode();
       
    85     n = const_dijkstra_test.nextNode();
       
    86     b = const_dijkstra_test.emptyQueue();
       
    87     i = const_dijkstra_test.queueSize();
       
    88     
       
    89     dijkstra_test.start();
       
    90     dijkstra_test.start(t);
       
    91     dijkstra_test.start(nm);
       
    92 
       
    93     l  = const_dijkstra_test.dist(t);
       
    94     e  = const_dijkstra_test.predArc(t);
       
    95     s  = const_dijkstra_test.predNode(t);
       
    96     b  = const_dijkstra_test.reached(t);
       
    97     b  = const_dijkstra_test.processed(t);
       
    98     d  = const_dijkstra_test.distMap();
       
    99     p  = const_dijkstra_test.predMap();
       
   100     pp = const_dijkstra_test.path(t);
       
   101     l  = const_dijkstra_test.currentDist(t);
       
   102   }
       
   103   {
       
   104     DType
       
   105       ::SetPredMap<concepts::ReadWriteMap<Node,Arc> >
       
   106       ::SetDistMap<concepts::ReadWriteMap<Node,VType> >
       
   107       ::SetStandardProcessedMap
       
   108       ::SetProcessedMap<concepts::WriteMap<Node,bool> >
       
   109       ::SetOperationTraits<DijkstraDefaultOperationTraits<VType> >
       
   110       ::SetHeap<BinHeap<VType, concepts::ReadWriteMap<Node,int> > >
       
   111       ::SetStandardHeap<BinHeap<VType, concepts::ReadWriteMap<Node,int> > >
       
   112       ::SetHeap<BinHeap<VType, concepts::ReadWriteMap<Node,int> >, 
       
   113                 concepts::ReadWriteMap<Node,int> >
       
   114       ::Create dijkstra_test(G,length);
       
   115 
       
   116     LengthMap length_map;
       
   117     concepts::ReadWriteMap<Node,Arc> pred_map;
       
   118     concepts::ReadWriteMap<Node,VType> dist_map;
       
   119     concepts::WriteMap<Node,bool> processed_map;
       
   120     concepts::ReadWriteMap<Node,int> heap_cross_ref;
       
   121     BinHeap<VType, concepts::ReadWriteMap<Node,int> > heap(heap_cross_ref);
       
   122     
       
   123     dijkstra_test
       
   124       .lengthMap(length_map)
       
   125       .predMap(pred_map)
       
   126       .distMap(dist_map)
       
   127       .processedMap(processed_map)
       
   128       .heap(heap, heap_cross_ref);
       
   129 
       
   130     dijkstra_test.run(s);
       
   131     dijkstra_test.run(s,t);
       
   132 
       
   133     dijkstra_test.addSource(s);
       
   134     dijkstra_test.addSource(s, 1);
       
   135     n = dijkstra_test.processNextNode();
       
   136     n = dijkstra_test.nextNode();
       
   137     b = dijkstra_test.emptyQueue();
       
   138     i = dijkstra_test.queueSize();
       
   139     
       
   140     dijkstra_test.start();
       
   141     dijkstra_test.start(t);
       
   142     dijkstra_test.start(nm);
    77 
   143 
    78     l  = dijkstra_test.dist(t);
   144     l  = dijkstra_test.dist(t);
    79     e  = dijkstra_test.predArc(t);
   145     e  = dijkstra_test.predArc(t);
    80     s  = dijkstra_test.predNode(t);
   146     s  = dijkstra_test.predNode(t);
    81     b  = dijkstra_test.reached(t);
   147     b  = dijkstra_test.reached(t);
    82     d  = dijkstra_test.distMap();
   148     b  = dijkstra_test.processed(t);
    83     p  = dijkstra_test.predMap();
       
    84     pp = dijkstra_test.path(t);
   149     pp = dijkstra_test.path(t);
    85   }
   150     l  = dijkstra_test.currentDist(t);
    86   {
       
    87     DType
       
    88       ::SetPredMap<concepts::ReadWriteMap<Node,Arc> >
       
    89       ::SetDistMap<concepts::ReadWriteMap<Node,VType> >
       
    90       ::SetProcessedMap<concepts::WriteMap<Node,bool> >
       
    91       ::SetStandardProcessedMap
       
    92       ::SetOperationTraits<DijkstraDefaultOperationTraits<VType> >
       
    93       ::SetHeap<BinHeap<VType, concepts::ReadWriteMap<Node,int> > >
       
    94       ::SetStandardHeap<BinHeap<VType, concepts::ReadWriteMap<Node,int> > >
       
    95       ::Create dijkstra_test(G,length);
       
    96 
       
    97     dijkstra_test.run(s);
       
    98     dijkstra_test.run(s,t);
       
    99 
       
   100     l  = dijkstra_test.dist(t);
       
   101     e  = dijkstra_test.predArc(t);
       
   102     s  = dijkstra_test.predNode(t);
       
   103     b  = dijkstra_test.reached(t);
       
   104     pp = dijkstra_test.path(t);
       
   105   }
   151   }
   106 
   152 
   107 }
   153 }
   108 
   154 
   109 void checkDijkstraFunctionCompile()
   155 void checkDijkstraFunctionCompile()