Documentation improvments.
2 * src/test/map_test.h - Part of LEMON, a generic C++ optimization library
4 * Copyright (C) 2005 Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
5 * (Egervary Combinatorial Optimization Research Group, EGRES).
7 * Permission to use, modify and distribute this software is granted
8 * provided that this copyright notice appears in all copies. For
9 * precise terms see the accompanying LICENSE file.
11 * This software is provided "AS IS" with no warranty of any kind,
12 * express or implied, and with no claim as to its suitability for any
16 #ifndef LEMON_TEST_MAP_TEST_H
17 #define LEMON_TEST_MAP_TEST_H
22 #include "test_tools.h"
27 //! \brief Some utilities to test map classes.
32 template <typename Graph>
33 void checkGraphNodeMap() {
37 typedef typename Graph::Node Node;
39 std::vector<Node> nodes;
40 for (int i = 0; i < num; ++i) {
41 nodes.push_back(graph.addNode());
43 typedef typename Graph::template NodeMap<int> IntNodeMap;
44 IntNodeMap map(graph, 42);
45 for (int i = 0; i < (int)nodes.size(); ++i) {
46 check(map[nodes[i]] == 42, "Wrong map constructor.");
48 for (int i = 0; i < num; ++i) {
49 nodes.push_back(graph.addNode());
50 map[nodes.back()] = 23;
56 template <typename Graph>
57 void checkGraphEdgeMap() {
61 typedef typename Graph::Node Node;
62 typedef typename Graph::Edge Edge;
64 std::vector<Node> nodes;
65 for (int i = 0; i < num; ++i) {
66 nodes.push_back(graph.addNode());
69 std::vector<Edge> edges;
70 for (int i = 0; i < num; ++i) {
71 for (int j = 0; j < i; ++j) {
72 edges.push_back(graph.addEdge(nodes[i], nodes[j]));
76 typedef typename Graph::template EdgeMap<int> IntEdgeMap;
77 IntEdgeMap map(graph, 42);
79 for (int i = 0; i < (int)edges.size(); ++i) {
80 check(map[edges[i]] == 42, "Wrong map constructor.");
83 for (int i = 0; i < num; ++i) {
84 for (int j = i + 1; j < num; ++j) {
85 edges.push_back(graph.addEdge(nodes[i], nodes[j]));
86 map[edges.back()] = 23;