COIN-OR::LEMON - Graph Library

source: lemon-0.x/src/test/graph_test.h @ 942:75fdd0c6866d

Last change on this file since 942:75fdd0c6866d was 938:70e2886211d5, checked in by Alpar Juttner, 20 years ago

Many of ckeckCompileXYZ()'s are now in the corresponding skeleton headers.
(Tests for Symmetric Graphs are still to be moved)

File size: 2.1 KB
RevLine 
[906]1/* -*- C++ -*-
[921]2 * src/test/graph_test.h - Part of LEMON, a generic C++ optimization library
[906]3 *
4 * Copyright (C) 2004 Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
5 * (Egervary Combinatorial Optimization Research Group, EGRES).
6 *
7 * Permission to use, modify and distribute this software is granted
8 * provided that this copyright notice appears in all copies. For
9 * precise terms see the accompanying LICENSE file.
10 *
11 * This software is provided "AS IS" with no warranty of any kind,
12 * express or implied, and with no claim as to its suitability for any
13 * purpose.
14 *
15 */
[921]16#ifndef LEMON_TEST_GRAPH_TEST_H
17#define LEMON_TEST_GRAPH_TEST_H
[800]18
19
20#include "test_tools.h"
21
22//! \ingroup misc
23//! \file
24//! \brief Some utility to  test graph classes.
[921]25namespace lemon {
[800]26
[891]27  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.");
35    }
[800]36
[891]37  template<class Graph> void checkGraphEdgeList(Graph &G, int nn)
38    {
39      typedef typename Graph::EdgeIt EdgeIt;
[800]40
[891]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.");
47    }
[800]48
[891]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.");
[937]56        check(n==G.tail(e), "Wrong OutEdge list linking.");
[891]57        ++e;
58      }
59      check(e==INVALID,"Wrong OutEdge list linking.");
60    }
[800]61
[891]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.");
[937]69        check(n==G.head(e), "Wrong InEdge list linking.");
[891]70        ++e;
71      }
72      check(e==INVALID,"Wrong InEdge list linking.");
73    }
[800]74
[891]75  ///\file
76  ///\todo Check head(), tail() as well;
[800]77
78 
[921]79} //namespace lemon
[800]80
81
82#endif
Note: See TracBrowser for help on using the repository browser.