klao@946
|
1 |
/* -*- C++ -*-
|
klao@946
|
2 |
* src/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
|
klao@946
|
5 |
* (Egervary Combinatorial Optimization Research Group, 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
|