test/graph_test.h
author Balazs Dezso <deba@inf.elte.hu>
Thu, 01 Dec 2011 09:05:47 +0100
changeset 1193 c8fa41fcc4a7
parent 1187 4c89e925cfe2
child 1194 699c7eac2c6d
permissions -rw-r--r--
Type safe red and blue node set (#69)
alpar@209
     1
/* -*- mode: C++; indent-tabs-mode: nil; -*-
kpeter@171
     2
 *
alpar@209
     3
 * This file is a part of LEMON, a generic C++ optimization library.
kpeter@171
     4
 *
alpar@463
     5
 * Copyright (C) 2003-2009
kpeter@171
     6
 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
kpeter@171
     7
 * (Egervary Research Group on Combinatorial Optimization, EGRES).
kpeter@171
     8
 *
kpeter@171
     9
 * Permission to use, modify and distribute this software is granted
kpeter@171
    10
 * provided that this copyright notice appears in all copies. For
kpeter@171
    11
 * precise terms see the accompanying LICENSE file.
kpeter@171
    12
 *
kpeter@171
    13
 * This software is provided "AS IS" with no warranty of any kind,
kpeter@171
    14
 * express or implied, and with no claim as to its suitability for any
kpeter@171
    15
 * purpose.
kpeter@171
    16
 *
kpeter@171
    17
 */
kpeter@171
    18
kpeter@171
    19
#ifndef LEMON_TEST_GRAPH_TEST_H
kpeter@171
    20
#define LEMON_TEST_GRAPH_TEST_H
kpeter@171
    21
deba@228
    22
#include <set>
deba@228
    23
deba@220
    24
#include <lemon/core.h>
deba@228
    25
#include <lemon/maps.h>
deba@228
    26
kpeter@171
    27
#include "test_tools.h"
kpeter@171
    28
kpeter@171
    29
namespace lemon {
kpeter@171
    30
kpeter@171
    31
  template<class Graph>
kpeter@171
    32
  void checkGraphNodeList(const Graph &G, int cnt)
kpeter@171
    33
  {
kpeter@171
    34
    typename Graph::NodeIt n(G);
kpeter@171
    35
    for(int i=0;i<cnt;i++) {
kpeter@171
    36
      check(n!=INVALID,"Wrong Node list linking.");
kpeter@171
    37
      ++n;
kpeter@171
    38
    }
kpeter@171
    39
    check(n==INVALID,"Wrong Node list linking.");
kpeter@171
    40
    check(countNodes(G)==cnt,"Wrong Node number.");
kpeter@171
    41
  }
kpeter@171
    42
kpeter@171
    43
  template<class Graph>
deba@1187
    44
  void checkGraphRedNodeList(const Graph &G, int cnt)
deba@1187
    45
  {
deba@1187
    46
    typename Graph::RedIt n(G);
deba@1187
    47
    for(int i=0;i<cnt;i++) {
deba@1187
    48
      check(n!=INVALID,"Wrong red Node list linking.");
deba@1193
    49
      check(G.red(n),"Wrong node set check.");
deba@1193
    50
      check(!G.blue(n),"Wrong node set check.");
deba@1193
    51
      typename Graph::Node nn = n;
deba@1193
    52
      check(G.asRedNodeUnsafe(nn) == n,"Wrong node conversion.");
deba@1193
    53
      check(G.asRedNode(nn) == n,"Wrong node conversion.");
deba@1193
    54
      check(G.asBlueNode(nn) == INVALID,"Wrong node conversion.");
deba@1193
    55
      std::pair<typename Graph::RedNode, typename Graph::BlueNode> rbn =
deba@1193
    56
        G.asRedBlueNode(nn);
deba@1193
    57
      check(rbn.first == n,"Wrong node conversion.");
deba@1193
    58
      check(rbn.second == INVALID,"Wrong node conversion.");
deba@1187
    59
      ++n;
deba@1187
    60
    }
deba@1187
    61
    check(n==INVALID,"Wrong red Node list linking.");
deba@1187
    62
    check(countRedNodes(G)==cnt,"Wrong red Node number.");
deba@1187
    63
  }
deba@1187
    64
deba@1187
    65
  template<class Graph>
deba@1187
    66
  void checkGraphBlueNodeList(const Graph &G, int cnt)
deba@1187
    67
  {
deba@1187
    68
    typename Graph::BlueIt n(G);
deba@1187
    69
    for(int i=0;i<cnt;i++) {
deba@1187
    70
      check(n!=INVALID,"Wrong blue Node list linking.");
deba@1193
    71
      check(G.blue(n),"Wrong node set check.");
deba@1193
    72
      check(!G.red(n),"Wrong node set check.");
deba@1193
    73
      typename Graph::Node nn = n;
deba@1193
    74
      check(G.asBlueNodeUnsafe(nn) == n,"Wrong node conversion.");
deba@1193
    75
      check(G.asBlueNode(nn) == n,"Wrong node conversion.");
deba@1193
    76
      check(G.asRedNode(nn) == INVALID,"Wrong node conversion.");
deba@1193
    77
      std::pair<typename Graph::RedNode, typename Graph::BlueNode> rbn =
deba@1193
    78
        G.asRedBlueNode(nn);
deba@1193
    79
      check(rbn.first == INVALID,"Wrong node conversion.");
deba@1193
    80
      check(rbn.second == n,"Wrong node conversion.");
deba@1187
    81
      ++n;
deba@1187
    82
    }
deba@1187
    83
    check(n==INVALID,"Wrong blue Node list linking.");
deba@1187
    84
    check(countBlueNodes(G)==cnt,"Wrong blue Node number.");
deba@1187
    85
  }
deba@1187
    86
deba@1187
    87
  template<class Graph>
kpeter@171
    88
  void checkGraphArcList(const Graph &G, int cnt)
kpeter@171
    89
  {
kpeter@171
    90
    typename Graph::ArcIt e(G);
kpeter@171
    91
    for(int i=0;i<cnt;i++) {
kpeter@171
    92
      check(e!=INVALID,"Wrong Arc list linking.");
deba@228
    93
      check(G.oppositeNode(G.source(e), e) == G.target(e),
deba@228
    94
            "Wrong opposite node");
deba@228
    95
      check(G.oppositeNode(G.target(e), e) == G.source(e),
deba@228
    96
            "Wrong opposite node");
kpeter@171
    97
      ++e;
kpeter@171
    98
    }
kpeter@171
    99
    check(e==INVALID,"Wrong Arc list linking.");
kpeter@171
   100
    check(countArcs(G)==cnt,"Wrong Arc number.");
kpeter@171
   101
  }
kpeter@171
   102
kpeter@171
   103
  template<class Graph>
kpeter@171
   104
  void checkGraphOutArcList(const Graph &G, typename Graph::Node n, int cnt)
kpeter@171
   105
  {
kpeter@171
   106
    typename Graph::OutArcIt e(G,n);
kpeter@171
   107
    for(int i=0;i<cnt;i++) {
kpeter@171
   108
      check(e!=INVALID,"Wrong OutArc list linking.");
kpeter@171
   109
      check(n==G.source(e),"Wrong OutArc list linking.");
deba@228
   110
      check(n==G.baseNode(e),"Wrong OutArc list linking.");
deba@228
   111
      check(G.target(e)==G.runningNode(e),"Wrong OutArc list linking.");
kpeter@171
   112
      ++e;
kpeter@171
   113
    }
kpeter@171
   114
    check(e==INVALID,"Wrong OutArc list linking.");
kpeter@171
   115
    check(countOutArcs(G,n)==cnt,"Wrong OutArc number.");
kpeter@171
   116
  }
kpeter@171
   117
kpeter@171
   118
  template<class Graph>
kpeter@171
   119
  void checkGraphInArcList(const Graph &G, typename Graph::Node n, int cnt)
kpeter@171
   120
  {
kpeter@171
   121
    typename Graph::InArcIt e(G,n);
kpeter@171
   122
    for(int i=0;i<cnt;i++) {
kpeter@171
   123
      check(e!=INVALID,"Wrong InArc list linking.");
kpeter@171
   124
      check(n==G.target(e),"Wrong InArc list linking.");
deba@228
   125
      check(n==G.baseNode(e),"Wrong OutArc list linking.");
deba@228
   126
      check(G.source(e)==G.runningNode(e),"Wrong OutArc list linking.");
kpeter@171
   127
      ++e;
kpeter@171
   128
    }
kpeter@171
   129
    check(e==INVALID,"Wrong InArc list linking.");
kpeter@171
   130
    check(countInArcs(G,n)==cnt,"Wrong InArc number.");
kpeter@171
   131
  }
kpeter@171
   132
kpeter@171
   133
  template<class Graph>
kpeter@171
   134
  void checkGraphEdgeList(const Graph &G, int cnt)
kpeter@171
   135
  {
kpeter@171
   136
    typename Graph::EdgeIt e(G);
kpeter@171
   137
    for(int i=0;i<cnt;i++) {
kpeter@171
   138
      check(e!=INVALID,"Wrong Edge list linking.");
deba@228
   139
      check(G.oppositeNode(G.u(e), e) == G.v(e), "Wrong opposite node");
deba@228
   140
      check(G.oppositeNode(G.v(e), e) == G.u(e), "Wrong opposite node");
kpeter@171
   141
      ++e;
kpeter@171
   142
    }
kpeter@171
   143
    check(e==INVALID,"Wrong Edge list linking.");
kpeter@171
   144
    check(countEdges(G)==cnt,"Wrong Edge number.");
kpeter@171
   145
  }
kpeter@171
   146
kpeter@171
   147
  template<class Graph>
kpeter@171
   148
  void checkGraphIncEdgeList(const Graph &G, typename Graph::Node n, int cnt)
kpeter@171
   149
  {
kpeter@171
   150
    typename Graph::IncEdgeIt e(G,n);
kpeter@171
   151
    for(int i=0;i<cnt;i++) {
kpeter@171
   152
      check(e!=INVALID,"Wrong IncEdge list linking.");
kpeter@171
   153
      check(n==G.u(e) || n==G.v(e),"Wrong IncEdge list linking.");
deba@228
   154
      check(n==G.baseNode(e),"Wrong OutArc list linking.");
deba@228
   155
      check(G.u(e)==G.runningNode(e) || G.v(e)==G.runningNode(e),
deba@228
   156
            "Wrong OutArc list linking.");
kpeter@171
   157
      ++e;
kpeter@171
   158
    }
kpeter@171
   159
    check(e==INVALID,"Wrong IncEdge list linking.");
kpeter@171
   160
    check(countIncEdges(G,n)==cnt,"Wrong IncEdge number.");
kpeter@171
   161
  }
kpeter@171
   162
deba@228
   163
  template <class Graph>
kpeter@387
   164
  void checkGraphIncEdgeArcLists(const Graph &G, typename Graph::Node n,
kpeter@387
   165
                                 int cnt)
kpeter@387
   166
  {
kpeter@387
   167
    checkGraphIncEdgeList(G, n, cnt);
kpeter@387
   168
    checkGraphOutArcList(G, n, cnt);
kpeter@387
   169
    checkGraphInArcList(G, n, cnt);
kpeter@387
   170
  }
kpeter@387
   171
kpeter@387
   172
  template <class Graph>
deba@228
   173
  void checkGraphConArcList(const Graph &G, int cnt) {
deba@228
   174
    int i = 0;
deba@228
   175
    for (typename Graph::NodeIt u(G); u != INVALID; ++u) {
deba@228
   176
      for (typename Graph::NodeIt v(G); v != INVALID; ++v) {
deba@228
   177
        for (ConArcIt<Graph> a(G, u, v); a != INVALID; ++a) {
deba@228
   178
          check(G.source(a) == u, "Wrong iterator.");
deba@228
   179
          check(G.target(a) == v, "Wrong iterator.");
deba@228
   180
          ++i;
deba@228
   181
        }
deba@228
   182
      }
deba@228
   183
    }
deba@228
   184
    check(cnt == i, "Wrong iterator.");
kpeter@171
   185
  }
kpeter@171
   186
kpeter@171
   187
  template <class Graph>
deba@228
   188
  void checkGraphConEdgeList(const Graph &G, int cnt) {
deba@228
   189
    int i = 0;
deba@228
   190
    for (typename Graph::NodeIt u(G); u != INVALID; ++u) {
deba@228
   191
      for (typename Graph::NodeIt v(G); v != INVALID; ++v) {
deba@228
   192
        for (ConEdgeIt<Graph> e(G, u, v); e != INVALID; ++e) {
deba@228
   193
          check((G.u(e) == u && G.v(e) == v) ||
deba@228
   194
                (G.u(e) == v && G.v(e) == u), "Wrong iterator.");
deba@228
   195
          i += u == v ? 2 : 1;
deba@228
   196
        }
deba@228
   197
      }
deba@228
   198
    }
deba@228
   199
    check(2 * cnt == i, "Wrong iterator.");
kpeter@171
   200
  }
kpeter@171
   201
deba@228
   202
  template <typename Graph>
deba@228
   203
  void checkArcDirections(const Graph& G) {
deba@228
   204
    for (typename Graph::ArcIt a(G); a != INVALID; ++a) {
deba@228
   205
      check(G.source(a) == G.target(G.oppositeArc(a)), "Wrong direction");
deba@228
   206
      check(G.target(a) == G.source(G.oppositeArc(a)), "Wrong direction");
deba@228
   207
      check(G.direct(a, G.direction(a)) == a, "Wrong direction");
kpeter@171
   208
    }
kpeter@171
   209
  }
kpeter@171
   210
deba@228
   211
  template <typename Graph>
deba@228
   212
  void checkNodeIds(const Graph& G) {
deba@1187
   213
    typedef typename Graph::Node Node;
deba@228
   214
    std::set<int> values;
deba@228
   215
    for (typename Graph::NodeIt n(G); n != INVALID; ++n) {
deba@228
   216
      check(G.nodeFromId(G.id(n)) == n, "Wrong id");
deba@228
   217
      check(values.find(G.id(n)) == values.end(), "Wrong id");
deba@228
   218
      check(G.id(n) <= G.maxNodeId(), "Wrong maximum id");
deba@228
   219
      values.insert(G.id(n));
kpeter@171
   220
    }
deba@1187
   221
    check(G.maxId(Node()) <= G.maxNodeId(), "Wrong maximum id");
deba@1187
   222
  }
deba@1187
   223
deba@1187
   224
  template <typename Graph>
deba@1187
   225
  void checkRedNodeIds(const Graph& G) {
deba@1187
   226
    typedef typename Graph::RedNode RedNode;
deba@1187
   227
    std::set<int> values;
deba@1187
   228
    for (typename Graph::RedIt n(G); n != INVALID; ++n) {
deba@1187
   229
      check(G.red(n), "Wrong partition");
deba@1193
   230
      check(values.find(G.id(n)) == values.end(), "Wrong id");
deba@1193
   231
      check(G.id(n) <= G.maxRedId(), "Wrong maximum id");
deba@1187
   232
      values.insert(G.id(n));
deba@1187
   233
    }
deba@1187
   234
    check(G.maxId(RedNode()) == G.maxRedId(), "Wrong maximum id");
deba@1187
   235
  }
deba@1187
   236
deba@1187
   237
  template <typename Graph>
deba@1187
   238
  void checkBlueNodeIds(const Graph& G) {
deba@1187
   239
    typedef typename Graph::BlueNode BlueNode;
deba@1187
   240
    std::set<int> values;
deba@1187
   241
    for (typename Graph::BlueIt n(G); n != INVALID; ++n) {
deba@1187
   242
      check(G.blue(n), "Wrong partition");
deba@1193
   243
      check(values.find(G.id(n)) == values.end(), "Wrong id");
deba@1193
   244
      check(G.id(n) <= G.maxBlueId(), "Wrong maximum id");
deba@1187
   245
      values.insert(G.id(n));
deba@1187
   246
    }
deba@1187
   247
    check(G.maxId(BlueNode()) == G.maxBlueId(), "Wrong maximum id");
kpeter@171
   248
  }
kpeter@171
   249
deba@228
   250
  template <typename Graph>
deba@228
   251
  void checkArcIds(const Graph& G) {
deba@1187
   252
    typedef typename Graph::Arc Arc;
deba@228
   253
    std::set<int> values;
deba@228
   254
    for (typename Graph::ArcIt a(G); a != INVALID; ++a) {
deba@228
   255
      check(G.arcFromId(G.id(a)) == a, "Wrong id");
deba@228
   256
      check(values.find(G.id(a)) == values.end(), "Wrong id");
deba@228
   257
      check(G.id(a) <= G.maxArcId(), "Wrong maximum id");
deba@228
   258
      values.insert(G.id(a));
deba@228
   259
    }
deba@1187
   260
    check(G.maxId(Arc()) <= G.maxArcId(), "Wrong maximum id");
kpeter@171
   261
  }
alpar@209
   262
deba@228
   263
  template <typename Graph>
deba@228
   264
  void checkEdgeIds(const Graph& G) {
deba@1187
   265
    typedef typename Graph::Edge Edge;
deba@228
   266
    std::set<int> values;
deba@228
   267
    for (typename Graph::EdgeIt e(G); e != INVALID; ++e) {
deba@228
   268
      check(G.edgeFromId(G.id(e)) == e, "Wrong id");
deba@228
   269
      check(values.find(G.id(e)) == values.end(), "Wrong id");
deba@228
   270
      check(G.id(e) <= G.maxEdgeId(), "Wrong maximum id");
deba@228
   271
      values.insert(G.id(e));
deba@228
   272
    }
deba@1187
   273
    check(G.maxId(Edge()) <= G.maxEdgeId(), "Wrong maximum id");
kpeter@171
   274
  }
kpeter@171
   275
deba@228
   276
  template <typename Graph>
deba@228
   277
  void checkGraphNodeMap(const Graph& G) {
deba@228
   278
    typedef typename Graph::Node Node;
deba@228
   279
    typedef typename Graph::NodeIt NodeIt;
deba@228
   280
deba@228
   281
    typedef typename Graph::template NodeMap<int> IntNodeMap;
deba@228
   282
    IntNodeMap map(G, 42);
deba@228
   283
    for (NodeIt it(G); it != INVALID; ++it) {
deba@228
   284
      check(map[it] == 42, "Wrong map constructor.");
deba@228
   285
    }
deba@228
   286
    int s = 0;
deba@228
   287
    for (NodeIt it(G); it != INVALID; ++it) {
deba@228
   288
      map[it] = 0;
deba@228
   289
      check(map[it] == 0, "Wrong operator[].");
deba@228
   290
      map.set(it, s);
deba@228
   291
      check(map[it] == s, "Wrong set.");
deba@228
   292
      ++s;
deba@228
   293
    }
deba@228
   294
    s = s * (s - 1) / 2;
deba@228
   295
    for (NodeIt it(G); it != INVALID; ++it) {
deba@228
   296
      s -= map[it];
deba@228
   297
    }
deba@228
   298
    check(s == 0, "Wrong sum.");
deba@228
   299
kpeter@263
   300
    // map = constMap<Node>(12);
kpeter@263
   301
    // for (NodeIt it(G); it != INVALID; ++it) {
kpeter@263
   302
    //   check(map[it] == 12, "Wrong operator[].");
kpeter@263
   303
    // }
deba@228
   304
  }
deba@228
   305
deba@228
   306
  template <typename Graph>
deba@1187
   307
  void checkGraphRedMap(const Graph& G) {
deba@1187
   308
    typedef typename Graph::Node Node;
deba@1187
   309
    typedef typename Graph::RedIt RedIt;
deba@1187
   310
deba@1187
   311
    typedef typename Graph::template RedMap<int> IntRedMap;
deba@1187
   312
    IntRedMap map(G, 42);
deba@1187
   313
    for (RedIt it(G); it != INVALID; ++it) {
deba@1187
   314
      check(map[it] == 42, "Wrong map constructor.");
deba@1187
   315
    }
deba@1187
   316
    int s = 0;
deba@1187
   317
    for (RedIt it(G); it != INVALID; ++it) {
deba@1187
   318
      map[it] = 0;
deba@1187
   319
      check(map[it] == 0, "Wrong operator[].");
deba@1187
   320
      map.set(it, s);
deba@1187
   321
      check(map[it] == s, "Wrong set.");
deba@1187
   322
      ++s;
deba@1187
   323
    }
deba@1187
   324
    s = s * (s - 1) / 2;
deba@1187
   325
    for (RedIt it(G); it != INVALID; ++it) {
deba@1187
   326
      s -= map[it];
deba@1187
   327
    }
deba@1187
   328
    check(s == 0, "Wrong sum.");
deba@1187
   329
deba@1187
   330
    // map = constMap<Node>(12);
deba@1187
   331
    // for (NodeIt it(G); it != INVALID; ++it) {
deba@1187
   332
    //   check(map[it] == 12, "Wrong operator[].");
deba@1187
   333
    // }
deba@1187
   334
  }
deba@1187
   335
deba@1187
   336
  template <typename Graph>
deba@1187
   337
  void checkGraphBlueMap(const Graph& G) {
deba@1187
   338
    typedef typename Graph::Node Node;
deba@1187
   339
    typedef typename Graph::BlueIt BlueIt;
deba@1187
   340
deba@1187
   341
    typedef typename Graph::template BlueMap<int> IntBlueMap;
deba@1187
   342
    IntBlueMap map(G, 42);
deba@1187
   343
    for (BlueIt it(G); it != INVALID; ++it) {
deba@1187
   344
      check(map[it] == 42, "Wrong map constructor.");
deba@1187
   345
    }
deba@1187
   346
    int s = 0;
deba@1187
   347
    for (BlueIt it(G); it != INVALID; ++it) {
deba@1187
   348
      map[it] = 0;
deba@1187
   349
      check(map[it] == 0, "Wrong operator[].");
deba@1187
   350
      map.set(it, s);
deba@1187
   351
      check(map[it] == s, "Wrong set.");
deba@1187
   352
      ++s;
deba@1187
   353
    }
deba@1187
   354
    s = s * (s - 1) / 2;
deba@1187
   355
    for (BlueIt it(G); it != INVALID; ++it) {
deba@1187
   356
      s -= map[it];
deba@1187
   357
    }
deba@1187
   358
    check(s == 0, "Wrong sum.");
deba@1187
   359
deba@1187
   360
    // map = constMap<Node>(12);
deba@1187
   361
    // for (NodeIt it(G); it != INVALID; ++it) {
deba@1187
   362
    //   check(map[it] == 12, "Wrong operator[].");
deba@1187
   363
    // }
deba@1187
   364
  }
deba@1187
   365
deba@1187
   366
  template <typename Graph>
deba@228
   367
  void checkGraphArcMap(const Graph& G) {
deba@228
   368
    typedef typename Graph::Arc Arc;
deba@228
   369
    typedef typename Graph::ArcIt ArcIt;
deba@228
   370
deba@228
   371
    typedef typename Graph::template ArcMap<int> IntArcMap;
deba@228
   372
    IntArcMap map(G, 42);
deba@228
   373
    for (ArcIt it(G); it != INVALID; ++it) {
deba@228
   374
      check(map[it] == 42, "Wrong map constructor.");
deba@228
   375
    }
deba@228
   376
    int s = 0;
deba@228
   377
    for (ArcIt it(G); it != INVALID; ++it) {
deba@228
   378
      map[it] = 0;
deba@228
   379
      check(map[it] == 0, "Wrong operator[].");
deba@228
   380
      map.set(it, s);
deba@228
   381
      check(map[it] == s, "Wrong set.");
deba@228
   382
      ++s;
deba@228
   383
    }
deba@228
   384
    s = s * (s - 1) / 2;
deba@228
   385
    for (ArcIt it(G); it != INVALID; ++it) {
deba@228
   386
      s -= map[it];
deba@228
   387
    }
deba@228
   388
    check(s == 0, "Wrong sum.");
deba@228
   389
kpeter@263
   390
    // map = constMap<Arc>(12);
kpeter@263
   391
    // for (ArcIt it(G); it != INVALID; ++it) {
kpeter@263
   392
    //   check(map[it] == 12, "Wrong operator[].");
kpeter@263
   393
    // }
deba@228
   394
  }
deba@228
   395
deba@228
   396
  template <typename Graph>
deba@228
   397
  void checkGraphEdgeMap(const Graph& G) {
deba@228
   398
    typedef typename Graph::Edge Edge;
deba@228
   399
    typedef typename Graph::EdgeIt EdgeIt;
deba@228
   400
deba@228
   401
    typedef typename Graph::template EdgeMap<int> IntEdgeMap;
deba@228
   402
    IntEdgeMap map(G, 42);
deba@228
   403
    for (EdgeIt it(G); it != INVALID; ++it) {
deba@228
   404
      check(map[it] == 42, "Wrong map constructor.");
deba@228
   405
    }
deba@228
   406
    int s = 0;
deba@228
   407
    for (EdgeIt it(G); it != INVALID; ++it) {
deba@228
   408
      map[it] = 0;
deba@228
   409
      check(map[it] == 0, "Wrong operator[].");
deba@228
   410
      map.set(it, s);
deba@228
   411
      check(map[it] == s, "Wrong set.");
deba@228
   412
      ++s;
deba@228
   413
    }
deba@228
   414
    s = s * (s - 1) / 2;
deba@228
   415
    for (EdgeIt it(G); it != INVALID; ++it) {
deba@228
   416
      s -= map[it];
deba@228
   417
    }
deba@228
   418
    check(s == 0, "Wrong sum.");
deba@228
   419
kpeter@263
   420
    // map = constMap<Edge>(12);
kpeter@263
   421
    // for (EdgeIt it(G); it != INVALID; ++it) {
kpeter@263
   422
    //   check(map[it] == 12, "Wrong operator[].");
kpeter@263
   423
    // }
deba@228
   424
  }
deba@228
   425
deba@228
   426
kpeter@171
   427
} //namespace lemon
kpeter@171
   428
kpeter@171
   429
#endif