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