test/graph_utils_test.h
author athos
Thu, 07 Jul 2005 09:04:39 +0000
changeset 1541 305ce06287c9
parent 1359 1581f961cfaa
child 1568 f694f75de683
permissions -rw-r--r--
Decided not to \include the sample.lgf in the quicktour: so it can be bigger.
klao@946
     1
/* -*- C++ -*-
ladanyi@1435
     2
 * test/graph_utils_test.h - Part of LEMON, a generic C++ optimization library
klao@946
     3
 *
alpar@1164
     4
 * Copyright (C) 2005 Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
alpar@1359
     5
 * (Egervary Research Group on Combinatorial Optimization, EGRES).
klao@946
     6
 *
klao@946
     7
 * Permission to use, modify and distribute this software is granted
klao@946
     8
 * provided that this copyright notice appears in all copies. For
klao@946
     9
 * precise terms see the accompanying LICENSE file.
klao@946
    10
 *
klao@946
    11
 * This software is provided "AS IS" with no warranty of any kind,
klao@946
    12
 * express or implied, and with no claim as to its suitability for any
klao@946
    13
 * purpose.
klao@946
    14
 *
klao@946
    15
 */
klao@946
    16
#ifndef LEMON_TEST_GRAPH_UTILS_TEST_H
klao@946
    17
#define LEMON_TEST_GRAPH_UTILS_TEST_H
klao@946
    18
klao@946
    19
klao@946
    20
#include "test_tools.h"
klao@946
    21
klao@946
    22
//! \ingroup misc
klao@946
    23
//! \file
klao@946
    24
//! \brief Test cases for graph utils.
klao@946
    25
namespace lemon {
klao@946
    26
  
klao@946
    27
  template <typename Graph>
klao@946
    28
  void checkGraphCounters() {
klao@946
    29
    const int num = 5;
klao@946
    30
    Graph graph;
klao@946
    31
    addPetersen(graph, num);
klao@946
    32
    bidirGraph(graph);
klao@977
    33
    check(countNodes(graph) == 2*num, "Wrong node number.");
klao@977
    34
    check(countEdges(graph) == 6*num, "Wrong edge number.");    
klao@946
    35
    for (typename Graph::NodeIt it(graph); it != INVALID; ++it) {
klao@977
    36
      check(countOutEdges(graph, it) == 3, "Wrong out degree number.");
klao@977
    37
      check(countInEdges(graph, it) == 3, "Wrong in degree number.");
klao@946
    38
    }
klao@946
    39
  }
klao@946
    40
  
klao@946
    41
} //namespace lemon
klao@946
    42
klao@946
    43
klao@946
    44
#endif