test/adaptors_test.cc
changeset 799 6be1f9bd2ac0
parent 465 2b5496c62ccd
child 995 4bb9e72e1a41
     1.1 --- a/test/adaptors_test.cc	Sun Oct 04 10:15:32 2009 +0200
     1.2 +++ b/test/adaptors_test.cc	Wed Dec 09 11:14:06 2009 +0100
     1.3 @@ -1371,51 +1371,43 @@
     1.4    GridGraph::Node n4 = graph(1,1);
     1.5  
     1.6    GridGraph::EdgeMap<bool> dir_map(graph);
     1.7 -  dir_map[graph.right(n1)] = graph.u(graph.right(n1)) == n1;
     1.8 -  dir_map[graph.up(n1)] = graph.u(graph.up(n1)) != n1;
     1.9 -  dir_map[graph.left(n4)] = graph.u(graph.left(n4)) != n4;
    1.10 -  dir_map[graph.down(n4)] = graph.u(graph.down(n4)) != n4;
    1.11 +  dir_map[graph.right(n1)] = graph.u(graph.right(n1)) != n1;
    1.12 +  dir_map[graph.up(n1)] = graph.u(graph.up(n1)) == n1;
    1.13 +  dir_map[graph.left(n4)] = graph.u(graph.left(n4)) == n4;
    1.14 +  dir_map[graph.down(n4)] = graph.u(graph.down(n4)) == n4;
    1.15  
    1.16    // Apply several adaptors on the grid graph
    1.17 -  typedef SplitNodes< ReverseDigraph< const Orienter<
    1.18 -            const GridGraph, GridGraph::EdgeMap<bool> > > >
    1.19 -    RevSplitGridGraph;
    1.20 -  typedef ReverseDigraph<const RevSplitGridGraph> SplitGridGraph;
    1.21 +  typedef SplitNodes<Orienter< const GridGraph, GridGraph::EdgeMap<bool> > >
    1.22 +    SplitGridGraph;
    1.23    typedef Undirector<const SplitGridGraph> USplitGridGraph;
    1.24 -  typedef Undirector<const USplitGridGraph> UUSplitGridGraph;
    1.25 -  checkConcept<concepts::Digraph, RevSplitGridGraph>();
    1.26    checkConcept<concepts::Digraph, SplitGridGraph>();
    1.27    checkConcept<concepts::Graph, USplitGridGraph>();
    1.28 -  checkConcept<concepts::Graph, UUSplitGridGraph>();
    1.29  
    1.30 -  RevSplitGridGraph rev_adaptor =
    1.31 -    splitNodes(reverseDigraph(orienter(graph, dir_map)));
    1.32 -  SplitGridGraph adaptor = reverseDigraph(rev_adaptor);
    1.33 +  SplitGridGraph adaptor = splitNodes(orienter(graph, dir_map));
    1.34    USplitGridGraph uadaptor = undirector(adaptor);
    1.35 -  UUSplitGridGraph uuadaptor = undirector(uadaptor);
    1.36  
    1.37    // Check adaptor
    1.38    checkGraphNodeList(adaptor, 8);
    1.39    checkGraphArcList(adaptor, 8);
    1.40    checkGraphConArcList(adaptor, 8);
    1.41  
    1.42 -  checkGraphOutArcList(adaptor, rev_adaptor.inNode(n1), 1);
    1.43 -  checkGraphOutArcList(adaptor, rev_adaptor.outNode(n1), 1);
    1.44 -  checkGraphOutArcList(adaptor, rev_adaptor.inNode(n2), 2);
    1.45 -  checkGraphOutArcList(adaptor, rev_adaptor.outNode(n2), 1);
    1.46 -  checkGraphOutArcList(adaptor, rev_adaptor.inNode(n3), 1);
    1.47 -  checkGraphOutArcList(adaptor, rev_adaptor.outNode(n3), 1);
    1.48 -  checkGraphOutArcList(adaptor, rev_adaptor.inNode(n4), 0);
    1.49 -  checkGraphOutArcList(adaptor, rev_adaptor.outNode(n4), 1);
    1.50 +  checkGraphOutArcList(adaptor, adaptor.inNode(n1), 1);
    1.51 +  checkGraphOutArcList(adaptor, adaptor.outNode(n1), 1);
    1.52 +  checkGraphOutArcList(adaptor, adaptor.inNode(n2), 1);
    1.53 +  checkGraphOutArcList(adaptor, adaptor.outNode(n2), 0);
    1.54 +  checkGraphOutArcList(adaptor, adaptor.inNode(n3), 1);
    1.55 +  checkGraphOutArcList(adaptor, adaptor.outNode(n3), 1);
    1.56 +  checkGraphOutArcList(adaptor, adaptor.inNode(n4), 1);
    1.57 +  checkGraphOutArcList(adaptor, adaptor.outNode(n4), 2);
    1.58  
    1.59 -  checkGraphInArcList(adaptor, rev_adaptor.inNode(n1), 1);
    1.60 -  checkGraphInArcList(adaptor, rev_adaptor.outNode(n1), 1);
    1.61 -  checkGraphInArcList(adaptor, rev_adaptor.inNode(n2), 1);
    1.62 -  checkGraphInArcList(adaptor, rev_adaptor.outNode(n2), 0);
    1.63 -  checkGraphInArcList(adaptor, rev_adaptor.inNode(n3), 1);
    1.64 -  checkGraphInArcList(adaptor, rev_adaptor.outNode(n3), 1);
    1.65 -  checkGraphInArcList(adaptor, rev_adaptor.inNode(n4), 1);
    1.66 -  checkGraphInArcList(adaptor, rev_adaptor.outNode(n4), 2);
    1.67 +  checkGraphInArcList(adaptor, adaptor.inNode(n1), 1);
    1.68 +  checkGraphInArcList(adaptor, adaptor.outNode(n1), 1);
    1.69 +  checkGraphInArcList(adaptor, adaptor.inNode(n2), 2);
    1.70 +  checkGraphInArcList(adaptor, adaptor.outNode(n2), 1);
    1.71 +  checkGraphInArcList(adaptor, adaptor.inNode(n3), 1);
    1.72 +  checkGraphInArcList(adaptor, adaptor.outNode(n3), 1);
    1.73 +  checkGraphInArcList(adaptor, adaptor.inNode(n4), 0);
    1.74 +  checkGraphInArcList(adaptor, adaptor.outNode(n4), 1);
    1.75  
    1.76    checkNodeIds(adaptor);
    1.77    checkArcIds(adaptor);
    1.78 @@ -1438,29 +1430,14 @@
    1.79    checkGraphEdgeMap(uadaptor);
    1.80    checkGraphArcMap(uadaptor);
    1.81  
    1.82 -  checkGraphIncEdgeArcLists(uadaptor, rev_adaptor.inNode(n1), 2);
    1.83 -  checkGraphIncEdgeArcLists(uadaptor, rev_adaptor.outNode(n1), 2);
    1.84 -  checkGraphIncEdgeArcLists(uadaptor, rev_adaptor.inNode(n2), 3);
    1.85 -  checkGraphIncEdgeArcLists(uadaptor, rev_adaptor.outNode(n2), 1);
    1.86 -  checkGraphIncEdgeArcLists(uadaptor, rev_adaptor.inNode(n3), 2);
    1.87 -  checkGraphIncEdgeArcLists(uadaptor, rev_adaptor.outNode(n3), 2);
    1.88 -  checkGraphIncEdgeArcLists(uadaptor, rev_adaptor.inNode(n4), 1);
    1.89 -  checkGraphIncEdgeArcLists(uadaptor, rev_adaptor.outNode(n4), 3);
    1.90 -
    1.91 -  // Check uuadaptor
    1.92 -  checkGraphNodeList(uuadaptor, 8);
    1.93 -  checkGraphEdgeList(uuadaptor, 16);
    1.94 -  checkGraphArcList(uuadaptor, 32);
    1.95 -  checkGraphConEdgeList(uuadaptor, 16);
    1.96 -  checkGraphConArcList(uuadaptor, 32);
    1.97 -
    1.98 -  checkNodeIds(uuadaptor);
    1.99 -  checkEdgeIds(uuadaptor);
   1.100 -  checkArcIds(uuadaptor);
   1.101 -
   1.102 -  checkGraphNodeMap(uuadaptor);
   1.103 -  checkGraphEdgeMap(uuadaptor);
   1.104 -  checkGraphArcMap(uuadaptor);
   1.105 +  checkGraphIncEdgeArcLists(uadaptor, adaptor.inNode(n1), 2);
   1.106 +  checkGraphIncEdgeArcLists(uadaptor, adaptor.outNode(n1), 2);
   1.107 +  checkGraphIncEdgeArcLists(uadaptor, adaptor.inNode(n2), 3);
   1.108 +  checkGraphIncEdgeArcLists(uadaptor, adaptor.outNode(n2), 1);
   1.109 +  checkGraphIncEdgeArcLists(uadaptor, adaptor.inNode(n3), 2);
   1.110 +  checkGraphIncEdgeArcLists(uadaptor, adaptor.outNode(n3), 2);
   1.111 +  checkGraphIncEdgeArcLists(uadaptor, adaptor.inNode(n4), 1);
   1.112 +  checkGraphIncEdgeArcLists(uadaptor, adaptor.outNode(n4), 3);
   1.113  }
   1.114  
   1.115  int main(int, const char **) {