src/test/graph_utils_test.h
changeset 946 c94ef40a22ce
child 977 48962802d168
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/test/graph_utils_test.h	Wed Oct 27 22:38:50 2004 +0000
     1.3 @@ -0,0 +1,44 @@
     1.4 +/* -*- C++ -*-
     1.5 + * src/test/graph_utils_test.h - Part of LEMON, a generic C++ optimization library
     1.6 + *
     1.7 + * Copyright (C) 2004 Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
     1.8 + * (Egervary Combinatorial Optimization Research Group, EGRES).
     1.9 + *
    1.10 + * Permission to use, modify and distribute this software is granted
    1.11 + * provided that this copyright notice appears in all copies. For
    1.12 + * precise terms see the accompanying LICENSE file.
    1.13 + *
    1.14 + * This software is provided "AS IS" with no warranty of any kind,
    1.15 + * express or implied, and with no claim as to its suitability for any
    1.16 + * purpose.
    1.17 + *
    1.18 + */
    1.19 +#ifndef LEMON_TEST_GRAPH_UTILS_TEST_H
    1.20 +#define LEMON_TEST_GRAPH_UTILS_TEST_H
    1.21 +
    1.22 +
    1.23 +#include "test_tools.h"
    1.24 +
    1.25 +//! \ingroup misc
    1.26 +//! \file
    1.27 +//! \brief Test cases for graph utils.
    1.28 +namespace lemon {
    1.29 +  
    1.30 +  template <typename Graph>
    1.31 +  void checkGraphCounters() {
    1.32 +    const int num = 5;
    1.33 +    Graph graph;
    1.34 +    addPetersen(graph, num);
    1.35 +    bidirGraph(graph);
    1.36 +    check(countNodes(graph) == 2*num, "Wrong node counter.");
    1.37 +    check(countEdges(graph) == 6*num, "Wrong edge counter.");    
    1.38 +    for (typename Graph::NodeIt it(graph); it != INVALID; ++it) {
    1.39 +      check(countOutEdges(graph, it) == 3, "Wrong out degree counter.");
    1.40 +      check(countInEdges(graph, it) == 3, "Wrong in degree counter.");
    1.41 +    }
    1.42 +  }
    1.43 +  
    1.44 +} //namespace lemon
    1.45 +
    1.46 +
    1.47 +#endif