COIN-OR::LEMON - Graph Library

Changeset 946:c94ef40a22ce in lemon-0.x for src/test/graph_test.h


Ignore:
Timestamp:
10/28/04 00:38:50 (20 years ago)
Author:
Mihaly Barasz
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@1322
Message:

The graph_factory branch (@ 1321) has been merged to trunk.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/test/graph_test.h

    r938 r946  
    2222//! \ingroup misc
    2323//! \file
    24 //! \brief Some utility to test graph classes.
     24//! \brief Some utility and test cases to test graph classes.
    2525namespace lemon {
    2626
    2727  template<class Graph> void checkGraphNodeList(Graph &G, int nn)
    28     {
    29       typename Graph::NodeIt n(G);
    30       for(int i=0;i<nn;i++) {
    31         check(n!=INVALID,"Wrong Node list linking.");
    32         ++n;
    33       }
    34       check(n==INVALID,"Wrong Node list linking.");
     28  {
     29    typename Graph::NodeIt n(G);
     30    for(int i=0;i<nn;i++) {
     31      check(n!=INVALID,"Wrong Node list linking.");
     32      ++n;
    3533    }
     34    check(n==INVALID,"Wrong Node list linking.");
     35  }
    3636
    37   template<class Graph> void checkGraphEdgeList(Graph &G, int nn)
    38     {
    39       typedef typename Graph::EdgeIt EdgeIt;
     37  template<class Graph>
     38  void checkGraphEdgeList(Graph &G, int nn)
     39  {
     40    typedef typename Graph::EdgeIt EdgeIt;
    4041
    41       EdgeIt e(G);
    42       for(int i=0;i<nn;i++) {
    43         check(e!=INVALID,"Wrong Edge list linking.");
    44         ++e;
    45       }
    46       check(e==INVALID,"Wrong Edge list linking.");
     42    EdgeIt e(G);
     43    for(int i=0;i<nn;i++) {
     44      check(e!=INVALID,"Wrong Edge list linking.");
     45      ++e;
    4746    }
     47    check(e==INVALID,"Wrong Edge list linking.");
     48  }
    4849
    49   template<class Graph> void checkGraphOutEdgeList(Graph &G,
    50                                                    typename Graph::Node n,
    51                                                    int nn)
    52     {
    53       typename Graph::OutEdgeIt e(G,n);
    54       for(int i=0;i<nn;i++) {
    55         check(e!=INVALID,"Wrong OutEdge list linking.");
    56         check(n==G.tail(e), "Wrong OutEdge list linking.");
    57         ++e;
    58       }
    59       check(e==INVALID,"Wrong OutEdge list linking.");
     50  template<class Graph>
     51  void checkGraphOutEdgeList(Graph &G, typename Graph::Node n, int nn)
     52  {
     53    typename Graph::OutEdgeIt e(G,n);
     54    for(int i=0;i<nn;i++) {
     55      check(e!=INVALID,"Wrong OutEdge list linking.");
     56      check(n==G.tail(e), "Wrong OutEdge list linking.");
     57      ++e;
    6058    }
     59    check(e==INVALID,"Wrong OutEdge list linking.");
     60  }
    6161
    62   template<class Graph> void checkGraphInEdgeList(Graph &G,
    63                                                   typename Graph::Node n,
    64                                                   int nn)
    65     {
    66       typename Graph::InEdgeIt e(G,n);
    67       for(int i=0;i<nn;i++) {
    68         check(e!=INVALID,"Wrong InEdge list linking.");
    69         check(n==G.head(e), "Wrong InEdge list linking.");
    70         ++e;
    71       }
    72       check(e==INVALID,"Wrong InEdge list linking.");
     62  template<class Graph> void
     63  checkGraphInEdgeList(Graph &G, typename Graph::Node n, int nn)
     64  {
     65    typename Graph::InEdgeIt e(G,n);
     66    for(int i=0;i<nn;i++) {
     67      check(e!=INVALID,"Wrong InEdge list linking.");
     68      check(n==G.head(e), "Wrong InEdge list linking.");
     69      ++e;
    7370    }
     71    check(e==INVALID,"Wrong InEdge list linking.");
     72  }
     73
     74  template <class Graph>
     75  void checkGraph() {
     76    const int num = 5;
     77    Graph G;
     78    addPetersen(G, num);
     79    bidirGraph(G);
     80    checkBidirPetersen(G, num);
     81  }
    7482
    7583  ///\file
Note: See TracChangeset for help on using the changeset viewer.