1.1 --- a/src/test/undir_graph_test.cc Wed Jan 05 14:34:00 2005 +0000
1.2 +++ b/src/test/undir_graph_test.cc Wed Jan 05 16:59:50 2005 +0000
1.3 @@ -43,20 +43,19 @@
1.4 checkConcept<UndirGraph, UndirGraph>();
1.5 }
1.6
1.7 -typedef UndirListGraph Graph;
1.8 -typedef Graph::Node Node;
1.9 -typedef Graph::UndirEdge UEdge;
1.10 -typedef Graph::Edge Edge;
1.11 -typedef Graph::NodeIt NodeIt;
1.12 -typedef Graph::UndirEdgeIt UEdgeIt;
1.13 -typedef Graph::EdgeIt EdgeIt;
1.14 -
1.15 +template <typename Graph>
1.16 void check_item_counts(Graph &g, int n, int e) {
1.17 check(countNodes(g)==n, "Wrong node number.");
1.18 check(countEdges(g)==2*e, "Wrong edge number.");
1.19 }
1.20
1.21 +template <typename Graph>
1.22 void print_items(Graph &g) {
1.23 +
1.24 + typedef typename Graph::NodeIt NodeIt;
1.25 + typedef typename Graph::UndirEdgeIt UEdgeIt;
1.26 + typedef typename Graph::EdgeIt EdgeIt;
1.27 +
1.28 cout << "Nodes" << endl;
1.29 int i=0;
1.30 for(NodeIt it(g); it!=INVALID; ++it, ++i) {
1.31 @@ -81,9 +80,15 @@
1.32
1.33 }
1.34
1.35 -int main() {
1.36 - check_concepts();
1.37 +template <typename Graph>
1.38 +void check_graph() {
1.39
1.40 + typedef typename Graph::Node Node;
1.41 + typedef typename Graph::UndirEdge UEdge;
1.42 + typedef typename Graph::Edge Edge;
1.43 + typedef typename Graph::NodeIt NodeIt;
1.44 + typedef typename Graph::UndirEdgeIt UEdgeIt;
1.45 + typedef typename Graph::EdgeIt EdgeIt;
1.46
1.47 Graph g;
1.48
1.49 @@ -102,5 +107,14 @@
1.50
1.51 check_item_counts(g,3,2);
1.52
1.53 +
1.54 +}
1.55 +
1.56 +int main() {
1.57 + check_concepts();
1.58 +
1.59 + check_graph<UndirListGraph>();
1.60 + check_graph<UndirSmartGraph>();
1.61 +
1.62 return 0;
1.63 }