COIN-OR::LEMON - Graph Library

Ticket #263: f134d3e99740.patch

File f134d3e99740.patch, 5.3 KB (added by Peter Kovacs, 15 years ago)
  • test/bfs_test.cc

    # HG changeset patch
    # User Peter Kovacs <kpeter@inf.elte.hu>
    # Date 1239754320 -7200
    # Node ID f134d3e99740ae0509196607dd5f985be6738414
    # Parent  99a31b399b599c78cc46644de96c74b5a031d71f
    Better tests for query functions (#263)
    
    diff --git a/test/bfs_test.cc b/test/bfs_test.cc
    a b  
    6868
    6969  {
    7070    BType bfs_test(G);
     71    const BType& const_bfs_test = bfs_test;
    7172
    7273    bfs_test.run(s);
    7374    bfs_test.run(s,t);
    7475    bfs_test.run();
    7576
    76     l  = bfs_test.dist(t);
    77     e  = bfs_test.predArc(t);
    78     s  = bfs_test.predNode(t);
    79     b  = bfs_test.reached(t);
    80     d  = bfs_test.distMap();
    81     p  = bfs_test.predMap();
    82     pp = bfs_test.path(t);
     77    l  = const_bfs_test.dist(t);
     78    e  = const_bfs_test.predArc(t);
     79    s  = const_bfs_test.predNode(t);
     80    b  = const_bfs_test.reached(t);
     81    d  = const_bfs_test.distMap();
     82    p  = const_bfs_test.predMap();
     83    pp = const_bfs_test.path(t);
    8384  }
    8485  {
    8586    BType
  • test/circulation_test.cc

    diff --git a/test/circulation_test.cc b/test/circulation_test.cc
    a b  
    7171  DeltaMap delta;
    7272  FlowMap flow;
    7373  BarrierMap bar;
     74  VType v;
     75  bool b;
    7476
    75   Circulation<Digraph, CapMap, CapMap, DeltaMap>
    76     ::SetFlowMap<FlowMap>
    77     ::SetElevator<Elev>
    78     ::SetStandardElevator<LinkedElev>
    79     ::Create circ_test(g,lcap,ucap,delta);
    80 
    81   circ_test.lowerCapMap(lcap);
    82   circ_test.upperCapMap(ucap);
    83   circ_test.deltaMap(delta);
    84   flow = circ_test.flowMap();
    85   circ_test.flowMap(flow);
     77  typedef Circulation<Digraph, CapMap, CapMap, DeltaMap>
     78            ::SetFlowMap<FlowMap>
     79            ::SetElevator<Elev>
     80            ::SetStandardElevator<LinkedElev>
     81            ::Create CirculationType;
     82  CirculationType circ_test(g, lcap, ucap, delta);
     83  const CirculationType& const_circ_test = circ_test;
     84   
     85  circ_test
     86    .lowerCapMap(lcap)
     87    .upperCapMap(ucap)
     88    .deltaMap(delta)
     89    .flowMap(flow);
    8690
    8791  circ_test.init();
    8892  circ_test.greedyInit();
    8993  circ_test.start();
    9094  circ_test.run();
    9195
    92   circ_test.barrier(n);
    93   circ_test.barrierMap(bar);
    94   circ_test.flow(a);
     96  v = const_circ_test.flow(a);
     97  const FlowMap& fm = const_circ_test.flowMap();
     98  b = const_circ_test.barrier(n);
     99  const_circ_test.barrierMap(bar);
     100 
     101  ignore_unused_variable_warning(fm);
    95102}
    96103
    97104template <class G, class LM, class UM, class DM>
  • test/dfs_test.cc

    diff --git a/test/dfs_test.cc b/test/dfs_test.cc
    a b  
    7070
    7171  {
    7272    DType dfs_test(G);
     73    const DType& const_dfs_test = dfs_test;
    7374
    7475    dfs_test.run(s);
    7576    dfs_test.run(s,t);
    7677    dfs_test.run();
    7778
    78     l  = dfs_test.dist(t);
    79     e  = dfs_test.predArc(t);
    80     s  = dfs_test.predNode(t);
    81     b  = dfs_test.reached(t);
    82     d  = dfs_test.distMap();
    83     p  = dfs_test.predMap();
    84     pp = dfs_test.path(t);
     79    l  = const_dfs_test.dist(t);
     80    e  = const_dfs_test.predArc(t);
     81    s  = const_dfs_test.predNode(t);
     82    b  = const_dfs_test.reached(t);
     83    d  = const_dfs_test.distMap();
     84    p  = const_dfs_test.predMap();
     85    pp = const_dfs_test.path(t);
    8586  }
    8687  {
    8788    DType
  • test/dijkstra_test.cc

    diff --git a/test/dijkstra_test.cc b/test/dijkstra_test.cc
    a b  
    7171
    7272  {
    7373    DType dijkstra_test(G,length);
     74    const DType& const_dijkstra_test = dijkstra_test;
    7475
    7576    dijkstra_test.run(s);
    7677    dijkstra_test.run(s,t);
    7778
    78     l  = dijkstra_test.dist(t);
    79     e  = dijkstra_test.predArc(t);
    80     s  = dijkstra_test.predNode(t);
    81     b  = dijkstra_test.reached(t);
    82     d  = dijkstra_test.distMap();
    83     p  = dijkstra_test.predMap();
    84     pp = dijkstra_test.path(t);
     79    l  = const_dijkstra_test.dist(t);
     80    e  = const_dijkstra_test.predArc(t);
     81    s  = const_dijkstra_test.predNode(t);
     82    b  = const_dijkstra_test.reached(t);
     83    d  = const_dijkstra_test.distMap();
     84    p  = const_dijkstra_test.predMap();
     85    pp = const_dijkstra_test.path(t);
    8586  }
    8687  {
    8788    DType
  • test/preflow_test.cc

    diff --git a/test/preflow_test.cc b/test/preflow_test.cc
    a b  
    8484  CapMap cap;
    8585  FlowMap flow;
    8686  CutMap cut;
     87  VType v;
     88  bool b;
    8789
    88   Preflow<Digraph, CapMap>
    89     ::SetFlowMap<FlowMap>
    90     ::SetElevator<Elev>
    91     ::SetStandardElevator<LinkedElev>
    92     ::Create preflow_test(g,cap,n,n);
     90  typedef Preflow<Digraph, CapMap>
     91            ::SetFlowMap<FlowMap>
     92            ::SetElevator<Elev>
     93            ::SetStandardElevator<LinkedElev>
     94            ::Create PreflowType;
     95  PreflowType preflow_test(g, cap, n, n);
     96  const PreflowType& const_preflow_test = preflow_test;
    9397
    94   preflow_test.capacityMap(cap);
    95   flow = preflow_test.flowMap();
    96   preflow_test.flowMap(flow);
    97   preflow_test.source(n);
    98   preflow_test.target(n);
     98  preflow_test
     99    .capacityMap(cap)
     100    .flowMap(flow)
     101    .source(n)
     102    .target(n);
    99103
    100104  preflow_test.init();
    101105  preflow_test.init(cap);
     
    104108  preflow_test.run();
    105109  preflow_test.runMinCut();
    106110
    107   preflow_test.flowValue();
    108   preflow_test.minCut(n);
    109   preflow_test.minCutMap(cut);
    110   preflow_test.flow(e);
    111 
     111  v = const_preflow_test.flowValue();
     112  v = const_preflow_test.flow(e);
     113  const FlowMap& fm = const_preflow_test.flowMap();
     114  b = const_preflow_test.minCut(n);
     115  const_preflow_test.minCutMap(cut);
     116 
     117  ignore_unused_variable_warning(fm);
    112118}
    113119
    114120int cutValue (const SmartDigraph& g,