COIN-OR::LEMON - Graph Library

Changeset 1732:edeee3cbd80c in lemon-0.x for test


Ignore:
Timestamp:
10/21/05 10:34:47 (14 years ago)
Author:
Balazs Dezso
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@2259
Message:

Bugfix

File:
1 edited

Legend:

Unmodified
Added
Removed
  • test/all_pairs_shortest_path_test.cc

    r1711 r1732  
    1111
    1212#include <lemon/time_measure.h>
     13#include "test_tools.h"
    1314
    1415using namespace lemon;
     
    2728
    2829  const int n = argc > 1 ? atoi(argv[1]) : 20;
    29   const int e = argc > 2 ? atoi(argv[2]) : (int)(n * log(n));
     30  const int e = argc > 2 ? atoi(argv[2]) : (int)(n * log((double)n));
    3031  const double m = argc > 3 ? (double)atoi(argv[3]) : 100.0;
    3132
     
    6566  for (NodeIt it(graph); it != INVALID; ++it) {
    6667    for (NodeIt jt(graph); jt != INVALID; ++jt) {
    67       assert(johnson.connected(it, jt) == floyd.connected(it, jt));
     68      check(johnson.connected(it, jt) == floyd.connected(it, jt),
     69            "Wrong connection in all pairs shortest path");
    6870      if (johnson.connected(it, jt)) {
    69         assert(johnson.dist(it, jt) == floyd.dist(it, jt));
     71        check(johnson.dist(it, jt) == floyd.dist(it, jt),
     72              "Wrong distance in all pairs shortest path");
    7073        if (it != jt) {
    71           assert(johnson.dist(it, jt) ==
    72                  johnson.dist(it, johnson.predNode(it, jt)) +
    73                  length[johnson.pred(it, jt)]);
    74           assert(floyd.dist(it, jt) ==
    75                  floyd.dist(it, floyd.predNode(it, jt)) +
    76                  length[floyd.pred(it, jt)]);
     74          check(johnson.dist(it, jt) ==
     75                johnson.dist(it, johnson.predNode(it, jt)) +
     76                length[johnson.pred(it, jt)],
     77                "Wrong edge in all pairs shortest path");
     78          check(floyd.dist(it, jt) ==
     79                floyd.dist(it, floyd.predNode(it, jt)) +
     80                length[floyd.pred(it, jt)],
     81                "Wrong edge in all pairs shortest path");
    7782        }
    7883      }
Note: See TracChangeset for help on using the changeset viewer.