COIN-OR::LEMON - Graph Library

Changeset 1728:eb8bb91ba9e2 in lemon-0.x for test/graph_utils_test.cc


Ignore:
Timestamp:
10/14/05 13:03:40 (15 years ago)
Author:
Balazs Dezso
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@2255
Message:

Updating tests

File:
1 edited

Legend:

Unmodified
Added
Removed
  • test/graph_utils_test.cc

    r1568 r1728  
    7878  checkSnapDeg<SmartGraph>();
    7979 
     80  {
     81    const int nodeNum = 10;
     82    const int edgeNum = 100;
     83    ListGraph graph;
     84    InDegMap<ListGraph> inDeg(graph);
     85    std::vector<ListGraph::Node> nodes(nodeNum);
     86    for (int i = 0; i < nodeNum; ++i) {
     87      nodes[i] = graph.addNode();
     88    }
     89    std::vector<ListGraph::Edge> edges(edgeNum);
     90    for (int i = 0; i < edgeNum; ++i) {
     91      edges[i] =
     92        graph.addEdge(nodes[urandom(nodeNum)], nodes[urandom(nodeNum)]);
     93    }
     94    for (int i = 0; i < nodeNum; ++i) {
     95      check(inDeg[nodes[i]] == countInEdges(graph, nodes[i]),
     96            "Wrong in degree map");
     97    }
     98    for (int i = 0; i < edgeNum; ++i) {
     99      graph.changeTarget(edges[i], nodes[urandom(nodeNum)]);
     100    }
     101    for (int i = 0; i < nodeNum; ++i) {
     102      check(inDeg[nodes[i]] == countInEdges(graph, nodes[i]),
     103            "Wrong in degree map");
     104    }
     105    for (int i = 0; i < edgeNum; ++i) {
     106      graph.changeSource(edges[i], nodes[urandom(nodeNum)]);
     107    }
     108    for (int i = 0; i < nodeNum; ++i) {
     109      check(inDeg[nodes[i]] == countInEdges(graph, nodes[i]),
     110            "Wrong in degree map");
     111    }
     112    for (int i = 0; i < edgeNum; ++i) {
     113      graph.reverseEdge(edges[i]);
     114    }
     115    for (int i = 0; i < nodeNum; ++i) {
     116      check(inDeg[nodes[i]] == countInEdges(graph, nodes[i]),
     117            "Wrong in degree map");
     118    }
     119  }
    80120
    81121  ///Everything is OK
Note: See TracChangeset for help on using the changeset viewer.