19 #include <lemon/bits/graph_extender.h> |
19 #include <lemon/bits/graph_extender.h> |
20 #include <lemon/concept/ugraph.h> |
20 #include <lemon/concept/ugraph.h> |
21 #include <lemon/list_graph.h> |
21 #include <lemon/list_graph.h> |
22 #include <lemon/smart_graph.h> |
22 #include <lemon/smart_graph.h> |
23 #include <lemon/full_graph.h> |
23 #include <lemon/full_graph.h> |
24 #include <lemon/grid_graph.h> |
24 #include <lemon/grid_ugraph.h> |
25 |
25 |
26 #include <lemon/graph_utils.h> |
26 #include <lemon/graph_utils.h> |
27 |
27 |
28 #include "test_tools.h" |
28 #include "test_tools.h" |
29 |
29 |
30 |
30 |
31 using namespace lemon; |
31 using namespace lemon; |
32 using namespace lemon::concept; |
32 using namespace lemon::concept; |
33 |
33 |
34 void check_concepts() { |
34 void check_concepts() { |
35 typedef UGraphExtender<ListGraphBase> ListUGraphBase; |
|
36 |
|
37 typedef IterableUGraphExtender< |
|
38 AlterableUGraphExtender<ListUGraphBase> > IterableListUGraph; |
|
39 |
|
40 typedef MappableUGraphExtender<IterableListUGraph> |
|
41 MappableListUGraph; |
|
42 |
|
43 typedef ErasableUGraphExtender< |
|
44 ClearableUGraphExtender< |
|
45 ExtendableUGraphExtender<MappableListUGraph> > > Graph; |
|
46 |
|
47 checkConcept<BaseIterableUGraphConcept, Graph>(); |
|
48 checkConcept<IterableUGraphConcept, Graph>(); |
|
49 checkConcept<MappableUGraphConcept, Graph>(); |
|
50 |
|
51 checkConcept<UGraph, Graph>(); |
|
52 checkConcept<ErasableUGraph, Graph>(); |
|
53 |
|
54 checkConcept<UGraph, ListUGraph>(); |
35 checkConcept<UGraph, ListUGraph>(); |
55 checkConcept<ErasableUGraph, ListUGraph>(); |
36 checkConcept<ErasableUGraph, ListUGraph>(); |
56 |
37 |
57 checkConcept<UGraph, SmartUGraph>(); |
38 checkConcept<UGraph, SmartUGraph>(); |
58 checkConcept<ExtendableUGraph, SmartUGraph>(); |
39 checkConcept<ExtendableUGraph, SmartUGraph>(); |
59 |
40 |
60 checkConcept<UGraph, FullUGraph>(); |
41 checkConcept<UGraph, FullUGraph>(); |
61 |
42 |
62 checkConcept<UGraph, UGraph>(); |
43 checkConcept<UGraph, UGraph>(); |
63 |
44 |
64 checkConcept<UGraph, GridGraph>(); |
45 checkConcept<UGraph, GridUGraph>(); |
65 } |
46 } |
66 |
47 |
67 template <typename Graph> |
48 template <typename Graph> |
68 void check_item_counts(Graph &g, int n, int e) { |
49 void check_item_counts(Graph &g, int n, int e) { |
69 int nn = 0; |
50 int nn = 0; |
148 // print_items(g); |
129 // print_items(g); |
149 |
130 |
150 check_item_counts(g,3,2); |
131 check_item_counts(g,3,2); |
151 } |
132 } |
152 |
133 |
153 void checkGridGraph(const GridGraph& g, int w, int h) { |
134 void checkGridUGraph(const GridUGraph& g, int w, int h) { |
154 check(g.width() == w, "Wrong width"); |
135 check(g.width() == w, "Wrong width"); |
155 check(g.height() == h, "Wrong height"); |
136 check(g.height() == h, "Wrong height"); |
156 |
137 |
157 for (int i = 0; i < w; ++i) { |
138 for (int i = 0; i < w; ++i) { |
158 for (int j = 0; j < h; ++j) { |
139 for (int j = 0; j < h; ++j) { |