COIN-OR::LEMON - Graph Library

Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • test/digraph_test.cc

    r209 r228  
    2525#include "test_tools.h"
    2626#include "graph_test.h"
    27 #include "graph_maps_test.h"
    2827
    2928using namespace lemon;
    3029using namespace lemon::concepts;
    3130
    32 void check_concepts() {
     31template <class Digraph>
     32void checkDigraph() {
     33  TEMPLATE_DIGRAPH_TYPEDEFS(Digraph);
     34  Digraph G;
     35
     36  checkGraphNodeList(G, 0);
     37  checkGraphArcList(G, 0);
     38
     39  Node
     40    n1 = G.addNode(),
     41    n2 = G.addNode(),
     42    n3 = G.addNode();
     43  checkGraphNodeList(G, 3);
     44  checkGraphArcList(G, 0);
     45
     46  Arc a1 = G.addArc(n1, n2);
     47  check(G.source(a1) == n1 && G.target(a1) == n2, "Wrong arc");
     48  checkGraphNodeList(G, 3);
     49  checkGraphArcList(G, 1);
     50
     51  checkGraphOutArcList(G, n1, 1);
     52  checkGraphOutArcList(G, n2, 0);
     53  checkGraphOutArcList(G, n3, 0);
     54
     55  checkGraphInArcList(G, n1, 0);
     56  checkGraphInArcList(G, n2, 1);
     57  checkGraphInArcList(G, n3, 0);
     58
     59  checkGraphConArcList(G, 1);
     60
     61  Arc a2 = G.addArc(n2, n1), a3 = G.addArc(n2, n3), a4 = G.addArc(n2, n3);
     62  checkGraphNodeList(G, 3);
     63  checkGraphArcList(G, 4);
     64
     65  checkGraphOutArcList(G, n1, 1);
     66  checkGraphOutArcList(G, n2, 3);
     67  checkGraphOutArcList(G, n3, 0);
     68
     69  checkGraphInArcList(G, n1, 1);
     70  checkGraphInArcList(G, n2, 1);
     71  checkGraphInArcList(G, n3, 2);
     72
     73  checkGraphConArcList(G, 4);
     74
     75  checkNodeIds(G);
     76  checkArcIds(G);
     77  checkGraphNodeMap(G);
     78  checkGraphArcMap(G);
     79
     80}
     81
     82
     83void checkConcepts() {
    3384  { // Checking digraph components
    3485    checkConcept<BaseDigraphComponent, BaseDigraphComponent >();
     
    52103    checkConcept<ClearableDigraphComponent<>, ListDigraph>();
    53104    checkConcept<ErasableDigraphComponent<>, ListDigraph>();
    54     checkDigraphIterators<ListDigraph>();
    55105  }
    56106  { // Checking SmartDigraph
     
    59109    checkConcept<ExtendableDigraphComponent<>, SmartDigraph>();
    60110    checkConcept<ClearableDigraphComponent<>, SmartDigraph>();
    61     checkDigraphIterators<SmartDigraph>();
    62111  }
    63112//  { // Checking FullDigraph
    64113//    checkConcept<Digraph, FullDigraph>();
    65 //    checkDigraphIterators<FullDigraph>();
    66114//  }
    67115//  { // Checking HyperCubeDigraph
    68116//    checkConcept<Digraph, HyperCubeDigraph>();
    69 //    checkDigraphIterators<HyperCubeDigraph>();
    70117//  }
    71118}
    72119
    73120template <typename Digraph>
    74 void check_graph_validity() {
     121void checkDigraphValidity() {
    75122  TEMPLATE_DIGRAPH_TYPEDEFS(Digraph);
    76123  Digraph g;
     
    93140
    94141template <typename Digraph>
    95 void check_graph_validity_erase() {
     142void checkDigraphValidityErase() {
    96143  TEMPLATE_DIGRAPH_TYPEDEFS(Digraph);
    97144  Digraph g;
     
    121168}
    122169
    123 void check_digraphs() {
     170void checkDigraphs() {
    124171  { // Checking ListDigraph
    125172    checkDigraph<ListDigraph>();
    126     checkGraphNodeMap<ListDigraph>();
    127     checkGraphArcMap<ListDigraph>();
    128 
    129     check_graph_validity_erase<ListDigraph>();
     173    checkDigraphValidityErase<ListDigraph>();
    130174  }
    131175  { // Checking SmartDigraph
    132176    checkDigraph<SmartDigraph>();
    133     checkGraphNodeMap<SmartDigraph>();
    134     checkGraphArcMap<SmartDigraph>();
    135 
    136     check_graph_validity<SmartDigraph>();
     177    checkDigraphValidity<SmartDigraph>();
    137178  }
    138179}
    139180
    140181int main() {
    141   check_concepts();
    142   check_digraphs();
     182  checkDigraphs();
     183  checkConcepts();
    143184  return 0;
    144185}
Note: See TracChangeset for help on using the changeset viewer.