deba@937
|
1 |
/* -*- C++ -*-
|
deba@937
|
2 |
* src/test/sym_graph_test.cc - Part of LEMON, a generic C++ optimization library
|
deba@937
|
3 |
*
|
deba@937
|
4 |
* Copyright (C) 2004 Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
|
deba@937
|
5 |
* (Egervary Combinatorial Optimization Research Group, EGRES).
|
deba@937
|
6 |
*
|
deba@937
|
7 |
* Permission to use, modify and distribute this software is granted
|
deba@937
|
8 |
* provided that this copyright notice appears in all copies. For
|
deba@937
|
9 |
* precise terms see the accompanying LICENSE file.
|
deba@937
|
10 |
*
|
deba@937
|
11 |
* This software is provided "AS IS" with no warranty of any kind,
|
deba@937
|
12 |
* express or implied, and with no claim as to its suitability for any
|
deba@937
|
13 |
* purpose.
|
deba@937
|
14 |
*
|
deba@937
|
15 |
*/
|
deba@937
|
16 |
|
deba@937
|
17 |
#include<iostream>
|
deba@937
|
18 |
|
deba@937
|
19 |
#include<lemon/skeletons/sym_graph.h>
|
deba@937
|
20 |
|
deba@937
|
21 |
#include<lemon/list_graph.h>
|
deba@937
|
22 |
#include<lemon/smart_graph.h>
|
deba@937
|
23 |
#include<lemon/full_graph.h>
|
deba@937
|
24 |
|
deba@937
|
25 |
#include"test_tools.h"
|
deba@937
|
26 |
#include"graph_test.h"
|
deba@937
|
27 |
#include"sym_graph_test.h"
|
deba@937
|
28 |
|
deba@937
|
29 |
/**
|
deba@937
|
30 |
\file
|
deba@937
|
31 |
This test makes consistency checks of list graph structures.
|
deba@937
|
32 |
|
deba@937
|
33 |
G.addNode(), G.addEdge(), G.tail(), G.head()
|
deba@937
|
34 |
|
deba@937
|
35 |
\todo Checks for empty graphs and isolated points.
|
deba@937
|
36 |
conversion.
|
deba@937
|
37 |
*/
|
deba@937
|
38 |
|
deba@937
|
39 |
using namespace lemon;
|
deba@937
|
40 |
|
deba@937
|
41 |
template<class Graph> void checkPetersen(Graph &G)
|
deba@937
|
42 |
{
|
deba@937
|
43 |
typedef typename Graph::NodeIt NodeIt;
|
deba@937
|
44 |
|
deba@937
|
45 |
|
deba@937
|
46 |
checkGraphNodeList(G,10);
|
deba@937
|
47 |
checkGraphEdgeList(G,30);
|
deba@937
|
48 |
checkGraphSymEdgeList(G,15);
|
deba@937
|
49 |
|
deba@937
|
50 |
for(NodeIt n(G);n!=INVALID;++n) {
|
deba@937
|
51 |
checkGraphInEdgeList(G,n,3);
|
deba@937
|
52 |
checkGraphOutEdgeList(G,n,3);
|
deba@937
|
53 |
}
|
deba@937
|
54 |
}
|
deba@937
|
55 |
|
deba@937
|
56 |
//Compile Graph
|
deba@937
|
57 |
template void lemon::checkCompileStaticSymGraph<skeleton::StaticSymGraph>
|
deba@937
|
58 |
(skeleton::StaticSymGraph &);
|
deba@937
|
59 |
|
deba@937
|
60 |
template void lemon::checkCompileSymGraph<skeleton::ExtendableSymGraph>
|
deba@937
|
61 |
(skeleton::ExtendableSymGraph &);
|
deba@937
|
62 |
|
deba@937
|
63 |
template void lemon::checkCompileErasableSymGraph<skeleton::ErasableSymGraph>
|
deba@937
|
64 |
(skeleton::ErasableSymGraph &);
|
deba@937
|
65 |
|
deba@937
|
66 |
|
deba@937
|
67 |
//Compile SymSmartGraph
|
deba@937
|
68 |
template void lemon::checkCompileSymGraph<SymSmartGraph>(SymSmartGraph &);
|
deba@937
|
69 |
template void lemon::checkCompileGraphFindEdge<SymSmartGraph>(SymSmartGraph &);
|
deba@937
|
70 |
|
deba@937
|
71 |
//Compile SymListGraph
|
deba@937
|
72 |
template void lemon::checkCompileSymGraph<SymListGraph>(SymListGraph &);
|
deba@937
|
73 |
template void lemon::checkCompileErasableSymGraph<SymListGraph>(SymListGraph &);
|
deba@937
|
74 |
template void lemon::checkCompileGraphFindEdge<SymListGraph>(SymListGraph &);
|
deba@937
|
75 |
|
deba@937
|
76 |
int main()
|
deba@937
|
77 |
{
|
deba@937
|
78 |
{
|
deba@937
|
79 |
SymSmartGraph G;
|
deba@937
|
80 |
addSymPetersen(G);
|
deba@937
|
81 |
checkPetersen(G);
|
deba@937
|
82 |
}
|
deba@937
|
83 |
{
|
deba@937
|
84 |
SymListGraph G;
|
deba@937
|
85 |
addSymPetersen(G);
|
deba@937
|
86 |
checkPetersen(G);
|
deba@937
|
87 |
}
|
deba@937
|
88 |
|
deba@937
|
89 |
///\file
|
deba@937
|
90 |
///\todo map tests.
|
deba@937
|
91 |
///\todo copy constr tests.
|
deba@937
|
92 |
|
deba@937
|
93 |
std::cout << __FILE__ ": All tests passed.\n";
|
deba@937
|
94 |
|
deba@937
|
95 |
return 0;
|
deba@937
|
96 |
}
|