1.1 --- a/test/graph_maps_test.h Fri Jul 18 17:26:12 2008 +0100
1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1.3 @@ -1,144 +0,0 @@
1.4 -/* -*- mode: C++; indent-tabs-mode: nil; -*-
1.5 - *
1.6 - * This file is a part of LEMON, a generic C++ optimization library.
1.7 - *
1.8 - * Copyright (C) 2003-2008
1.9 - * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
1.10 - * (Egervary Research Group on Combinatorial Optimization, EGRES).
1.11 - *
1.12 - * Permission to use, modify and distribute this software is granted
1.13 - * provided that this copyright notice appears in all copies. For
1.14 - * precise terms see the accompanying LICENSE file.
1.15 - *
1.16 - * This software is provided "AS IS" with no warranty of any kind,
1.17 - * express or implied, and with no claim as to its suitability for any
1.18 - * purpose.
1.19 - *
1.20 - */
1.21 -
1.22 -#ifndef LEMON_TEST_MAP_TEST_H
1.23 -#define LEMON_TEST_MAP_TEST_H
1.24 -
1.25 -#include <vector>
1.26 -#include <lemon/maps.h>
1.27 -
1.28 -#include "test_tools.h"
1.29 -
1.30 -namespace lemon {
1.31 -
1.32 - template <typename Graph>
1.33 - void checkGraphNodeMap() {
1.34 - Graph graph;
1.35 - const int num = 16;
1.36 -
1.37 - typedef typename Graph::Node Node;
1.38 -
1.39 - std::vector<Node> nodes;
1.40 - for (int i = 0; i < num; ++i) {
1.41 - nodes.push_back(graph.addNode());
1.42 - }
1.43 - typedef typename Graph::template NodeMap<int> IntNodeMap;
1.44 - IntNodeMap map(graph, 42);
1.45 - for (int i = 0; i < int(nodes.size()); ++i) {
1.46 - check(map[nodes[i]] == 42, "Wrong map constructor.");
1.47 - }
1.48 - for (int i = 0; i < num; ++i) {
1.49 - nodes.push_back(graph.addNode());
1.50 - map[nodes.back()] = 23;
1.51 - check(map[nodes.back()] == 23, "Wrong operator[].");
1.52 - }
1.53 - map = constMap<Node>(12);
1.54 - for (int i = 0; i < int(nodes.size()); ++i) {
1.55 - check(map[nodes[i]] == 12, "Wrong map constructor.");
1.56 - }
1.57 - graph.clear();
1.58 - nodes.clear();
1.59 - }
1.60 -
1.61 - template <typename Graph>
1.62 - void checkGraphArcMap() {
1.63 - Graph graph;
1.64 - const int num = 16;
1.65 -
1.66 - typedef typename Graph::Node Node;
1.67 - typedef typename Graph::Arc Arc;
1.68 -
1.69 - std::vector<Node> nodes;
1.70 - for (int i = 0; i < num; ++i) {
1.71 - nodes.push_back(graph.addNode());
1.72 - }
1.73 -
1.74 - std::vector<Arc> arcs;
1.75 - for (int i = 0; i < num; ++i) {
1.76 - for (int j = 0; j < i; ++j) {
1.77 - arcs.push_back(graph.addArc(nodes[i], nodes[j]));
1.78 - }
1.79 - }
1.80 -
1.81 - typedef typename Graph::template ArcMap<int> IntArcMap;
1.82 - IntArcMap map(graph, 42);
1.83 -
1.84 - for (int i = 0; i < int(arcs.size()); ++i) {
1.85 - check(map[arcs[i]] == 42, "Wrong map constructor.");
1.86 - }
1.87 -
1.88 - for (int i = 0; i < num; ++i) {
1.89 - for (int j = i + 1; j < num; ++j) {
1.90 - arcs.push_back(graph.addArc(nodes[i], nodes[j]));
1.91 - map[arcs.back()] = 23;
1.92 - check(map[arcs.back()] == 23, "Wrong operator[].");
1.93 - }
1.94 - }
1.95 - map = constMap<Arc>(12);
1.96 - for (int i = 0; i < int(arcs.size()); ++i) {
1.97 - check(map[arcs[i]] == 12, "Wrong map constructor.");
1.98 - }
1.99 - graph.clear();
1.100 - arcs.clear();
1.101 - }
1.102 -
1.103 - template <typename Graph>
1.104 - void checkGraphEdgeMap() {
1.105 - Graph graph;
1.106 - const int num = 16;
1.107 -
1.108 - typedef typename Graph::Node Node;
1.109 - typedef typename Graph::Edge Edge;
1.110 -
1.111 - std::vector<Node> nodes;
1.112 - for (int i = 0; i < num; ++i) {
1.113 - nodes.push_back(graph.addNode());
1.114 - }
1.115 -
1.116 - std::vector<Edge> edges;
1.117 - for (int i = 0; i < num; ++i) {
1.118 - for (int j = 0; j < i; ++j) {
1.119 - edges.push_back(graph.addEdge(nodes[i], nodes[j]));
1.120 - }
1.121 - }
1.122 -
1.123 - typedef typename Graph::template EdgeMap<int> IntEdgeMap;
1.124 - IntEdgeMap map(graph, 42);
1.125 -
1.126 - for (int i = 0; i < int(edges.size()); ++i) {
1.127 - check(map[edges[i]] == 42, "Wrong map constructor.");
1.128 - }
1.129 -
1.130 - for (int i = 0; i < num; ++i) {
1.131 - for (int j = i + 1; j < num; ++j) {
1.132 - edges.push_back(graph.addEdge(nodes[i], nodes[j]));
1.133 - map[edges.back()] = 23;
1.134 - check(map[edges.back()] == 23, "Wrong operator[].");
1.135 - }
1.136 - }
1.137 - map = constMap<Edge>(12);
1.138 - for (int i = 0; i < int(edges.size()); ++i) {
1.139 - check(map[edges[i]] == 12, "Wrong map constructor.");
1.140 - }
1.141 - graph.clear();
1.142 - edges.clear();
1.143 - }
1.144 -
1.145 -}
1.146 -
1.147 -#endif