COIN-OR::LEMON - Graph Library

Changeset 2386:81b47fc5c444 in lemon-0.x for test


Ignore:
Timestamp:
03/02/07 19:04:28 (14 years ago)
Author:
Balazs Dezso
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@3217
Message:

Hard Warning checking

  • based on the remark of the ZIB user
  • we do not use -Winline
Location:
test
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • test/all_pairs_shortest_path_test.cc

    r2335 r2386  
    4949
    5050  const int n = argc > 1 ? atoi(argv[1]) : 20;
    51   const int e = argc > 2 ? atoi(argv[2]) : (int)(n * log((double)n));
     51  const int e = argc > 2 ? atoi(argv[2]) : int(n * log(double(n)));
    5252  const int m = argc > 3 ? atoi(argv[3]) : 100;
    5353
  • test/arborescence_test.cc

    r2242 r2386  
    2020using namespace std;
    2121
    22 const int n = 10;
    23 const int e = 22;
     22const int NODES = 10;
     23const int EDGES = 22;
    2424
    2525int sourceNode = 0;
    2626
    27 int sources[e] = {
     27int sources[EDGES] = {
    2828  1, 0, 2, 4, 4, 3, 9, 8, 9, 8,
    2929  4, 2, 0, 6, 4, 1, 7, 2, 8, 6,
     
    3131};
    3232
    33 int targets[e] = {
     33int targets[EDGES] = {
    3434  8, 3, 1, 1, 4, 9, 8, 1, 8, 0,
    3535  3, 2, 1, 3, 1, 1, 2, 6, 3, 9,
     
    3737};
    3838
    39 double costs[e] = {
     39double costs[EDGES] = {
    4040  107.444, 70.3069, 46.0496, 28.3962, 91.4325,
    4141  76.9443, 61.986, 39.3754, 74.9575, 39.3153,
     
    5757  vector<Node> nodes;
    5858 
    59   for (int i = 0; i < n; ++i) {
     59  for (int i = 0; i < NODES; ++i) {
    6060    nodes.push_back(graph.addNode());
    6161  }
    6262
    63   for (int i = 0; i < e; ++i) {
     63  for (int i = 0; i < EDGES; ++i) {
    6464    Edge edge = graph.addEdge(nodes[sources[i]], nodes[targets[i]]);
    6565    cost[edge] = costs[i];
     
    8686    if (mca.reached(graph.source(it))) {
    8787      double sum = 0.0;
    88       for (int i = 0; i < (int)dualSolution.size(); ++i) {
     88      for (int i = 0; i < int(dualSolution.size()); ++i) {
    8989        if (dualSolution[i].second.find(graph.target(it))
    9090            != dualSolution[i].second.end() &&
  • test/bipartite_matching_test.cc

    r2137 r2386  
    2020BPUGRAPH_TYPEDEFS(Graph);
    2121
    22 const int n = 10;
    23 const int m = 10;
    24 const int e = 52;
    25 const int c = 100;
    26 
    27 const int sa[e] = { 6, 5, 6, 4, 1, 0, 9, 5, 2, 4, 4, 3, 5,
     22const int N = 10;
     23const int M = 10;
     24const int E = 52;
     25const int C = 100;
     26
     27const int sa[E] = { 6, 5, 6, 4, 1, 0, 9, 5, 2, 4, 4, 3, 5,
    2828                    2, 3, 8, 3, 4, 9, 6, 9, 4, 3, 1, 5, 8,
    2929                    4, 8, 9, 2, 2, 3, 0, 5, 2, 3, 6, 3, 8,
    3030                    8, 4, 0, 9, 9, 6, 2, 1, 2, 7, 1, 9, 4};
    3131
    32 const int ta[e] = { 2, 7, 4, 8, 6, 3, 4, 1, 7, 7, 0, 1, 6,
     32const int ta[E] = { 2, 7, 4, 8, 6, 3, 4, 1, 7, 7, 0, 1, 6,
    3333                    3, 2, 6, 8, 3, 5, 6, 3, 1, 8, 7, 2, 0,
    3434                    6, 9, 6, 7, 8, 3, 3, 4, 5, 8, 6, 4, 1,
    3535                    4, 3, 3, 8, 7, 7, 3, 7, 7, 3, 5, 1, 6};
    3636
    37 const int wa[e] = { 3, 99, 85, 16, 79, 52, 83, 99, 62, 6, 42, 6, 95,
     37const int wa[E] = { 3, 99, 85, 16, 79, 52, 83, 99, 62, 6, 42, 6, 95,
    3838                    13, 34, 9, 5, 38, 39, 75, 99, 12, 73, 35, 93, 43,
    3939                    54, 91, 45, 26, 77, 47, 11, 22, 50, 74, 37, 64, 91,
     
    5353  int min_cost_matching;
    5454
    55   for (int i = 0; i < n; ++i) {
     55  for (int i = 0; i < N; ++i) {
    5656    Node node = graph.addANode();
    5757    aNodes.push_back(node);
    5858  }
    59   for (int i = 0; i < m; ++i) {
     59  for (int i = 0; i < M; ++i) {
    6060    Node node = graph.addBNode();
    6161    bNodes.push_back(node);
    6262  }
    63   for (int i = 0; i < e; ++i) {
     63  for (int i = 0; i < E; ++i) {
    6464    Node aNode = aNodes[sa[i]];
    6565    Node bNode = bNodes[ta[i]];
     
    289289
    290290  Graph::UEdgeMap<int> cost(graph);
    291   cost = subMap(constMap<UEdge>(c), weight);
     291  cost = subMap(constMap<UEdge>(C), weight);
    292292  {
    293293
     
    304304    min_cost_matching = bpmatch.matchingCost();
    305305    check(max_cardinality == bpmatch.matchingSize(), "WRONG SIZE");
    306     check(max_cardinality * c - max_cardinality_max_weight
     306    check(max_cardinality * C - max_cardinality_max_weight
    307307          == bpmatch.matchingCost(), "WRONG SIZE");
    308308
     
    327327    min_cost_matching = bpmatch.matchingCost();
    328328    check(max_cardinality == bpmatch.matchingSize(), "WRONG SIZE");
    329     check(max_cardinality * c - max_cardinality_max_weight
     329    check(max_cardinality * C - max_cardinality_max_weight
    330330          == bpmatch.matchingCost(), "WRONG SIZE");
    331331
  • test/lp_test.cc

    r2369 r2386  
    262262
    263263  if (stat ==  LpSolverBase::OPTIMAL) {
    264     std::ostringstream buf;
    265     buf << "Wrong optimal value: the right optimum is " << exp_opt;
    266     check(std::abs(lp.primalValue()-exp_opt) < 1e-3, buf.str());
     264    std::ostringstream sbuf;
     265    sbuf << "Wrong optimal value: the right optimum is " << exp_opt;
     266    check(std::abs(lp.primalValue()-exp_opt) < 1e-3, sbuf.str());
    267267    //+ecvt(exp_opt,2)
    268268  }
  • test/map_test.h

    r1956 r2386  
    4646    typedef typename Graph::template NodeMap<int> IntNodeMap;
    4747    IntNodeMap map(graph, 42);
    48     for (int i = 0; i < (int)nodes.size(); ++i) {
     48    for (int i = 0; i < int(nodes.size()); ++i) {
    4949      check(map[nodes[i]] == 42, "Wrong map constructor.");     
    5050    }
     
    5454    }
    5555    map = constMap<Node>(12);
    56     for (int i = 0; i < (int)nodes.size(); ++i) {
     56    for (int i = 0; i < int(nodes.size()); ++i) {
    5757      check(map[nodes[i]] == 12, "Wrong map constructor.");     
    5858    }   
     
    8484    IntEdgeMap map(graph, 42);
    8585   
    86     for (int i = 0; i < (int)edges.size(); ++i) {
     86    for (int i = 0; i < int(edges.size()); ++i) {
    8787      check(map[edges[i]] == 42, "Wrong map constructor.");     
    8888    }
     
    9595    }
    9696    map = constMap<Edge>(12);
    97     for (int i = 0; i < (int)edges.size(); ++i) {
     97    for (int i = 0; i < int(edges.size()); ++i) {
    9898      check(map[edges[i]] == 12, "Wrong map constructor.");     
    9999    }   
  • test/max_matching_test.cc

    r2116 r2386  
    7575    if ( mate[v]!=INVALID ) ++s;
    7676  }
    77   int size=(int)s/2;  //size will be used as the size of a maxmatching
     77  int size=int(s/2);  //size will be used as the size of a maxmatching
    7878
    7979  for(NodeIt v(g); v!=INVALID; ++v) {
     
    9393    if ( mate[v]!=INVALID ) ++s;
    9494  }
    95   check ( (int)s/2 == size, "The size does not equal!" );
     95  check ( int(s/2) == size, "The size does not equal!" );
    9696
    9797  Graph::NodeMap<MaxMatching<Graph>::pos_enum> pos1(g);
     
    104104    if ( mate[v]!=INVALID ) ++s;
    105105  }
    106   check ( (int)s/2 == size, "The size does not equal!" );
     106  check ( int(s/2) == size, "The size does not equal!" );
    107107 
    108108  Graph::NodeMap<MaxMatching<Graph>::pos_enum> pos2(g);
     
    116116    if ( mate[v]!=INVALID ) ++s;
    117117  }
    118   check ( (int)s/2 == size, "The size does not equal!" );
     118  check ( int(s/2) == size, "The size does not equal!" );
    119119 
    120120  Graph::NodeMap<MaxMatching<Graph>::pos_enum> pos(g);
     
    177177    if ( pos[v]==max_matching.A ) ++barrier;
    178178  }
    179   int expected_size=(int)( countNodes(g)-num_comp+barrier)/2;
     179  int expected_size=int( countNodes(g)-num_comp+barrier)/2;
    180180  check ( size==expected_size, "The size of the matching is wrong." );
    181181 
  • test/mip_test.cc

    r2369 r2386  
    3131
    3232  if (stat ==  MipSolverBase::OPTIMAL) {
    33     std::ostringstream buf;
     33    std::ostringstream sbuf;
    3434    buf << "Wrong optimal value: the right optimum is " << exp_opt;
    35     check(std::abs(lp.primalValue()-exp_opt) < 1e-3, buf.str());
     35    check(std::abs(lp.primalValue()-exp_opt) < 1e-3, sbuf.str());
    3636    //+ecvt(exp_opt,2)
    3737  }
  • test/radix_sort_test.cc

    r2242 r2386  
    3333using namespace lemon;
    3434
     35typedef unsigned char uchar;
     36
    3537void checkRadixSort() {
    3638  {
     
    4951    vector<unsigned char> data1(n), data2(n);
    5052    for (int i = 0; i < n; ++i) {
    51       data1[i] = data2[i] = rnd[(unsigned char)200];
     53      data1[i] = data2[i] = rnd[uchar(200)];
    5254    }
    5355    radixSort(data1.begin(), data1.end());
     
    7678    vector<unsigned char> data1(n), data2(n);
    7779    for (int i = 0; i < n; ++i) {
    78       data1[i] = data2[i] = rnd[(unsigned char)200];
     80      data1[i] = data2[i] = rnd[uchar(200)];
    7981    }
    8082    counterSort(data1.begin(), data1.end());
     
    9799
    98100  const int n = 100;
    99   const int e = (int)(n * log((double)n));
     101  const int e = int(n * log(double(n)));
    100102
    101103  Graph graph;
     
    118120  Graph::EdgeMap<bool> was(graph, false);
    119121
    120   for (int i = 0; i < (int)edges.size(); ++i) {
     122  for (int i = 0; i < int(edges.size()); ++i) {
    121123    check(!was[edges[i]], "Test failed");
    122124    was[edges[i]] = true;
    123125  }
    124126
    125   for (int i = 1; i < (int)edges.size(); ++i) {
     127  for (int i = 1; i < int(edges.size()); ++i) {
    126128    check(graph.id(graph.source(edges[i - 1])) <=
    127129          graph.id(graph.source(edges[i])), "Test failed");
     
    136138
    137139  const int n = 100;
    138   const int e = (int)(n * log((double)n));
     140  const int e = int(n * log(double(n)));
    139141
    140142  Graph graph;
     
    161163  Graph::EdgeMap<bool> was(graph, false);
    162164
    163   for (int i = 0; i < (int)edges.size(); ++i) {
     165  for (int i = 0; i < int(edges.size()); ++i) {
    164166    check(!was[edges[i]], "Test failed");
    165167    was[edges[i]] = true;
    166168  }
    167169
    168   for (int i = 1; i < (int)edges.size(); ++i) {
     170  for (int i = 1; i < int(edges.size()); ++i) {
    169171    check(graph.id(graph.target(edges[i - 1])) <
    170172          graph.id(graph.target(edges[i])) ||
Note: See TracChangeset for help on using the changeset viewer.