test/adaptors_test.cc
changeset 1095 ad40f7d32846
parent 998 7fdaa05a69a1
parent 1083 3e711ee55d31
child 1092 dceba191c00d
     1.1 --- a/test/adaptors_test.cc	Fri Aug 09 11:07:27 2013 +0200
     1.2 +++ b/test/adaptors_test.cc	Sun Aug 11 15:28:12 2013 +0200
     1.3 @@ -1374,51 +1374,45 @@
     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 Orienter< const GridGraph, GridGraph::EdgeMap<bool> >
    1.22 +    OrientedGridGraph;
    1.23 +  typedef SplitNodes<OrientedGridGraph> SplitGridGraph;
    1.24    typedef Undirector<const SplitGridGraph> USplitGridGraph;
    1.25 -  typedef Undirector<const USplitGridGraph> UUSplitGridGraph;
    1.26 -  checkConcept<concepts::Digraph, RevSplitGridGraph>();
    1.27    checkConcept<concepts::Digraph, SplitGridGraph>();
    1.28    checkConcept<concepts::Graph, USplitGridGraph>();
    1.29 -  checkConcept<concepts::Graph, UUSplitGridGraph>();
    1.30  
    1.31 -  RevSplitGridGraph rev_adaptor =
    1.32 -    splitNodes(reverseDigraph(orienter(graph, dir_map)));
    1.33 -  SplitGridGraph adaptor = reverseDigraph(rev_adaptor);
    1.34 +  OrientedGridGraph oadaptor = orienter(graph, dir_map);
    1.35 +  SplitGridGraph adaptor = splitNodes(oadaptor);
    1.36    USplitGridGraph uadaptor = undirector(adaptor);
    1.37 -  UUSplitGridGraph uuadaptor = undirector(uadaptor);
    1.38  
    1.39    // Check adaptor
    1.40    checkGraphNodeList(adaptor, 8);
    1.41    checkGraphArcList(adaptor, 8);
    1.42    checkGraphConArcList(adaptor, 8);
    1.43  
    1.44 -  checkGraphOutArcList(adaptor, rev_adaptor.inNode(n1), 1);
    1.45 -  checkGraphOutArcList(adaptor, rev_adaptor.outNode(n1), 1);
    1.46 -  checkGraphOutArcList(adaptor, rev_adaptor.inNode(n2), 2);
    1.47 -  checkGraphOutArcList(adaptor, rev_adaptor.outNode(n2), 1);
    1.48 -  checkGraphOutArcList(adaptor, rev_adaptor.inNode(n3), 1);
    1.49 -  checkGraphOutArcList(adaptor, rev_adaptor.outNode(n3), 1);
    1.50 -  checkGraphOutArcList(adaptor, rev_adaptor.inNode(n4), 0);
    1.51 -  checkGraphOutArcList(adaptor, rev_adaptor.outNode(n4), 1);
    1.52 +  checkGraphOutArcList(adaptor, adaptor.inNode(n1), 1);
    1.53 +  checkGraphOutArcList(adaptor, adaptor.outNode(n1), 1);
    1.54 +  checkGraphOutArcList(adaptor, adaptor.inNode(n2), 1);
    1.55 +  checkGraphOutArcList(adaptor, adaptor.outNode(n2), 0);
    1.56 +  checkGraphOutArcList(adaptor, adaptor.inNode(n3), 1);
    1.57 +  checkGraphOutArcList(adaptor, adaptor.outNode(n3), 1);
    1.58 +  checkGraphOutArcList(adaptor, adaptor.inNode(n4), 1);
    1.59 +  checkGraphOutArcList(adaptor, adaptor.outNode(n4), 2);
    1.60  
    1.61 -  checkGraphInArcList(adaptor, rev_adaptor.inNode(n1), 1);
    1.62 -  checkGraphInArcList(adaptor, rev_adaptor.outNode(n1), 1);
    1.63 -  checkGraphInArcList(adaptor, rev_adaptor.inNode(n2), 1);
    1.64 -  checkGraphInArcList(adaptor, rev_adaptor.outNode(n2), 0);
    1.65 -  checkGraphInArcList(adaptor, rev_adaptor.inNode(n3), 1);
    1.66 -  checkGraphInArcList(adaptor, rev_adaptor.outNode(n3), 1);
    1.67 -  checkGraphInArcList(adaptor, rev_adaptor.inNode(n4), 1);
    1.68 -  checkGraphInArcList(adaptor, rev_adaptor.outNode(n4), 2);
    1.69 +  checkGraphInArcList(adaptor, adaptor.inNode(n1), 1);
    1.70 +  checkGraphInArcList(adaptor, adaptor.outNode(n1), 1);
    1.71 +  checkGraphInArcList(adaptor, adaptor.inNode(n2), 2);
    1.72 +  checkGraphInArcList(adaptor, adaptor.outNode(n2), 1);
    1.73 +  checkGraphInArcList(adaptor, adaptor.inNode(n3), 1);
    1.74 +  checkGraphInArcList(adaptor, adaptor.outNode(n3), 1);
    1.75 +  checkGraphInArcList(adaptor, adaptor.inNode(n4), 0);
    1.76 +  checkGraphInArcList(adaptor, adaptor.outNode(n4), 1);
    1.77  
    1.78    checkNodeIds(adaptor);
    1.79    checkArcIds(adaptor);
    1.80 @@ -1441,29 +1435,14 @@
    1.81    checkGraphEdgeMap(uadaptor);
    1.82    checkGraphArcMap(uadaptor);
    1.83  
    1.84 -  checkGraphIncEdgeArcLists(uadaptor, rev_adaptor.inNode(n1), 2);
    1.85 -  checkGraphIncEdgeArcLists(uadaptor, rev_adaptor.outNode(n1), 2);
    1.86 -  checkGraphIncEdgeArcLists(uadaptor, rev_adaptor.inNode(n2), 3);
    1.87 -  checkGraphIncEdgeArcLists(uadaptor, rev_adaptor.outNode(n2), 1);
    1.88 -  checkGraphIncEdgeArcLists(uadaptor, rev_adaptor.inNode(n3), 2);
    1.89 -  checkGraphIncEdgeArcLists(uadaptor, rev_adaptor.outNode(n3), 2);
    1.90 -  checkGraphIncEdgeArcLists(uadaptor, rev_adaptor.inNode(n4), 1);
    1.91 -  checkGraphIncEdgeArcLists(uadaptor, rev_adaptor.outNode(n4), 3);
    1.92 -
    1.93 -  // Check uuadaptor
    1.94 -  checkGraphNodeList(uuadaptor, 8);
    1.95 -  checkGraphEdgeList(uuadaptor, 16);
    1.96 -  checkGraphArcList(uuadaptor, 32);
    1.97 -  checkGraphConEdgeList(uuadaptor, 16);
    1.98 -  checkGraphConArcList(uuadaptor, 32);
    1.99 -
   1.100 -  checkNodeIds(uuadaptor);
   1.101 -  checkEdgeIds(uuadaptor);
   1.102 -  checkArcIds(uuadaptor);
   1.103 -
   1.104 -  checkGraphNodeMap(uuadaptor);
   1.105 -  checkGraphEdgeMap(uuadaptor);
   1.106 -  checkGraphArcMap(uuadaptor);
   1.107 +  checkGraphIncEdgeArcLists(uadaptor, adaptor.inNode(n1), 2);
   1.108 +  checkGraphIncEdgeArcLists(uadaptor, adaptor.outNode(n1), 2);
   1.109 +  checkGraphIncEdgeArcLists(uadaptor, adaptor.inNode(n2), 3);
   1.110 +  checkGraphIncEdgeArcLists(uadaptor, adaptor.outNode(n2), 1);
   1.111 +  checkGraphIncEdgeArcLists(uadaptor, adaptor.inNode(n3), 2);
   1.112 +  checkGraphIncEdgeArcLists(uadaptor, adaptor.outNode(n3), 2);
   1.113 +  checkGraphIncEdgeArcLists(uadaptor, adaptor.inNode(n4), 1);
   1.114 +  checkGraphIncEdgeArcLists(uadaptor, adaptor.outNode(n4), 3);
   1.115  }
   1.116  
   1.117  int main(int, const char **) {