COIN-OR::LEMON - Graph Library

Changeset 376:b4a01426c0d9 in lemon for test/digraph_test.cc


Ignore:
Timestamp:
11/05/08 21:36:28 (11 years ago)
Author:
Peter Kovacs <kpeter@…>
Branch:
default
Phase:
public
Message:

Port hypercube digraph structure from SVN 3503 (#57)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • test/digraph_test.cc

    r366 r376  
    2121#include <lemon/smart_graph.h>
    2222#include <lemon/full_graph.h>
    23 //#include <lemon/hypercube_graph.h>
     23#include <lemon/hypercube_graph.h>
    2424
    2525#include "test_tools.h"
     
    113113}
    114114
     115void checkHypercubeDigraph(int dim) {
     116  DIGRAPH_TYPEDEFS(HypercubeDigraph);
     117
     118  HypercubeDigraph G(dim);
     119  checkGraphNodeList(G, 1 << dim);
     120  checkGraphArcList(G, (1 << dim) * dim);
     121
     122  Node n = G.nodeFromId(dim);
     123
     124  checkGraphOutArcList(G, n, dim);
     125  for (OutArcIt a(G, n); a != INVALID; ++a)
     126    check(G.source(a) == n &&
     127          G.id(G.target(a)) == G.id(n) ^ (1 << G.dimension(a)),
     128          "Wrong arc");
     129
     130  checkGraphInArcList(G, n, dim);
     131  for (InArcIt a(G, n); a != INVALID; ++a)
     132    check(G.target(a) == n &&
     133          G.id(G.source(a)) == G.id(n) ^ (1 << G.dimension(a)),
     134          "Wrong arc");
     135
     136  checkGraphConArcList(G, (1 << dim) * dim);
     137
     138  checkNodeIds(G);
     139  checkArcIds(G);
     140  checkGraphNodeMap(G);
     141  checkGraphArcMap(G);
     142}
     143
    115144
    116145void checkConcepts() {
     
    146175    checkConcept<Digraph, FullDigraph>();
    147176  }
    148 //  { // Checking HyperCubeDigraph
    149 //    checkConcept<Digraph, HyperCubeDigraph>();
    150 //  }
     177  { // Checking HypercubeDigraph
     178    checkConcept<Digraph, HypercubeDigraph>();
     179  }
    151180}
    152181
     
    213242    checkFullDigraph(8);
    214243  }
     244  { // Checking HypercubeDigraph
     245    checkHypercubeDigraph(1);
     246    checkHypercubeDigraph(2);
     247    checkHypercubeDigraph(3);
     248    checkHypercubeDigraph(4);
     249  }
    215250}
    216251
Note: See TracChangeset for help on using the changeset viewer.