COIN-OR::LEMON - Graph Library

Changeset 1193:c8fa41fcc4a7 in lemon for test/graph_test.h


Ignore:
Timestamp:
12/01/11 09:05:47 (9 years ago)
Author:
Balazs Dezso <deba@…>
Branch:
default
Phase:
public
Message:

Type safe red and blue node set (#69)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • test/graph_test.h

    r1187 r1193  
    4747    for(int i=0;i<cnt;i++) {
    4848      check(n!=INVALID,"Wrong red Node list linking.");
     49      check(G.red(n),"Wrong node set check.");
     50      check(!G.blue(n),"Wrong node set check.");
     51      typename Graph::Node nn = n;
     52      check(G.asRedNodeUnsafe(nn) == n,"Wrong node conversion.");
     53      check(G.asRedNode(nn) == n,"Wrong node conversion.");
     54      check(G.asBlueNode(nn) == INVALID,"Wrong node conversion.");
     55      std::pair<typename Graph::RedNode, typename Graph::BlueNode> rbn =
     56        G.asRedBlueNode(nn);
     57      check(rbn.first == n,"Wrong node conversion.");
     58      check(rbn.second == INVALID,"Wrong node conversion.");
    4959      ++n;
    5060    }
     
    5969    for(int i=0;i<cnt;i++) {
    6070      check(n!=INVALID,"Wrong blue Node list linking.");
     71      check(G.blue(n),"Wrong node set check.");
     72      check(!G.red(n),"Wrong node set check.");
     73      typename Graph::Node nn = n;
     74      check(G.asBlueNodeUnsafe(nn) == n,"Wrong node conversion.");
     75      check(G.asBlueNode(nn) == n,"Wrong node conversion.");
     76      check(G.asRedNode(nn) == INVALID,"Wrong node conversion.");
     77      std::pair<typename Graph::RedNode, typename Graph::BlueNode> rbn =
     78        G.asRedBlueNode(nn);
     79      check(rbn.first == INVALID,"Wrong node conversion.");
     80      check(rbn.second == n,"Wrong node conversion.");
    6181      ++n;
    6282    }
     
    208228    for (typename Graph::RedIt n(G); n != INVALID; ++n) {
    209229      check(G.red(n), "Wrong partition");
    210       check(G.redId(n) == G.id(RedNode(n)), "Wrong id");
    211       check(values.find(G.redId(n)) == values.end(), "Wrong id");
    212       check(G.redId(n) <= G.maxRedId(), "Wrong maximum id");
     230      check(values.find(G.id(n)) == values.end(), "Wrong id");
     231      check(G.id(n) <= G.maxRedId(), "Wrong maximum id");
    213232      values.insert(G.id(n));
    214233    }
     
    222241    for (typename Graph::BlueIt n(G); n != INVALID; ++n) {
    223242      check(G.blue(n), "Wrong partition");
    224       check(G.blueId(n) == G.id(BlueNode(n)), "Wrong id");
    225       check(values.find(G.blueId(n)) == values.end(), "Wrong id");
    226       check(G.blueId(n) <= G.maxBlueId(), "Wrong maximum id");
     243      check(values.find(G.id(n)) == values.end(), "Wrong id");
     244      check(G.id(n) <= G.maxBlueId(), "Wrong maximum id");
    227245      values.insert(G.id(n));
    228246    }
Note: See TracChangeset for help on using the changeset viewer.